icsearch/dbsf.module File Reference

Go to the source code of this file.

Functions

 dbsf_init ()
 dbsf_perm ()
 dbsf_theme ()
 dbsf_menu ()
 dbsf_software_select_page ()
 dbsf_admin_page ()
 dbsf_check_software_active ($software)
 dbsf_admin_dataset_page ()
 dbsf_admin_software_page ()
 dbsf_software_form ($form_state)
 dbsf_software_form_submit ($form, &$form_state)
 dbsf_admin_dataset_variables_form ($form_state)
 dbsf_admin_dataset_variables_form_validate ($form, &$form_state)
 dbsf_admin_dataset_variables_form_submit ($form, &$form_state)
 dbsf_admin_newdataset_form ($form_state)
 dbsf_admin_newdataset_form_validate ($form, &$form_state)
 dbsf_admin_newdataset_form_submit ($form, &$form_state)
 dbsf_admin_link_dataset_software_form ($form_state, $software=NULL)
 dbsf_admin_link_dataset_software_form_validate ($form, &$form_state)
 dbsf_admin_link_dataset_software_form_submit ($form, &$form_state)
 dbsf_admin_dataset_perms_form ($form_state)
 dbsf_admin_dataset_perms_form_submit ($form, &$form_state)
 dbsf_form_clear ($form, &$form_state)
 dbsf_admin_database_table ($software=NULL)
 dbsf_admin_database_files_table ()
 dbsf_get_role ($limit=NULL)
 _dbsf_generate_options ($software_name)
 dbsf_batch_upload_fasta ($batch_file_data, &$context)
 dbsf_batch_save_data ($data=NULL, &$context)
 dbsf_parameter_daemon ($uid, $dir, $par, $software= 'blastall', $other_data=NULL)
 dbsf_formatdb_fastafile ($infile, $file_type= 'protein')
 dbsf_get_user_datasets ($software_name)
 dbsf_get_sequence ($uid=NULL, $database=NULL)
 dbsf_cron ()
 dbsf_delete_temp ($file=NULL)
 dbsf_link_unlink_resource_role ($resource, $role, $switch=FALSE)
 dbsf_link_unlink_software_resource ($software, $resource, $switch=FALSE)
 dbsf_get_softwareprop ($limit=NULL, $name_as_key=FALSE)
 dbsf_get_software_resources ($limit=NULL, $name_as_key=FALSE)
 dbsf_get_software ($limit=NULL, $name_as_key=NULL)
 dbsf_get_resource_roles ($resource, $name_as_key=NULL)
 dbsf_get_dataset_path ($dataset)
 dbsf_software_blast_core_settings_form ($form_state)
 dbsf_software_blast_core_settings_form_validate ($form, &$form_state)
 dbsf_software_blast_core_settings_form_submit ($form, &$form_state)
 dbsf_admin_blast_page ()
 dbsf_check_blast ($software)
 dbsf_blast_page ($sample_data=FALSE)
 dbsf_blast_form ($form_state, $sample_data=FALSE)
 dbsf_blast_form_validate ($form, &$form_state)
 dbsf_blast_form_submit ($form, &$form_state)
 dbsf_blastall_software_pars ($data, $algorithm)
 dbsf_blast_batch_finished ($success, $results, $operations)
 dbsf_blast_result_xml ($blastfile=NULL)
 dbsf_blast_result_page ($submission_uid=NULL)
 dbsf_blast_result_form ($form_state, $uid, $blastfile)
 dbsf_theme_blast_result_form ($form)


Detailed Description

Drupal Bioinformatic Server framework Module Developed by Alexie Papanicolaou and Ritika Chauhan. University of Exeter. Licensed under GPLv3
See also:
http://insectacentral.org
caution. Tabs needs the following settings to be set at /admin/settings/tabs due to tabs' bugs navigation buttons: enabled ; descriptive tab URLs: enabled. internet explorer 7 has a bug with double row tabs. use IE8

Definition in file dbsf.module.


Function Documentation

