Browse Source

Added ability to extract sequences by genus and specieswq!

spficklin 12 years ago
parent
commit
e72aea0d18
1 changed files with 22 additions and 10 deletions
  1. 22 10
      tripal_feature/tripal_feature.drush.inc

+ 22 - 10
tripal_feature/tripal_feature.drush.inc

@@ -28,17 +28,19 @@ function tripal_feature_drush_command() {
   $items = array();
   $items['tripal-get-sequence'] = array(
     'description' => dt('Prints sequences that match specified categories.'),
-    'options'   => array(
-      'org'    => dt('The organism\'s common name. If specified, features for this organism will be retrieved.'),
+    'options'    => array(
+      'org'      => dt('The organism\'s common name. If specified, features for this organism will be retrieved.'),
+      'genus'    => dt('The organism\'s genus. If specified, features for all organism with this genus will be retrieved.'),
+      'species'  => dt('The organism\'s species name. If specified, features for this all organism with this species will be retrieved.'),
       'analysis' => dt('The analysis name. If specified, features for this analysis will be retrieved.'),
-      'type'   => dt('The type of feature to retrieve (e.g. mRNA). All features that match this type will be retrieved.'),
-      'name'   => dt('The name of the feature to retrieve.'),
-      'up'     => dt('An integer value specifying the number of upstream bases to include.'),
-      'down'   => dt('An integer value specifying the number of downstream bases to incldue.'),
-      'out'    => dt('The output format. Valid options are "fasta_html", "fasta_txt" and raw.'),
-      'parent' => dt('Set this argument to 1 to retrieve the sequence from the parent in an alignment rather than the residues column of the feature itself.'),
-      'agg'    => dt('Set this argument to 1 to aggregate sub features into a single sequence.  This is useful, for example, for obtaining CDS sequence from an mRNA'),
-      'child'  => dt('Set this argument to the sequence ontology term for the children to aggregate.  This is useful in the case where a gene has exons as well as CDSs and UTRs.  You may sepcify as many feature types as desired by separating each with a single comma (no spaces).'),
+      'type'     => dt('The type of feature to retrieve (e.g. mRNA). All features that match this type will be retrieved.'),
+      'name'     => dt('The name of the feature to retrieve.'),
+      'up'       => dt('An integer value specifying the number of upstream bases to include.'),
+      'down'     => dt('An integer value specifying the number of downstream bases to incldue.'),
+      'out'      => dt('The output format. Valid options are "fasta_html", "fasta_txt" and raw.'),
+      'parent'   => dt('Set this argument to 1 to retrieve the sequence from the parent in an alignment rather than the residues column of the feature itself.'),
+      'agg'      => dt('Set this argument to 1 to aggregate sub features into a single sequence.  This is useful, for example, for obtaining CDS sequence from an mRNA'),
+      'child'    => dt('Set this argument to the sequence ontology term for the children to aggregate.  This is useful in the case where a gene has exons as well as CDSs and UTRs.  You may sepcify as many feature types as desired by separating each with a single comma (no spaces).'),
     ),
     'examples' => array(
       'Standard example' => 'drush tripal-current-job',
@@ -66,6 +68,8 @@ function tripal_feature_drush_command() {
 function drush_tripal_feature_tripal_get_sequence() {
 
   $org_commonname = drush_get_option('org');  
+  $genus = drush_get_option('genus');
+  $species = drush_get_option('species');
   $analysis_name = drush_get_option('analysis');  
   $type = drush_get_option('type');
   $feature_name = drush_get_option('name');
@@ -102,6 +106,14 @@ function drush_tripal_feature_tripal_get_sequence() {
      $sql .= "AND O.common_name = '%s' ";
      $vars[] = $org_commonname;
   }
+  if ($genus) {
+     $sql .= "AND O.genus = '%s' ";
+     $vars[] = $genus;
+  }
+  if ($species) {
+     $sql .= "AND O.species = '%s' ";
+     $vars[] = $species;
+  }
   if ($type) {
     $sql .= "AND CVT.name = '%s' ";
     $vars[] = $type;