blast_ui.blastp.inc 9.3 KB

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