_dbsf_generate_options ( software_name  ) 

Get software options, their values and the FAPI type

Parameters:
$software_name Name of software to generate options for
Returns:
An 2D associative array. Primary key is option name and 2nd key is 'options' and 'type'. Content of options is a list array and type is a string.

Definition at line 1200 of file dbsf.module.

References dbsf_get_software_resources(), and icbasic_get_resource_cvterm_and_prop().

Referenced by dbsf_blast_form(), and dbsf_ssaha2_form().

Here is the call graph for this function:

dbsf_admin_blast_page (  ) 

Create HTML for the administration BLAST page

Menu as admin/dbsf/blast

Definition at line 2202 of file dbsf.module.

References dbsf_admin_database_table(), and dbsf_check_software_active().

Here is the call graph for this function:

dbsf_admin_database_files_table (  ) 

Builds a table with all files which could be added as datasets

Returns:
HTML of a table

Definition at line 1112 of file dbsf.module.

References dbsf_get_software(), and icbasic_get_add_resource().

Referenced by dbsf_admin_dataset_page().

Here is the call graph for this function:

dbsf_admin_database_table ( software = NULL  ) 

Builds a table containing all datasets that have been uploaded

Parameters:
$software Optionally, software to create the table for. Defaults to NULL i.e. all
Returns:
HTML of a table

Definition at line 1024 of file dbsf.module.

References dbsf_get_resource_roles(), dbsf_get_software(), dbsf_get_software_resources(), icbasic_get_add_resource(), icbasic_get_linked_resources(), and icbasic_get_resource_cvterm_and_prop().

Referenced by dbsf_admin_blast_page(), dbsf_admin_dataset_page(), and dbsf_admin_ssaha2_page().

Here is the call graph for this function:

dbsf_admin_dataset_page (  ) 

Produce HTML for the 'administrate dataset page'.

Menu admin/dbsf/dataset

Definition at line 210 of file dbsf.module.

References dbsf_admin_database_files_table(), and dbsf_admin_database_table().

Here is the call graph for this function:

dbsf_admin_dataset_perms_form ( form_state  ) 

Implements hook_form()

See also:
dbsf_admin_dataset_perms_form_validate()

dbsf_admin_dataset_perms_form_submit()

Parameters:
$form_state hook_form data

Definition at line 924 of file dbsf.module.

References dbsf_get_role(), and icbasic_get_add_resource().

Here is the call graph for this function:

dbsf_admin_dataset_perms_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_admin_dataset_perms_form()

dbsf_admin_dataset_perms_form_validate()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 974 of file dbsf.module.

References dbsf_link_unlink_resource_role().

Here is the call graph for this function:

dbsf_admin_dataset_variables_form ( form_state  ) 

Implements hook_form()

See also:
dbsf_admin_dataset_variables_form_validate()

dbsf_admin_dataset_variables_form_submit()

Parameters:
$form_state hook_form data

Definition at line 412 of file dbsf.module.

dbsf_admin_dataset_variables_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_admin_dataset_variables_form_validate()

dbsf_admin_dataset_variables_form()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 496 of file dbsf.module.

References icbasic_get_add_resource().

Here is the call graph for this function:

dbsf_admin_dataset_variables_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate()

See also:
dbsf_admin_dataset_variables_form()

dbsf_admin_dataset_variables_form_submit()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 457 of file dbsf.module.

dbsf_admin_link_dataset_software_form ( form_state,
software = NULL 
)

Implements hook_form()

See also:
dbsf_admin_link_dataset_software_form_validate()

dbsf_admin_link_dataset_software_form_submit()

Parameters:
$form_state hook_form data
$software Which software to produce form for

Definition at line 761 of file dbsf.module.

References dbsf_get_software(), and icbasic_get_add_resource().

Here is the call graph for this function:

dbsf_admin_link_dataset_software_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_admin_link_dataset_software_form()

dbsf_admin_link_dataset_software_form_validate()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 887 of file dbsf.module.

