PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Prohits/analyst/band_list.inc.php

http://prohits.googlecode.com/
PHP | 338 lines | 308 code | 9 blank | 21 comment | 72 complexity | 28d38fc2195e252f6683afa22aaef185 MD5 | raw file
  1. <?
  2. /***********************************************************************
  3. Copyright 2010 Gingras and Tyers labs,
  4. Samuel Lunenfeld Research Institute, Mount Sinai Hospital.
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. *************************************************************************/
  15. $RawFileColor = "#2080df";
  16. $HasHitsColor = "#5b52ad";
  17. $EmptyColor = "#d9e8f0";
  18. ?>
  19. <script langue='javascript'>
  20. <?
  21. if($theaction == "addnewband"){ ?>
  22. function insert_band(){
  23. var theForm = document.action_form;
  24. <?if($Lane_ID){?>
  25. if(isEmptyStr(theForm.frm_Location.value) || !radio_checked(theForm.frm_Intensity) || isEmptyStr(theForm.frm_BandMW.value)){
  26. alert("The new band has to have band code, intensity and observed MW!");
  27. return false;
  28. }
  29. if(!isNumber(theForm.frm_BandMW.value)){
  30. alert("Observed MW has to be a number!");
  31. return false;
  32. }
  33. <?}else{?>
  34. if(isEmptyStr(theForm.frm_Location.value) ){
  35. alert("Sample code should not be empty!");
  36. return false;
  37. }
  38. <?}?>
  39. theForm.theaction.value = "insertnewband";
  40. theForm.submit();
  41. }
  42. <?}
  43. if($theaction == "modifyband"){ ?>
  44. function modify_band(Band_ID){
  45. var theForm = document.action_form;
  46. <?if($Lane_ID){?>
  47. if(isEmptyStr(theForm.frm_Location.value) || !radio_checked(theForm.frm_Intensity) || isEmptyStr(theForm.frm_BandMW.value)){
  48. alert("The new band has to have band code, intensity and observed MW!");
  49. return false;
  50. }
  51. if(!isNumber(theForm.frm_BandMW.value)){
  52. alert("Observed MW has to be a number!");
  53. return false;
  54. }
  55. <?}else{?>
  56. if(isEmptyStr(theForm.frm_Location.value) ){
  57. alert("Sample code should not be empty!");
  58. return false;
  59. }
  60. <?}?>
  61. theForm.theaction.value = "updateband";
  62. theForm.Band_ID.value = Band_ID;
  63. theForm.submit();
  64. }
  65. <?}?>
  66. </script><br>
  67. <table border="0" cellpadding="0" cellspacing="1" width="100%">
  68. <tr bgcolor="">
  69. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" height="20" align=center><div class=tableheader>&nbsp;#&nbsp;</div>
  70. </td>
  71. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align=center height="20"><div class=tableheader>Band(Sample)<br>ID</div>
  72. </td>
  73. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align=center height="20"><div class=tableheader>Band(Sample)<br>Code</div>
  74. </td>
  75. <?if($Gel_ID){?>
  76. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align=center height="20"><div class=tableheader>Intensity</div>
  77. </td>
  78. <?}?>
  79. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align=center height="20"><div class=tableheader>Observed MW</div>
  80. </td>
  81. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align=center height="20"><div class=tableheader>Modification</div>
  82. </td>
  83. <td width="" bgcolor="<?=$TB_HD_COLOR;?>" align="center" height="20"><div class=tableheader>Options</div></font>
  84. </td>
  85. </tr>
  86. <?
  87. echo "<input type=hidden name=band_counter value=$band_counter>";
  88. // start of old band list ==============================================
  89. $location_value = "";
  90. $intensity_value = "";
  91. $bandMW_value = "";
  92. $bandMod_value = "";
  93. for($i=0; $i < $Bands->count; $i++) {
  94. $location_value = $Bands->Location[$i];
  95. $intensity_value = $Bands->Intensity[$i];
  96. $bandMW_value = $Bands->BandMW[$i];
  97. $bandMod_value = $Bands->Modification[$i];
  98. $Description_value = $Bands->ResultsFile[$i];
  99. $statusArr = get_Progress_status($Bands->ID[$i], "Band");
  100. array_push($sample_id_arr, $Bands->ID[$i]);
  101. $modify_intensity = false;
  102. //modify this band
  103. if($AUTH->Modify and $theaction == "modifyband" and $Bands->ID[$i] == $Band_ID){
  104. $modify_intensity = true;
  105. ?>
  106. <tr bgcolor="<?=$TB_CELL_COLOR;?>">
  107. <td align=center><div class=maintext><?=$i+1;?></div></td>
  108. <td><div class=maintext> &nbsp;<?=$Bands->ID[$i];?></div></td>
  109. <td width="" align="left">&nbsp;
  110. <table align="left" bgcolor="" cellspacing="0" cellpadding="0" border="0">
  111. <tr>
  112. <td align=right>
  113. <input type="text" size="10" maxlength="29" name='frm_Location' value="<?=$location_value;?>">&nbsp;
  114. </td>
  115. <?Description_div_for_sample($Description_value,$Band_ID);?>
  116. </tr>
  117. </table>
  118. </td>
  119. <?if($Gel_ID){
  120. echo "<td width='' align='center'>";
  121. include("./band_color.inc.php");
  122. echo "</td>";
  123. }?>
  124. <td width="" align="center"> &nbsp;
  125. <input type="text" size="5" maxlength="20" name='frm_BandMW' value="<?=$bandMW_value;?>">
  126. <font color="black" face="helvetica,arial,futura" size="1"> kDa</font>
  127. </td>
  128. <td width="" align="center">
  129. <select name='frm_Modification'>
  130. <? dis_species_options($bandMod_value); ?>
  131. </select>
  132. </td>
  133. <td width="" align="center">
  134. <input type="button" value="Update" onclick="javascript: modify_band(<?=$Band_ID;?>);" class="black_but">
  135. </td>
  136. </tr>
  137. <?
  138. }else{
  139. //not modify the band
  140. ?>
  141. <tr bgcolor="<?=$TB_CELL_COLOR;?>">
  142. <td align=center><div class=maintext><?=$i+1;?></div> </td>
  143. <td><div class=maintext> &nbsp;<?=$Bands->ID[$i];?></div></td>
  144. <td width="" align="center">
  145. <table align="left" bgcolor="" cellspacing="0" cellpadding="0" border="0">
  146. <tr>
  147. <td align=right>
  148. <div class=maintext>&nbsp;<?=$location_value;?>&nbsp;</div>
  149. </td>
  150. <?Description_div_for_sample($Description_value,$Bands->ID[$i],'' ,'readonly');?>
  151. </tr>
  152. </table>
  153. </td>
  154. <?
  155. if($Gel_ID){
  156. echo "<td width='' align='center'>";
  157. include("./band_color.inc.php");
  158. echo "</td>";
  159. }?>
  160. <td width="" align="center">
  161. <div class=maintext>&nbsp;
  162. <?=$bandMW_value;?> kDa&nbsp;
  163. </div>
  164. </td>
  165. <td width="" align="center">
  166. <div class=maintext>&nbsp;
  167. <?=$bandMod_value;?> &nbsp;
  168. </div>
  169. </td>
  170. <td width="" align="center">
  171. <table><tr><td>
  172. <?
  173. //$statueArr = get_status($Bands->ID[$i],$HITSDB,$Bait->GelFree,'Band');
  174. $statueArr = get_status($Bands->ID[$i],'Band');
  175. ?>
  176. </td><td>
  177. <?
  178. if(!$statueArr['num_files'] && !$statueArr['num_hits'] && !$statueArr['num_hitsTppProt'] && $AUTH->Delete && $Bands->OwnerID[$i] == $AccessUserID && $SCRIPT_NAME != 'submit.php'){?>
  179. <a href="javascript:confirm_delete_band(<?=$Bands->ID[$i];?>);">
  180. <img border="0" src="images/icon_purge.gif" alt="Delete Band"></a>&nbsp;
  181. <?}else{
  182. echo "\n<img src=\"images/icon_empty.gif\">&nbsp;";
  183. }
  184. if($AUTH->Modify){
  185. if($SCRIPT_NAME == 'submit.php'){
  186. $band_list_inc_submit_url = $SCRIPT_NAME."?ProjectID=$ProjectID&gelMode=$gelMode&addNewType=$addNewType&DBname=$DBname&";
  187. }else{
  188. $band_list_inc_submit_url = $SCRIPT_NAME.'?';
  189. }
  190. ?>
  191. <a href="./<?=$band_list_inc_submit_url?>theaction=modifyband&Band_ID=<?=$Bands->ID[$i];?>&Plate_ID=<?=$Plate_ID;?><?echo ($sub)?"&sub=$sub":"";?>">
  192. <img border="0" src="images/icon_view.gif" alt="Modify Band"></a>&nbsp;
  193. <?}else{
  194. echo "\n<img src=\"images/icon_empty.gif\">&nbsp;";
  195. }?>
  196. </td>
  197. </tr></table>
  198. </td>
  199. </tr>
  200. <?
  201. } //end if modify
  202. } //end for loop
  203. //end band old band list=====================================================
  204. $location_value = "";
  205. $intensity_value = "";
  206. $bandMW_value = "";
  207. $bandMod_value = "";
  208. $modify_intensity = true;
  209. if($band_counter){
  210. for($i=0; $i < $band_counter; $i++){
  211. $new_sample_id = "new_$i";
  212. array_push($sample_id_arr, $new_sample_id);
  213. ?>
  214. <tr bgcolor="<?echo $TB_CELL_COLOR;?>">
  215. <td align=center><div class=maintext><?=$Bands->count+ $i + 1;?></div></td>
  216. <td>&nbsp;</td>
  217. <td width="" align="left">&nbsp;
  218. <table align="left" bgcolor="" cellspacing="0" cellpadding="0" border="0">
  219. <tr>
  220. <td align=right>
  221. <input type="text" size="10" maxlength="29" name='<?=$location_name[$i];?>' value=<?=($$location_name[$i])?$$location_name[$i]:$selectedWellCode_arr[$i];?>>&nbsp;
  222. </td>
  223. <?Description_div_for_sample('',$new_sample_id,$bandDescription_name[$i]);?>
  224. </tr>
  225. </table>
  226. </td>
  227. <?if($Gel_ID){
  228. echo "<td width='' align='center'>";
  229. include("./band_color.inc.php");
  230. echo "</td>";
  231. }?>
  232. <td align="center" nowrap>&nbsp;
  233. <font color="black" face="arial,futura" size="1">
  234. <input type="text" size="7" maxlength="20" name='<?=$bandMW_name[$i];?>' value='<?=$$bandMW_name[$i];?>'> kDa
  235. </font>&nbsp;
  236. </td>
  237. <td align="center" colspan=2>
  238. <select name='<?=$bandModification_name[$i];?>'>
  239. <?dis_species_options($$bandModification_name[$i]);?>
  240. </select>
  241. </td>
  242. </tr>
  243. <?
  244. }
  245. ?>
  246. <tr bgcolor=<?=$TB_CELL_COLOR;?> align='center'>
  247. <td colspan=7>
  248. <input type='button' value='Save' onclick='javascript: checkform(this.form);' class='green_but'>
  249. </td>
  250. </tr>
  251. <?
  252. } //end new band list=========================================================
  253. ?>
  254. </table>
  255. <script language="javascript">
  256. var Sample_id_arr = new Array();
  257. <?foreach($sample_id_arr as $sample_id_value){?>
  258. Sample_id_arr.push("<?=$sample_id_value?>");
  259. <?}?>
  260. document.onclick=check;
  261. var div_id = '';
  262. var tmp_flag = 0;
  263. function check(e){
  264. if(tmp_flag == 1){
  265. tmp_flag = 0;
  266. return;
  267. }
  268. for(var i=0; i<Sample_id_arr.length; i++){
  269. var div_id_tmp = "des_" + Sample_id_arr[i];
  270. var obj_tmp = document.getElementById(div_id_tmp);
  271. if(obj_tmp.style.display == 'block'){
  272. div_id = div_id_tmp;
  273. break;
  274. }
  275. }
  276. var target = (e && e.target) || (event && event.srcElement);
  277. var obj = document.getElementById(div_id);
  278. checkParent(target)?obj.style.display='none':null;
  279. }
  280. function checkParent(t){
  281. while(t.parentNode){
  282. if(t==document.getElementById(div_id)){
  283. return false
  284. }
  285. t=t.parentNode
  286. }
  287. return true
  288. }
  289. </script>
  290. <?
  291. function dis_species_options($bandMod_value){ ?>
  292. <option value="None">None
  293. <option value="Acetyl (N-term)"<?echo ($bandMod_value == 'Acetyl (N-term)')?" selected":'';?>>Acetyl (N-term)
  294. <option value="Acetyl (K)"<?echo ($bandMod_value == 'Acetyl (K)')?" selected":'';?>>Acetyl (K)
  295. <option value="Amide (C-term G)"<?echo ($bandMod_value == 'Amide (C-term G)')?" selected":'';?>>Amide (C-term G)
  296. <option value="Biotinylated (N-term)"<?echo ($bandMod_value == 'Biotinylated (N-term)')?" selected":'';?>>Biotinylated (N-term)
  297. <option value="Biotinylated (K)"<?echo ($bandMod_value == 'Biotinylated (K)')?" selected":'';?>>Biotinylated (K)
  298. <option value="Carbamyl (N-term)"<?echo ($bandMod_value == 'Carbamyl (N-term)')?" selected":'';?>>Carbamyl (N-term)
  299. <option value="Carboxymethyl (C)"<?echo ($bandMod_value == 'Carboxymethyl (C)')?" selected":'';?>>Carboxymethyl (C)
  300. <option value="Deamidation (NQ)"<?echo ($bandMod_value == 'Deamidation (NQ)')?" selected":'';?>>Deamidation (NQ)
  301. <option value="Glycosylation (N-linked)"<?echo ($bandMod_value == 'Glycosylation (N-linked)')?" selected":'';?>>Glycosylation (N-linked)
  302. <option value="Glycosylation (O-linked)"<?echo ($bandMod_value == 'Glycosylation (O-linked)')?" selected":'';?>>Glycosylation (O-linked)
  303. <option value="ICAT_light"<?echo ($bandMod_value == 'ICAT_light')?" selected":'';?>>ICAT_light
  304. <option value="ICAT_heavy"<?echo ($bandMod_value == 'ICAT_heavy')?" selected":'';?>>ICAT_heavy
  305. <option value="Methyl ester (C-term)"<?echo ($bandMod_value == 'Methyl ester (C-term)')?" selected":'';?>>Methyl ester (C-term)
  306. <option value="Methyl ester (DE)"<?echo ($bandMod_value == 'Methyl ester (DE)')?" selected":'';?>>Methyl ester (DE)
  307. <option value="NIPCAM (C)"<?echo ($bandMod_value == 'NIPCAM (C)')?" selected":'';?>>NIPCAM (C)
  308. <option value="N-Acetyl (Protein)"<?echo ($bandMod_value == 'N-Acetyl (Protein)')?" selected":'';?>>N-Acetyl (Protein)
  309. <option value="N-Formyl (Protein)"<?echo ($bandMod_value == 'N-Formyl (Protein)')?" selected":'';?>>N-Formyl (Protein)
  310. <option value="Oxidation (M)"<?echo ($bandMod_value == 'Oxidation (M)')?" selected":'';?>>Oxidation (M)
  311. <option value="Oxidation (HW)"<?echo ($bandMod_value == 'Oxidation (HW)')?" selected":'';?>>Oxidation (HW)
  312. <option value="O18 (C-term)"<?echo ($bandMod_value == 'O18 (C-term)')?" selected":'';?>>O18 (C-term)
  313. <option value="Phospho (Y)"<?echo ($bandMod_value == 'Phospho (Y)')?" selected":'';?>>Phospho (Y)
  314. <option value="Phospho (ST)"<?echo ($bandMod_value == 'Phospho (ST)')?" selected":'';?>>Phospho (ST)
  315. <option value="Propionamide (C)"<?echo ($bandMod_value == 'Propionamide (C)')?" selected":'';?>>Propionamide (C)
  316. <option value="Pyro-glu (N-term Q)"<?echo ($bandMod_value == 'Pyro-glu (N-term Q)')?" selected":'';?>>Pyro-glu (N-term Q)
  317. <option value="Pyro-glu (N-term E)"<?echo ($bandMod_value == 'Pyro-glu (N-term E)')?" selected":'';?>>Pyro-glu (N-term E)
  318. <option value="S-pyridylethyl (C)"<?echo ($bandMod_value == 'S-pyridylethyl (C)')?" selected":'';?>>S-pyridylethyl (C)
  319. <option value="SMA (K)"<?echo ($bandMod_value == 'SMA (K)')?" selected":'';?>>SMA (K)
  320. <option value="SMA (N-term)"<?echo ($bandMod_value == 'SMA (N-term)')?" selected":'';?>>SMA (N-term)
  321. <option value="Sodiated (DE)"<?echo ($bandMod_value == 'Sodiated (DE)')?" selected":'';?>>Sodiated (DE)
  322. <option value="Sodiated (C-term)"<?echo ($bandMod_value == 'Sodiated (C-term)')?" selected":'';?>>Sodiated (C-term)
  323. <option value="Sulphone (M)"<?echo ($bandMod_value == 'Sulphone (M)')?" selected":'';?>>Sulphone (M)
  324. <?
  325. }
  326. ?>