tripal_feature.drush.inc

  1. 2.x tripal_feature/tripal_feature.drush.inc
  2. 3.x legacy/tripal_feature/tripal_feature.drush.inc
  3. 1.x tripal_feature/tripal_feature.drush.inc

Contains function relating to drush-integration of this module.

File

tripal_feature/tripal_feature.drush.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains function relating to drush-integration of this module.
  5. */
  6. /**
  7. * Describes each drush command implemented by the module
  8. *
  9. * @return
  10. * The first line of description when executing the help for a given command
  11. */
  12. function tripal_feature_drush_help($command) {
  13. switch ($command) {
  14. case 'drush:tripal-get_sequence':
  15. return dt('Prints sequences that match specified categories.');
  16. }
  17. }
  18. /**
  19. * Registers a drush command and constructs the full help for that command
  20. *
  21. * @return
  22. * And array of command descriptions
  23. */
  24. function tripal_feature_drush_command() {
  25. $items = array();
  26. $items['tripal-get-sequence'] = array(
  27. 'description' => dt('Prints sequences that match specified categories.'),
  28. 'options' => array(
  29. 'org' => dt('The organism\'s common name. If specified, features for this organism will be retrieved.'),
  30. 'genus' => dt('The organism\'s genus. If specified, features for all organism with this genus will be retrieved.'),
  31. 'species' => dt('The organism\'s species name. If specified, features for this all organism with this species will be retrieved.'),
  32. 'analysis' => dt('The analysis name. If specified, features for this analysis will be retrieved.'),
  33. 'type' => dt('The type of feature to retrieve (e.g. mRNA). All features that match this type will be retrieved.'),
  34. 'name' => dt('The name of the feature to retrieve.'),
  35. 'up' => dt('An integer value specifying the number of upstream bases to include.'),
  36. 'down' => dt('An integer value specifying the number of downstream bases to incldue.'),
  37. 'out' => dt('The output format. Valid options are "fasta_html", "fasta_txt" and raw.'),
  38. '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.'),
  39. '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'),
  40. '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).'),
  41. 'relationship' => dt('Retreives the sequence of any feature in the specified relationship with the matched features.'),
  42. 'rel_part' => dt('If a relationship is provided, then this will be "subject" or "object" indicating the side of the relationship for the matched features. If the matched features are the "object" then the "subject" features will have their sequences included in the output (and vice versa).'),
  43. ),
  44. 'examples' => array(
  45. 'Standard example' => 'drush tripal-current-job',
  46. ),
  47. 'aliases' => array('trp-get-seq'),
  48. );
  49. $items['tripal-feature-sync'] = array(
  50. 'description' => dt('Syncs an individual feature.'),
  51. 'options' => array(
  52. 'id' => dt('The feature ID of the feature to sync'),
  53. ),
  54. 'examples' => array(
  55. 'Standard example' => 'drush tripal-feature-sync --id=48273',
  56. ),
  57. 'aliases' => array('trp-fsync'),
  58. );
  59. return $items;
  60. }
  61. /**
  62. * Executes jobs in the Tripal Jobs Queue
  63. *
  64. * NOTE: The following code is executed when drush 'trpjob-run' or 'drush tripal-launch-jobs' is called
  65. */
  66. function drush_tripal_feature_tripal_get_sequence() {
  67. $org_commonname = drush_get_option('org');
  68. $genus = drush_get_option('genus');
  69. $species = drush_get_option('species');
  70. $analysis_name = drush_get_option('analysis');
  71. $type = drush_get_option('type');
  72. $feature_name = drush_get_option('name');
  73. $upstream = drush_get_option('up');
  74. $downstream = drush_get_option('down');
  75. $output_format = drush_get_option('out');
  76. $derive_from_parent = drush_get_option('parent');
  77. $aggregate = drush_get_option('agg');
  78. $child = drush_get_option('child');
  79. $relationship = drush_get_option('relationship');
  80. $rel_part = drush_get_option('rel_part');
  81. if($relationship and !$rel_part){
  82. print "Please specify both 'relationship' and a 'rel_part' arguments. Both must be used together\n";
  83. return;
  84. }
  85. tripal_feature_seq_extract_get_features($org_commonname, $genus, $species, $analysis_name,
  86. $type, $feature_name, $upstream, $downstream, $output_format, $derive_from_parent,
  87. $aggregate, $child, $relationship, $rel_part);
  88. }
  89. /*
  90. *
  91. */
  92. function drush_tripal_feature_sync() {
  93. $feature_id = drush_get_option('id');
  94. tripal_feature_sync_feature($feature_id);
  95. }