References dbsf_link_unlink_software_resource().

Here is the call graph for this function:

dbsf_admin_link_dataset_software_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate()

See also:
dbsf_admin_link_dataset_software_form()

dbsf_admin_link_dataset_software_form_submit()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 826 of file dbsf.module.

References dbsf_get_dataset_path().

Here is the call graph for this function:

dbsf_admin_newdataset_form ( form_state  ) 

Implements hook_form()

See also:
dbsf_admin_newdataset_form_validate()

dbsf_admin_newdataset_form_submit()

Parameters:
$form_state hook_form data

Definition at line 532 of file dbsf.module.

References icbasic_get_add_cv_withnames(), and icbasic_get_add_resource().

Here is the call graph for this function:

dbsf_admin_newdataset_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_admin_newdataset_form()

dbsf_admin_newdataset_form_validate()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 703 of file dbsf.module.

References dbsf_link_unlink_resource_role(), icbasic_get_add_resource(), icbasic_link_unlink_resources(), and icbasic_populate_cvterms().

Here is the call graph for this function:

dbsf_admin_newdataset_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate()

See also:
dbsf_admin_newdataset_form()

dbsf_admin_newdataset_form_submit()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 614 of file dbsf.module.

References icbasic_get_add_resource().

Here is the call graph for this function:

dbsf_admin_page (  ) 

Produce HTML for the 'administrate software page'.

Menu admin/settings/dbsf

Definition at line 166 of file dbsf.module.

dbsf_admin_software_page (  ) 

Produce HTML for the 'administrate software page'.

Menu admin/dbsf/software Grabs available plugins as well.

See also:
dbsf_software_form()

dbsf_software_blast_core_settings_form()

Definition at line 273 of file dbsf.module.

dbsf_batch_save_data ( data = NULL,
&$  context 
)

Save an array to be used for the batch API. see batch_set()

Parameters:
$data A variable to store to $context
$context The variable used by batch API to store data

Definition at line 1295 of file dbsf.module.

dbsf_batch_upload_fasta ( batch_file_data,
&$  context 
)

Upload FASTA as used in a batch operation.

Needed because we use the same create_fasta function more than once

See also:
icbasic_write_fastafile()

dbsf_formatdb_fastafile()

Parameters:
$batch_file_data Associative array with following keys.
$context Array from batch_api
Returns:
It does not return anything, it updates $context instead by altering $context['finished']

Definition at line 1255 of file dbsf.module.

References dbsf_formatdb_fastafile(), and icbasic_write_fastafile().

Here is the call graph for this function:

dbsf_blast_batch_finished ( success,
results,
operations 
)

Implements hook_batch_finish

Handles the final operations of the BATCH API

Parameters:
$success See Drupal's BATCH API
$results See Drupal's BATCH API
$operations See Drupal's BATCH API
Returns:
FALSE on failure

Definition at line 2906 of file dbsf.module.

References dbsf_parameter_daemon().

Here is the call graph for this function:

dbsf_blast_form ( form_state,
sample_data = FALSE 
)

Implements hook_form()

See also:
dbsf_blast_form_validate()

dbsf_blast_form_submit()

Parameters:
$form_state hook_form data
$sample_data Boolean, if TRUE then fill form with sample data

Definition at line 2334 of file dbsf.module.

References $user, _dbsf_generate_options(), and dbsf_get_user_datasets().

Here is the call graph for this function:

dbsf_blast_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_blast_form()

dbsf_blast_form_validate()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 2701 of file dbsf.module.

References dbsf_blastall_software_pars(), dbsf_get_dataset_path(), and icbasic_create_uid().

Here is the call graph for this function:

dbsf_blast_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate()

See also:
dbsf_blast_form()

dbsf_blast_form_submit()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 2626 of file dbsf.module.

References icbasic_validate_seq_dna(), and icbasic_validate_seq_protein().

Here is the call graph for this function:

dbsf_blast_page ( sample_data = FALSE  ) 

Creates HTML for the BLAST page

