blast_ui.blastp.inc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <?php
  2. function blast_protein_form($form, &$form_state) {
  3. //Protein BLAST
  4. $form['pBLAST'] = array(
  5. '#type' => 'fieldset',
  6. '#title' => t('Standard Nucleotide BLAST'),
  7. '#collapsible' => TRUE,
  8. '#collapsed' => FALSE,
  9. );
  10. $form['pBLAST']['FASTA'] = array(
  11. '#type' => 'textarea',
  12. '#title' => t('Enter FASTA sequence(s)'),
  13. '#description'=>t('Enter query sequence(s) in the text area.'),
  14. );
  15. // Upload a file as an alternative to enter a query sequence
  16. $form['#attributes']['enctype'] = 'multipart/form-data';
  17. $form['pBLAST']['UPLOAD'] = array(
  18. '#prefix' => 'Or upload your query files: ',
  19. '#type' => 'file',
  20. '#description' => t('Please give a text file, not a MS-Word or other document, you can upload up to 10 Mb.'),
  21. );
  22. //// Job title
  23. // $form ['pBLAST']['JOB_ID'] = array(
  24. // '#type' => 'textfield',
  25. // '#title' => t('Job title'),
  26. // '#suffix' => t('Enter a descriptive title for your pairwise alignment'),
  27. // );
  28. //DATABASE//
  29. $form['DB'] = array(
  30. '#type' => 'fieldset',
  31. '#title' => t('BLAST Assembled KnowPulse Genomes'),
  32. '#collapsible' => TRUE,
  33. '#collapsed' => FALSE,
  34. );
  35. $form['DB']['SELECT_DB'] = array(
  36. '#type' => 'select',
  37. '#title' => t('KnowPulse Databases:'),
  38. '#options' => array(
  39. 0 => t('Human immunodeficiency virus 1'),
  40. 1 => t('Human immunodeficiency virus 2'),
  41. 2 => t('Simian immunodeficiency virus'),
  42. 3 => t('Human herpesvirus 2'),
  43. 4 => t('Human herpesvirus 1'),
  44. ),
  45. '#default_value' => NULL,
  46. );
  47. // Upload a file as an alternative to enter a query sequence
  48. $form['#attributes']['enctype'] = 'multipart/form-data';
  49. $form['DB']['UPLOAD'] = array(
  50. '#prefix' => 'Or upload your own dataset: ',
  51. '#type' => 'file',
  52. '#description' => t('Please give a text file, not a MS-Word or other document, you can upload up to 10 Mb.'),
  53. );
  54. //Algorithm parameters
  55. $form['ALG'] = array(
  56. '#type' => 'fieldset',
  57. '#title' => t('Algorithm parameters'),
  58. '#collapsible' => TRUE,
  59. '#collapsed' => TRUE,
  60. );
  61. //General parameters
  62. $form['ALG']['GParam'] = array(
  63. '#type' => 'fieldset',
  64. '#title' => t('General parameters'),
  65. '#collapsible' => FALSE,
  66. );
  67. $form['ALG']['GParam']['maxTarget'] = array(
  68. '#type' => 'select',
  69. '#title' => t('Max target sequences:'),
  70. '#options' => array(
  71. 0 => t('10'),
  72. 1 => t('50'),
  73. 2 => t('100'),
  74. 3 => t('250'),
  75. 4 => t('500'),
  76. 5 => t('1000'),
  77. 6 => t('5000'),
  78. 7 => t('10000'),
  79. 8 => t('20000'),
  80. ),
  81. '#default_value' => 2,
  82. '#description' => t('Select the maximum number of aligned sequences to display'),
  83. );
  84. $form['ALG']['GParam']['shortQueries'] = array(
  85. '#type' => 'checkbox',
  86. '#title' => t('Automatically adjust parameters for short input sequences'),
  87. '#default_value' => TRUE,
  88. );
  89. $form['ALG']['GParam']['eVal'] = array(
  90. '#type' => 'textfield',
  91. '#title' => t('Expect threshold'),
  92. '#default_value' => 10,
  93. '#size' => 12,
  94. '#maxlength' => 20,
  95. '#description' => t('Expected number of chance matches in a random model.'),
  96. );
  97. $form['ALG']['GParam']['wordSize'] = array(
  98. '#type' => 'select',
  99. '#title' => t('Word size:'),
  100. '#options' => array(
  101. 0 => t('2'),
  102. 1 => t('3'),
  103. ),
  104. '#default_value' => 1,
  105. '#description' => t('The length of the seed that initiates an alignment'),
  106. );
  107. $form['ALG']['GParam']['qRange'] = array(
  108. '#type' => 'textfield',
  109. '#title' => t('Max matches in a query range'),
  110. '#default_value' => 0,
  111. '#size' => 12,
  112. '#maxlength' => 20,
  113. '#description' => t('Limit the number of matches to a query range. This option is useful if many strong matches to one part of a query may prevent BLAST from presenting weaker matches to another part of the query.'),
  114. );
  115. // Scoring parameters
  116. $form['ALG']['SParam'] = array(
  117. '#type' => 'fieldset',
  118. '#title' => t('Scoring parameters'),
  119. '#collapsible' => FALSE,
  120. );
  121. $options_first = _ajax_example_get_first_dropdown_options();
  122. $selected = isset($form_state['values']['MATRIX'] ) ? $form_state['values']['MATRIX'] : key($options_first);
  123. $form['ALG']['SParam']['MATRIX'] = array(
  124. '#type' => 'select',
  125. '#title' => 'Matrix',
  126. '#options' => $options_first,
  127. '#default_value' => $selected,
  128. '#description' => t('Assigns a score for aligning pairs of residues, and determines overall alignment score..'),
  129. '#ajax' => array(
  130. 'callback' => 'ajax_example_dependent_dropdown_callback',
  131. 'wrapper' => 'dropdown-second-replace',
  132. ),
  133. );
  134. $form['ALG']['SParam']['gapCost'] = array(
  135. '#type' => 'select',
  136. '#title' => t('Gap Costs:'),
  137. '#prefix' => '<div id="dropdown-second-replace">',
  138. '#suffix' => '</div>',
  139. '#options' => _ajax_example_get_second_dropdown_options($selected),
  140. '#default_value' => 2,
  141. '#description' => t('Cost to create and extend a gap in an alignment.'),
  142. );
  143. $form['ALG']['SParam']['M&MScores'] = array(
  144. '#type' => 'select',
  145. '#title' => t('Match/Mismatch Scores:'),
  146. '#options' => array(
  147. 0 => t('No adjustment'),
  148. 1 => t('Composition-based statistics'),
  149. 2 => t('Conditional compositional score matrix adjustment'),
  150. 3 => t('Universal composition score matrix adjustment '),
  151. ),
  152. '#default_value' => 2,
  153. '#description' => t('Matrix adjustment method to compensate for amino acid composition of sequences'),
  154. );
  155. //Submit
  156. $form['next'] = array(
  157. '#type' => 'submit',
  158. '#value' => ' BLAST ',
  159. );
  160. return $form;
  161. }
  162. function _ajax_example_get_first_dropdown_options() {
  163. return drupal_map_assoc(array(
  164. t('PAM30'),
  165. t('PAM70'),
  166. t('PAM250'),
  167. t('BLOSUM80'),
  168. t('BLOSUM62'),
  169. t('BLOSUM45'),
  170. t('BLOSUM50'),
  171. t('BLOSUM90'),
  172. ));
  173. }
  174. function _ajax_example_get_second_dropdown_options($key = '') {
  175. $options = array(
  176. t('PAM30') => drupal_map_assoc(array(
  177. t('Extension: 15 Extension: 3'),
  178. t('Extension: 14 Extension: 3'),
  179. t('Extension: 13 Extension: 3'),
  180. t('Extension: 12 Extension: 3'),
  181. t('Extension: 11 Extension: 3'),
  182. t('Extension: 17 Extension: 2'),
  183. t('Extension: 16 Extension: 2'),
  184. t('Extension: 15 Extension: 2'),
  185. t('Extension: 14 Extension: 2'),
  186. t('Extension: 13 Extension: 2'),
  187. t('Extension: 21 Extension: 1'),
  188. t('Extension: 20 Extension: 1'),
  189. t('Extension: 19 Extension: 1'),
  190. t('Extension: 18 Extension: 1'),
  191. t('Extension: 17 Extension: 1'),
  192. )),
  193. t('PAM70') => drupal_map_assoc(array(
  194. t('Flute'),
  195. t('Clarinet'),
  196. t('Oboe'),
  197. t('Bassoon'),
  198. )),
  199. t('PAM250') => drupal_map_assoc(array(
  200. t('Trumpet'),
  201. t('Trombone'),
  202. t('French Horn'),
  203. t('Euphonium'),
  204. )),
  205. t('BLOSUM80') => drupal_map_assoc(array(
  206. t('Bass Drum'),
  207. t('Timpani'),
  208. t('Snare Drum'),
  209. t('Tambourine'),
  210. )),
  211. t('BLOSUM62') => drupal_map_assoc(array(
  212. t('Bass Drum'),
  213. t('Timpani'),
  214. t('Snare Drum'),
  215. t('Tambourine'),
  216. )),
  217. t('BLOSUM45') => drupal_map_assoc(array(
  218. t('Bass Drum'),
  219. t('Timpani'),
  220. t('Snare Drum'),
  221. t('Tambourine'),
  222. )),
  223. t('BLOSUM50') => drupal_map_assoc(array(
  224. t('Bass Drum'),
  225. t('Timpani'),
  226. t('Snare Drum'),
  227. t('Tambourine'),
  228. )),
  229. t('BLOSUM90') => drupal_map_assoc(array(
  230. t('Bass Drum'),
  231. t('Timpani'),
  232. t('Snare Drum'),
  233. t('Tambourine'),
  234. )),
  235. );
  236. if (isset($options[$key])) {
  237. return $options[$key];
  238. } else {
  239. return array();
  240. }
  241. }
  242. function ajax_example_dependent_dropdown_callback($form, $form_state) {
  243. return $form['ALG']['SParam']['gapCost'];
  244. }