Menu as dbsf/blast

Parameters:
$sample_data If true then the form will be prefilled with sample data
Returns:
HTML of BLAST page

Definition at line 2288 of file dbsf.module.

References dbsf_check_blast().

Here is the call graph for this function:

dbsf_blast_result_form ( form_state,
uid,
blastfile 
)

Implements hook_form()

Used to produce a table of results with checkboxes which we can then select for processing (e.g. downloading). This form is themed.

See also:
dbsf_theme_blast_result_form()

dbsf_blast_result_page()

Parameters:
$form_state Form API variable
$uid Unique Identifier of algorithm's BLAST search
$blastfile Full path to BLAST results as an XML file

Definition at line 3182 of file dbsf.module.

References dbsf_blast_result_xml().

Here is the call graph for this function:

dbsf_blast_result_page ( submission_uid = NULL  ) 

Produces HTML results for a BLAST

See also:
dbsf_blast_result_form()
Parameters:
$submission_uid The UID relating to the submission. This is not the same as the individual BLAST algorithm UID as users can perform multiple algorithm searches from one form
Returns:
HTML of results, include a table and graph of hits.

Definition at line 3097 of file dbsf.module.

dbsf_blast_result_xml ( blastfile = NULL  ) 

Parses a BLAST XML file.

Parameters:
$blastfile Full path to BLAST XML file
Returns:
An associative array of the parsed XML, suitable for downstream processing

Definition at line 2962 of file dbsf.module.

Referenced by dbsf_blast_result_form().

dbsf_blastall_software_pars ( data,
algorithm 
)

Prepares the BLAST software cmdline parameters

They will then be return to a file for parsing by the daemon

See also:
dbsf_parameter_daemon Use this as a template for plugins
Parameters:
$data Associative array with BLAST option key/values for parsing into a parameter string
$algorithm The BLAST algorithm used TODO: Integrate it into $data
Returns:
A string with all the parameters, suitable to be used with cmdline interface. FALSE on failure.

Definition at line 2835 of file dbsf.module.

Referenced by dbsf_blast_form_submit().

dbsf_check_blast ( software  ) 

Checks if BLAST is setup correctly

Use this function as a template for plugins.

Parameters:
$software The name of software to check
Returns:
TRUE if software is correctly setup. Otherwise it return a string depending what is wrong:
  • variables: One of the variables such as execuutable path
  • datasets: Not enough datasets have been linked to the software
  • active: It has not been activated in the main settings page

Definition at line 2247 of file dbsf.module.

References dbsf_check_software_active(), and dbsf_get_softwareprop().

Referenced by dbsf_blast_page().

Here is the call graph for this function:

dbsf_check_software_active ( software  ) 

Helper function to check if a software is active

Parameters:
$software ID or uniquename of software to check.
Returns:
TRUE if software is active, FALSE otherwise or on failure

Definition at line 185 of file dbsf.module.

Referenced by dbsf_admin_blast_page(), dbsf_admin_ssaha2_page(), dbsf_check_blast(), dbsf_check_ssaha2(), and dbsf_software_blast_core_settings_form().

dbsf_cron (  ) 

Implement hook_cron()

Finds temporary files

Definition at line 1577 of file dbsf.module.

dbsf_delete_temp ( file = NULL  ) 

Delete a file if older than 7 days.

Used with cron

See also:
dbsf_cron()
Parameters:
$file File to delete

Definition at line 1599 of file dbsf.module.

dbsf_form_clear ( form,
&$  form_state 
)

This submit button will clear any form which calls it, incl. storage and values

Used as a hook_form_validate

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 1009 of file dbsf.module.

dbsf_formatdb_fastafile ( infile,
file_type = 'protein' 
)

Format a FASTA file for BLAST

Parameters:
$infile Full path to file to format.
$file_type Either 'protein' or 'nucleotide'
Returns:
Returns output of formatdb, or FALSE upon failure

Definition at line 1367 of file dbsf.module.

Referenced by dbsf_batch_upload_fasta().

dbsf_get_dataset_path ( dataset  ) 

Get full path to a dataset

Parameters:
$dataset Dataset to get path for
Returns:
Full path to directory.

Definition at line 2014 of file dbsf.module.

References $dir, and icbasic_get_linked_resources().

Referenced by dbsf_admin_link_dataset_software_form_validate(), dbsf_blast_form_submit(), and dbsf_ssaha2_form_submit().

Here is the call graph for this function:

dbsf_get_resource_roles ( resource,
name_as_key = NULL 
)

Get roles linked to a specific resource

Parameters:
$resource id ID or uniquename of resource to get data for
$name_as_key If TRUE, return array is not indexed by id but by the name of roles
Returns:
An associative array with id and name of roles. The key is controlled by $name_as_key

Definition at line 1973 of file dbsf.module.

Referenced by dbsf_admin_database_table(), and dbsf_get_user_datasets().

dbsf_get_role ( limit = NULL  ) 

Get drupal roles, optionally with a limit

Parameters:
$limit Optionally add a limit. It can be a two element array with first element to act as the column name and second as the value. or it can be a string to be added after WHERE.
Returns:
FALSE on failure or an associative array of names with role.rid as key

Definition at line 1166 of file dbsf.module.

Referenced by dbsf_admin_dataset_perms_form().

dbsf_get_sequence ( uid = NULL,
database = NULL 
)

Retrieve the sequence from a formatdb-ed dataset

Used when retrieving hits of BLAST reports

Parameters:
$uid the UID of the BLAST report, used to grab the database
$database Explicitly set the database to get the sequence from. It can be a string or a list array.
Returns:
HTML text of sequences in FASTA format plus a link to download a text file

Definition at line 1468 of file dbsf.module.

dbsf_get_software ( limit = NULL,
name_as_key = NULL 
)

Get all software

Parameters:
$limit Optionally add a limit. It can be an assoc. array where key is column, value is constraint or a string to append with an AND
$name_as_key If TRUE then return array has uniquename as the key and id as the value.
Returns:
An associative array of data with ID as key unless $name_as_key is set. FALSE on failure

Definition at line 1919 of file dbsf.module.

Referenced by dbsf_admin_database_files_table(), dbsf_admin_database_table(), and dbsf_admin_link_dataset_software_form().

dbsf_get_software_resources ( limit = NULL,
name_as_key = FALSE 
)

Get all resources linked for a specific software

Parameters:
$limit Aptionally an array or string to add a constraint. NB: The software table is aliased as s; resource as r; software_resource as sr and cvterm (linked with resource) as rcvterm
$name_as_key A boolean, if TRUE then return array uses names instead of IDs
Returns:
An associative array where first keys is the software id/name, second key is the resource id/name. The value is the name of the resource type.

Definition at line 1857 of file dbsf.module.

Referenced by _dbsf_generate_options(), dbsf_admin_database_table(), and dbsf_get_user_datasets().

dbsf_get_softwareprop ( limit = NULL,
name_as_key = FALSE 
)

Get the properties from the softwareprop table

Parameters:
$limit Optionally add a limit. It can be a string to be added after WHERE or an array where they keys are the column names
$name_as_key If TRUE, set the return array to use the software uniquename as the key
Returns:
A 3D associative array. First key is ID or name (controlled by $name_as_key); second key is the type_name and third is the rank (an integer). The value of the property is the value of the array.

Definition at line 1812 of file dbsf.module.

Referenced by dbsf_check_blast(), and dbsf_check_ssaha2().

dbsf_get_user_datasets ( software_name  ) 

Get software datasets available to visitor/user

Parameters:
$software_name Name of software to get datasets for
Returns:
FALSE on failure and a 3D associative array if successful. The array structure is like so: [dbtype][dbgroup][id] = name

Definition at line 1402 of file dbsf.module.

References $user, dbsf_get_resource_roles(), dbsf_get_software_resources(), icbasic_get_linked_resources(), and icbasic_get_resource_cvterm_and_prop().

Referenced by dbsf_blast_form(), and dbsf_ssaha2_form().

Here is the call graph for this function:

dbsf_init (  ) 

TODO Foreign Keys Implements hook_init().

Definition at line 28 of file dbsf.module.

dbsf_link_unlink_resource_role ( resource,
role,
switch = FALSE 
)

Link a Drupal role with a resource

Parameters:
$resource The ID or uniquename of the resource to link
$role The ID or name of the Drupal role to link
$switch Boolean of whether to delete instead of linking an association. TRUE deletes. Also, TOGGLE links if unlinked and deletes if linked.
Returns:
FALSE on failure, GRANTED/REVOKED on success

Definition at line 1629 of file dbsf.module.

Referenced by dbsf_admin_dataset_perms_form_submit(), and dbsf_admin_newdataset_form_submit().

dbsf_link_unlink_software_resource ( software,
resource,
switch = FALSE 
)

Link a software with a specific resource

Parameters:
$software The ID or uniquename of the software to link
$resource The id or name of the resource to link
$switch Boolean of whether to delete instead of linking an association. TRUE deletes. Also, TOGGLE links if unlinked and deletes if linked.
Returns:
FALSE on failure, GRANTED/REVOKED on success

Definition at line 1722 of file dbsf.module.

Referenced by dbsf_admin_link_dataset_software_form_submit().

dbsf_menu (  ) 

Implements hook_menu().

If it finds plugin files, it adds them too.

Definition at line 62 of file dbsf.module.

References dbsf_ssaha2_menu().

Here is the call graph for this function:

dbsf_parameter_daemon ( uid,
dir,
par,
software = 'blastall',
other_data = NULL 
)

Create parameter file for daemon

Parameters:
$uid A unique identifier
$dir Directory of where to create the file
$par Contents to print, such as the parameters to be used by the software
$software Name of software used
$other_data A string or array with any other data which should be written. If it is an associative array, the data are printed as $key : $value
Returns:
TRUE on success..

Definition at line 1317 of file dbsf.module.

References $dir.

Referenced by dbsf_blast_batch_finished().

dbsf_perm (  ) 

Implements hook_perm().

Definition at line 35 of file dbsf.module.

dbsf_software_blast_core_settings_form ( form_state  ) 

Implements hook_form()

See also:
dbsf_software_blast_core_settings_form_validate()

dbsf_software_blast_core_settings_form_submit()

Parameters:
$form_state hook_form data

Definition at line 2047 of file dbsf.module.

References dbsf_check_software_active().

Here is the call graph for this function:

dbsf_software_blast_core_settings_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_software_blast_core_settings_form_validate()

dbsf_software_blast_core_settings_form()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 2160 of file dbsf.module.

dbsf_software_blast_core_settings_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate()

See also:
dbsf_software_blast_core_settings_form()

dbsf_software_blast_core_settings_form_submit()

Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 2113 of file dbsf.module.

dbsf_software_form ( form_state  ) 

Implements of hook_form()

Used when selecting which software to make available

See also:
dbsf_software_form_submit()
Parameters:
$form_state hook_form data

Definition at line 336 of file dbsf.module.

dbsf_software_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit()

See also:
dbsf_software_form()
Parameters:
$form hook_form data
$form_state hook_form data

Definition at line 385 of file dbsf.module.

dbsf_software_select_page (  ) 

Produce HTML for the 'select software page'.

Menu dbsf/software

Definition at line 136 of file dbsf.module.

dbsf_theme (  ) 

Implement hook_theme()

Definition at line 47 of file dbsf.module.

dbsf_theme_blast_result_form ( form  ) 

Themes BLAST result form

See also:
dbsf_blast_result_form()
Parameters:
$form Form API form variable which will be themed.
Returns:
String with HTML of themed form.

Definition at line 3283 of file dbsf.module.


Generated on Mon Jan 4 00:11:28 2010 for DrupalBioinformaticServerFramework by  doxygen 1.5.5