Changeset 550


Ignore:
Timestamp:
Jan 23, 2008, 3:21:52 PM (13 years ago)
Author:
mbayer
Message:

have restructured the code completely that writes the hybs section

Location:
branches/uk_ac_ebi_Tab2MageImporter
Files:
3 added
25 edited

Legend:

Unmodified
Added
Removed
  • branches/uk_ac_ebi_Tab2MageImporter/TODO.txt

    r548 r550  
    1010- if pooling, include a pooling protocol in the pooling section
    1111- implement failure conditions i.e. unsupported cases
     12- improve maintainability: move hidden inputs out of configureimport.jsp and go through submit.jsp instead
     13- improve maintainability: move all variables into the data bean and then use reflection to get at them in the importer and the writer classes
     14- enable tab2mage autogenerate only mode where file gets written to account (in new folder as before) but then there is no data import or object creation (users then import their data later together with the file they created here)
  • branches/uk_ac_ebi_Tab2MageImporter/html/autogenerate.html

    r548 r550  
    4545<body>
    4646
    47 <h1>Tab2MAGE Import Wizard -- Additional Information for Autogenerate Mode</h1>
     47<h2>Tab2MAGE Import Wizard -- Additional Information for Autogenerate Mode</h2>
    4848<p>
    4949
  • branches/uk_ac_ebi_Tab2MageImporter/html/hybridizations.html

    r522 r550  
    77<link rel="stylesheet" type="text/css" href="../jsp/uk/ac/ebi/nugo/plugins/styles.css" />
    88
     9<script type="text/javascript">
     10    function hideTwoChannelQuestions()
     11    {
     12      var dyeSwapRow = document.getElementById('dyeSwapRow');
     13      var refSampleRow = document.getElementById('refSampleRow');
     14      var poolingRow = document.getElementById('poolingRow');
     15
     16            //items are currently displayed, so hide them
     17          dyeSwapRow.style.display = "none";
     18          refSampleRow.style.display = "none";
     19          poolingRow.style.display = "none";
     20    }
     21   
     22    function showTwoChannelQuestions()
     23    {
     24      var dyeSwapRow = document.getElementById('dyeSwapRow');
     25      var refSampleRow = document.getElementById('refSampleRow');
     26      var poolingRow = document.getElementById('poolingRow');
     27
     28           //items are currently hidden, so display them
     29          dyeSwapRow.style.display = "table-row";
     30          refSampleRow.style.display = "table-row";
     31          poolingRow.style.display = "table-row";
     32    }
     33   
     34    function checkRefSampleLogic()
     35    {
     36        if(document.getElementById("dyeSwapYes").checked && document.getElementById("refSampleYes").checked)
     37        {
     38          alert('Reference Sample and Dye Swap cannot both be set to "yes"');
     39        }
     40    }
     41
     42   
     43    </script>
     44
    945</head>
     46
    1047<body>
    1148
    12 <h2>Tab2MAGE Importer -- Your Hybridizations</h2>
    13 Page 3 of 3
     49
     50
     51
     52
     53<form name="hybridizations"action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/userchoice2.jsp?ID=<%=ID%>" method="post">
     54<input type="hidden" name="ID" value="<%=ID%>">
     55<input type="hidden" name="cmd" value="SetParameters">
     56<input type="hidden"name="requestId" value="<%=requestId%>">
     57
     58<input type="hidden" name="file_id" value="">
     59<input type="hidden" name="zipFile" value="/home/michab/potato_small.zip"  id="zipFile">
     60
     61<h2>Tab2MAGE Import Wizard -- Your Hybridizations</h2>
     62
    1463<p>
    15 
    16 <form>
    17 
    1864<!--  table with the input form -->
    1965<table cellpadding="15">
    2066
    21   <!-- question 1 -->
    22   <tr style="border-color: #6E94B7;border-style: solid;border-width: 1px">
     67  <!-- platform -->
     68  <tr >
    2369    <td class="boldText">Microarray platform:</td>
    24     <td class="input"><select name="parameter:platform">
    25     <option >Affymetrix</option>
    26     <option >Agilent</option>
    27     <option >AIDA</option>
    28     <option >BZScan</option>
    29     <option >ChipSkipper</option>
    30     <option >GenePix</option>
    31     <option >GeneTAC</option>
    32     <option >Illumina</option>
    33     <option >Imagene</option>
    34     <option >QuantArray Biotin</option>
    35     <option >QuantArray Cy</option>
    36     <option >Spotfinder</option>
    37     <option ><i>Custom</i></option>
     70    <td class="input">
     71    <select name="platform">
     72    <option onclick="hideTwoChannelQuestions();" selected="selected" >Affymetrix</option>
     73    <option onclick="showTwoChannelQuestions();">Agilent</option>
     74    <option onclick="showTwoChannelQuestions();">AIDA</option>
     75    <option onclick="showTwoChannelQuestions();">BZScan</option>
     76    <option onclick="showTwoChannelQuestions();">ChipSkipper</option>
     77    <option onclick="showTwoChannelQuestions();">GenePix</option>
     78    <option onclick="showTwoChannelQuestions();">GeneTAC</option>
     79    <option onclick="showTwoChannelQuestions();">Illumina</option>
     80    <option onclick="showTwoChannelQuestions();">Imagene</option>
     81    <option onclick="showTwoChannelQuestions();">QuantArray Biotin</option>
     82    <option onclick="showTwoChannelQuestions();">QuantArray Cy</option>
     83    <option onclick="showTwoChannelQuestions();">Spotfinder</option>
     84    <option onclick="showTwoChannelQuestions();"><i>Custom</i></option>
    3885    </select></td>
    3986    <td>The manufacturer of the microarray chip used.</td>
    4087  </tr>
    4188
    42   <!-- question 2 -->
     89  <!-- organism -->
    4390  <tr>
    4491    <td class="boldText">Experimental organism:</td>
    45     <td class="input"><input type="text" size="50" name="parameter:organism" value="Solanum tuberosum"/></td>
     92    <td class="input"><input type="text" size="50" name="organism" value="Hordeum vulgare"/></td>
    4693    <td>The full scientific name of the experimental organism used.</td>
    4794  </tr>
    4895
    49   <!-- question 3 -->
     96  <!-- num array designs -->
    5097  <tr>
    5198    <td class="boldText">Number of different arrays designs used:</td>
    52     <td class="input"><input type="text" size="3" name="parameter:numDesigns" value="1"/></td>
    53     <td>If more than one array design was used in parallel, please specify the number here.</td>
    54   </tr>
    55 
    56   <!-- question 4 -->
    57   <tr>
    58     <td class="boldText">Dye-swap</td>
    59     <td class="input">yes <input type="radio" name="parameter:dyeSwap" value="yes"> no <input type="radio"
    60       name="parameter:dyeSwap" value="no" checked="checked"> <br>
    61      
    62     </td>
    63     <td>If you used a dye-swap design please indicate this here.</td>
    64   </tr>
    65 
    66   <!-- question 5 -->
    67   <tr>
    68     <td class="boldText">Reference sample</td>
    69     <td class="input">yes <input type="radio" name="parameter:refSample" value="yes" > no <input type="radio"
    70       name="parameter:refSample" value="no" checked="checked"></td>
    71     <td>If you used a reference sample please indicate this here.</td>
    72   </tr>
    73 
    74   <!-- question 6 -->
     99    <td class="input"><input type="text" size="3" name="numDesigns" value="1"/></td>
     100    <td>If more than one array design was used in parallel, please specify the number here.
     101    We assume that all samples are applied once to each array design</td>
     102  </tr>
     103
     104
     105  <!-- num treatment grps -->
    75106  <tr>
    76107    <td class="boldText">Number of treatment groups:</td>
    77     <td class="input"><input type="text" size="3" name="parameter:numTreatmentGroups" value="2"/></td>
    78     <td>The number of permutations of factor values. <p>
     108    <td class="input"><input type="text" size="3" name="numTreatmentGroups" value="2"/></td>
     109    <td>The number of discrete combinations of factor values, i.e. the product of the number of factor levels(values) from all factors. <p>
    79110    Example: an experiment with 2 factors and 3 factor values in each will have 6 treatment groups (2 X 3).
    80111    </td>
    81112  </tr>
    82113
    83   <!-- question 7 -->
     114  <!-- exp factors -->
    84115  <tr>
    85116    <td class="boldText">Experimental factors:
    86117    </td>
    87     <td class="input"><textarea rows="7" cols="35" name="parameter:expFactors">Strain(mutant,wildtype)</textarea></td>
     118    <td class="input"><textarea rows="7" cols="32" name="expFactors">Strain(mutant,wildtype)</textarea></td>
    88119    <td>Please list all experimental factors and value ranges using the following format (one per
    89120    line):<br>
    90121    <i>Factor 1(value1,value2,...valueN)<br></i>
    91122    <p>Example: <i><br>
    92     Compound(aspirin,ibuprofen,acetaminophen) <br>
     123    Compound(aspirin,ibuprofen) <br>
    93124    Dose(control,low,medium,high)</i></td>
    94125  </tr>
    95126
    96   <!-- question 8 -->
     127  <!-- num subjects -->
    97128  <tr>
    98129    <td class="boldText">Number of subjects per group:</td>
    99     <td class="input"><input type="text" size="3" name="parameter:numReplicates" value="2"/></td>
     130    <td class="input"><input type="text" size="3" name="numReplicates" value="2"/></td>
    100131    <td>This is the number of biological replicates in each treatment group.</td>
    101132  </tr>
    102133 
    103   <!-- question 9 -->
     134  <!-- subject labels -->
     135  <tr>
     136    <td class="boldText">Subject (replicate) labels:</td>
     137    <td class="input"><textarea rows="8" cols="32" name="subjectNames"></textarea></td>
     138    <td>Please provide a list of labels(names) for the experimental subjects, one per line,
     139     in no particular order (copy and paste from Excel works).</td>
     140  </tr>
     141 
     142  <!-- tissues -->
    104143  <tr>
    105144    <td class="boldText">Target tissues:</td>
    106     <td class="input"><textarea rows="2" cols="35" name="parameter:tissues">stem</textarea></td>
    107     <td>List all target tissues (as a comma separated list).<br>
    108     Example: liver,heart,adipose tissue</td>
     145    <td class="input"><textarea rows="4" cols="32" name="tissues">stem</textarea></td>
     146    <td>List all target tissues one per line, in no particular order (copy and paste from Excel works).</td>
     147  </tr>
     148
     149
     150  <!-- dye swap -->
     151  <tr id="dyeSwapRow"  style="display:none">
     152    <td class="boldText">Dye-swap</td>
     153    <td class="input">
     154    <table class="noBorder" cellpadding="4">
     155      <tr>
     156        <td class="noBorder"><input type="radio" name="dyeSwap" id="dyeSwapYes" value="yes" onchange="checkRefSampleLogic();"/></td>
     157        <td class="noBorder">yes</td>
     158      </tr>
     159
     160      <tr>
     161        <td class="noBorder"><input type="radio" name="dyeSwap" id="dyeSwapNo" value="no" checked="checked"  onchange="checkRefSampleLogic();"/></td>
     162        <td class="noBorder">no</td>
     163      </tr>
     164    </table>     
     165    </td>
     166    <td>If you used a dye-swap design please indicate this here.</td>
     167  </tr>
     168
     169  <!-- ref sample -->
     170  <tr id="refSampleRow"  style="display:none">
     171    <td class="boldText">Reference sample</td>
     172    <td class="input"> 
     173    <table class="noBorder" cellpadding="4">
     174      <tr>
     175        <td class="noBorder"><input type="radio" name="refSample" id="refSampleYes" value="yes"  onchange="checkRefSampleLogic();"/></td>
     176        <td class="noBorder">yes</td>
     177      </tr>
     178
     179      <tr>
     180        <td class="noBorder"><input type="radio"name="refSample" id="refSampleNo" value="no"  checked="checked"  onchange="checkRefSampleLogic();"/></td>
     181        <td class="noBorder">no</td>
     182      </tr>
     183    </table>       
     184    </td>
     185    <td>If you used a reference sample please indicate this here.</td>
    109186  </tr>
    110187 
    111   <!-- question 10 -->
    112   <tr>
     188  <!-- pooling -->
     189  <tr id="poolingRow"  style="display:none">
    113190    <td class="boldText">Sample pooling:</td>
    114     <td class="input">yes <input type="radio" name="parameter:pooling" value="yes"> no <input type="radio"
    115       name="parameter:pooling" value="no" checked="checked"></td>
     191    <td class="input">
     192    <table class="noBorder" cellpadding="4">
     193      <tr>
     194        <td class="noBorder"><input type="radio" name="pooling" value="yes"></td>
     195        <td class="noBorder">yes</td>
     196      </tr>
     197      <tr>
     198        <td class="noBorder"><input type="radio" name="pooling" value="no" checked="checked"></td>
     199        <td class="noBorder">no</td>
     200      </tr>
     201    </table>   
     202    </td>
    116203    <td>If the samples were pooled please indicate this here.</td>
    117204  </tr>
     
    123210
    124211    <td class="input">
    125     <table class="noBorder" border="0" cellspacing="0" cellpadding="0">
    126       <tr class="noBorder" valign="middle">
     212    <table class="noBorder" border="0" cellspacing="0" cellpadding="5">
     213      <tr class="noBorder" >
    127214     
    128         <td ><input type="text" name="path" size="40" value="">&nbsp;</td>
     215        <td style="vertical-align: middle;border-style: none;"><input type="text" name="path" size="35" value=""></td>
    129216       
    130         <td>
    131         <div class="buttonclass"
    132           onmouseover="this.className='buttonclass_hover';"
    133           onmouseout="this.className='buttonclass';"
     217        <td  style="vertical-align: middle;border-style: none;">
     218        <div class="buttons"
     219          onmouseover="this.className='buttons_hover';"
     220          onmouseout="this.className='buttons';"
    134221          onclick="browseOnClick()">
    135         <div class="buttonclass_inner">
     222        <div class="buttons_inner">
    136223
    137224        <table class="noBorder" cellspacing="0" cellpadding="0">
    138225          <tr class="noBorder">
    139             <td>&nbsp;&nbsp;<img src="/base/images/browse.png" border="0"></td>
    140             <td>Browse&hellip;</td>
     226            <td style="border-style: none;">&nbsp;&nbsp;<img src="/base/images/browse.png" border="0"></td>
     227            <td style="border-style: none;">Browse&hellip;</td>
    141228          </tr>
    142229        </table>
     
    154241  </tr>
    155242
    156 
    157 
    158243</table>
    159244
    160245<p>
    161 <table class="noBorder" width="100%">
    162 <tr class="noBorder" ><td class="centered">
    163 <input type="submit"  value="Run Import"/>
    164 </td>
    165 </tr>
    166 </table>
    167 
    168 
     246
     247  <table align="center" class="noBorder" cellspacing="5"  cellpadding="5">
     248  <tr class="noBorder">
     249    <td id="next" width="50%" style="border-style: none;"><div class="buttons" onmouseover="this.className='buttons_hover';" onmouseout="this.className='buttons';" onclick="submit()"><div class="buttons_inner"><table  class="noBorder" cellspacing="0" cellpadding="0"><tr  class="noBorder"><td style="border-style: none;"><img src="/base/images/gonext.gif" border="0"></td><td style="border-style: none;">Next</td></tr></table></div></div></td>
     250    <td id="close" width="50%" style="border-style: none;"><div class="buttons" onmouseover="this.className='buttons_hover';" onmouseout="this.className='buttons';" onclick="window.close()"><div class="buttons_inner"><table  class="noBorder" cellspacing="0" cellpadding="0"><tr  class="noBorder"><td style="border-style: none;"><img src="/base/images/cancel.gif" border="0"></td><td style="border-style: none;">Cancel</td></tr></table></div></div></td>  </tr>
     251  </table>
     252
     253
     254</form>
    169255
    170256</body>
  • branches/uk_ac_ebi_Tab2MageImporter/html/spreadSheetData.html

    r540 r550  
    77<body>
    88
    9 <h1>Tab2MAGE Import Wizard -- Enter Spreadsheet Data for Mappings</h1>
     9<h2>Tab2MAGE Import Wizard -- Enter Spreadsheet Data for Mappings</h2>
    1010
    1111<form name="spreadSheetMappings" action="">
  • branches/uk_ac_ebi_Tab2MageImporter/html/userchoice1.html

    r540 r550  
    1212<body>
    1313
    14 <h1>Tab2MAGE Importer -- Choose Import Mode</h1>
     14<h2>Tab2MAGE Importer -- Choose Import Mode</h2>
    1515<p>
    1616
  • branches/uk_ac_ebi_Tab2MageImporter/html/userchoice2.html

    r540 r550  
    1010
    1111
    12 <h1>Tab2MAGE Import Wizard -- Choose Data Mode</h1>
     12<h2>Tab2MAGE Import Wizard -- Choose Data Mode</h2>
    1313<p>
    1414
  • branches/uk_ac_ebi_Tab2MageImporter/html/userchoice3.html

    r540 r550  
    99<body>
    1010
    11 <h1>Tab2MAGE Import Wizard -- Choose Mappings Mode</h1>
     11<h2>Tab2MAGE Import Wizard -- Choose Mappings Mode</h2>
    1212<p>
    1313
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/autogenerate.jsp

    r548 r550  
    6767<body>
    6868
    69 <h1>Tab2MAGE Import Wizard -- Additional Information for Autogenerate Mode</h1>
     69<h2>Tab2MAGE Import Wizard -- Additional Information for Autogenerate Mode</h2>
    7070<p>
    7171<form name="autogenerate" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/submit.jsp?ID=<%=ID%>">
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/configureImporter.jsp

    r548 r550  
    144144<input type="hidden"name="parameter:subjectList" value="<%=inputDataBean.getSubjectList()%>" />
    145145<input type="hidden"name="parameter:tissueList" value="<%=inputDataBean.getTissueList()%>" />
     146<input type="hidden"name="parameter:combinationList" value=""/>
    146147<input type="hidden"name="parameter:useWizard" value="<%=inputDataBean.getUseWizard()%>" />
    147148<input type="hidden"name="parameter:legacyData" value="<%=inputDataBean.getLegacyData()%>" />
     
    153154<input type="hidden"name="parameter:proceed" value="<%= inputDataBean.getProceed()%>"/>
    154155
    155 <input type="hidden"name="parameter:fileList" value=""/>
    156 <input type="hidden"name="parameter:subjectList" value=""/>
    157 <input type="hidden"name="parameter:tissueList" value=""/>
    158 <input type="hidden"name="parameter:combinationList" value=""/>
    159 
    160 
    161 
    162 <h1>Tab2MAGE Import Wizard -- Select Your Data File</h1>
     156
     157
     158
     159
     160<h2>Tab2MAGE Import Wizard -- Select Your Data File</h2>
    163161
    164162<p>
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/experiment.jsp

    r548 r550  
    3434
    3535<script>
    36 self.resizeTo(800,1100);
     36self.resizeTo(800,900);
    3737</script>
    3838
     
    123123 
    124124
    125 <h1>Tab2MAGE Import Wizard -- Your Experiment</h1>
     125<h2>Tab2MAGE Import Wizard -- Your Experiment</h2>
    126126<p>
    127127
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp

    r548 r550  
    7373      frm.recentFile.selectedIndex = 0;
    7474    }
     75   
     76    function hideTwoChannelQuestions()
     77    {
     78      var dyeSwapRow = document.getElementById('dyeSwapRow');
     79      var refSampleRow = document.getElementById('refSampleRow');
     80      var poolingRow = document.getElementById('poolingRow');
     81
     82            //items are currently displayed, so hide them
     83          dyeSwapRow.style.display = "none";
     84          refSampleRow.style.display = "none";
     85          poolingRow.style.display = "none";
     86    }
     87   
     88    function showTwoChannelQuestions()
     89    {
     90      var dyeSwapRow = document.getElementById('dyeSwapRow');
     91      var refSampleRow = document.getElementById('refSampleRow');
     92      var poolingRow = document.getElementById('poolingRow');
     93
     94           //items are currently hidden, so display them
     95          dyeSwapRow.style.display = "table-row";
     96          refSampleRow.style.display = "table-row";
     97          poolingRow.style.display = "table-row";
     98    }
     99   
     100    function checkRefSampleLogic()
     101    {
     102        if(document.getElementById("dyeSwapYes").checked && document.getElementById("refSampleYes").checked)
     103        {
     104          alert('Reference Sample and Dye Swap cannot both be set to "yes"');
     105        }
     106    }
    75107
    76108   
     
    93125<input type="hidden" name="zipFile" value="/home/michab/potato_small.zip"  id="zipFile">
    94126
    95 <h1>Tab2MAGE Import Wizard -- Your Hybridizations</h1>
     127<h2>Tab2MAGE Import Wizard -- Your Hybridizations</h2>
    96128
    97129<p>
     
    99131<table cellpadding="15">
    100132
    101   <!-- question 1 -->
     133  <!-- platform -->
    102134  <tr >
    103135    <td class="boldText">Microarray platform:</td>
    104136    <td class="input">
    105137    <select name="platform">
    106     <option >Affymetrix</option>
    107     <option >Agilent</option>
    108     <option >AIDA</option>
    109     <option >BZScan</option>
    110     <option >ChipSkipper</option>
    111     <option selected="selected">GenePix</option>
    112     <option >GeneTAC</option>
    113     <option >Illumina</option>
    114     <option >Imagene</option>
    115     <option >QuantArray Biotin</option>
    116     <option >QuantArray Cy</option>
    117     <option >Spotfinder</option>
    118     <option ><i>Custom</i></option>
     138    <option onclick="hideTwoChannelQuestions();" selected="selected" >Affymetrix</option>
     139    <option onclick="showTwoChannelQuestions();">Agilent</option>
     140    <option onclick="showTwoChannelQuestions();">AIDA</option>
     141    <option onclick="showTwoChannelQuestions();">BZScan</option>
     142    <option onclick="showTwoChannelQuestions();">ChipSkipper</option>
     143    <option onclick="showTwoChannelQuestions();">GenePix</option>
     144    <option onclick="showTwoChannelQuestions();">GeneTAC</option>
     145    <option onclick="showTwoChannelQuestions();">Illumina</option>
     146    <option onclick="showTwoChannelQuestions();">Imagene</option>
     147    <option onclick="showTwoChannelQuestions();">QuantArray Biotin</option>
     148    <option onclick="showTwoChannelQuestions();">QuantArray Cy</option>
     149    <option onclick="showTwoChannelQuestions();">Spotfinder</option>
     150    <option onclick="showTwoChannelQuestions();"><i>Custom</i></option>
    119151    </select></td>
    120152    <td>The manufacturer of the microarray chip used.</td>
    121153  </tr>
    122154
    123   <!-- question 2 -->
     155  <!-- organism -->
    124156  <tr>
    125157    <td class="boldText">Experimental organism:</td>
     
    128160  </tr>
    129161
    130   <!-- question 3 -->
     162  <!-- num array designs -->
    131163  <tr>
    132164    <td class="boldText">Number of different arrays designs used:</td>
     
    136168  </tr>
    137169
    138   <!-- question 4 -->
    139   <tr>
    140     <td class="boldText">Dye-swap</td>
    141     <td class="input">
    142     <table class="noBorder" cellpadding="4">
    143       <tr>
    144         <td class="noBorder"><input type="radio" name="dyeSwap" value="yes"></td>
    145         <td class="noBorder">yes</td>
    146       </tr>
    147 
    148       <tr>
    149         <td class="noBorder"><input type="radio" name="dyeSwap" value="no" checked="checked"></td>
    150         <td class="noBorder">no</td>
    151       </tr>
    152     </table>     
    153     </td>
    154     <td>If you used a dye-swap design please indicate this here.</td>
    155   </tr>
    156 
    157   <!-- question 5 -->
    158   <tr>
    159     <td class="boldText">Reference sample</td>
    160     <td class="input"> 
    161     <table class="noBorder" cellpadding="4">
    162       <tr>
    163         <td class="noBorder"><input type="radio" name="refSample" value="yes"></td>
    164         <td class="noBorder">yes</td>
    165       </tr>
    166 
    167       <tr>
    168         <td class="noBorder"><input type="radio"name="refSample" value="no"  checked="checked"></td>
    169         <td class="noBorder">no</td>
    170       </tr>
    171     </table>       
    172     </td>
    173     <td>If you used a reference sample please indicate this here.</td>
    174   </tr>
    175 
    176   <!-- question 6 -->
     170
     171  <!-- num treatment grps -->
    177172  <tr>
    178173    <td class="boldText">Number of treatment groups:</td>
     
    183178  </tr>
    184179
    185   <!-- question 7 -->
     180  <!-- exp factors -->
    186181  <tr>
    187182    <td class="boldText">Experimental factors:
     
    193188    <p>Example: <i><br>
    194189    Compound(aspirin,ibuprofen) <br>
    195     Dose(control,low,medium,high)</i></td>
    196   </tr>
    197 
    198   <!-- question 8 -->
     190    Dose(control,low,medium,high) <br>
     191    Time(1h,4h,12h,24h)</i>
     192    <p>
     193    <b>IMPORTANT: If your experimental design includes a time series of any sort, the corresponding factor must be called "Time".</b></td>
     194  </tr>
     195
     196  <!-- num subjects -->
    199197  <tr>
    200198    <td class="boldText">Number of subjects per group:</td>
     
    203201  </tr>
    204202 
    205   <!-- question 8a -->
     203  <!-- subject labels -->
    206204  <tr>
    207205    <td class="boldText">Subject (replicate) labels:</td>
     
    211209  </tr>
    212210 
    213   <!-- question 9 -->
     211  <!-- tissues -->
    214212  <tr>
    215213    <td class="boldText">Target tissues:</td>
     
    217215    <td>List all target tissues one per line, in no particular order (copy and paste from Excel works).</td>
    218216  </tr>
     217
     218
     219  <!-- dye swap -->
     220  <tr id="dyeSwapRow"  style="display:none">
     221    <td class="boldText">Dye-swap</td>
     222    <td class="input">
     223    <table class="noBorder" cellpadding="4">
     224      <tr>
     225        <td class="noBorder"><input type="radio" name="dyeSwap" id="dyeSwapYes" value="yes" onchange="checkRefSampleLogic();"/></td>
     226        <td class="noBorder">yes</td>
     227      </tr>
     228
     229      <tr>
     230        <td class="noBorder"><input type="radio" name="dyeSwap" id="dyeSwapNo" value="no" checked="checked"  onchange="checkRefSampleLogic();"/></td>
     231        <td class="noBorder">no</td>
     232      </tr>
     233    </table>     
     234    </td>
     235    <td>If you used a dye-swap design please indicate this here.</td>
     236  </tr>
     237
     238  <!-- ref sample -->
     239  <tr id="refSampleRow"  style="display:none">
     240    <td class="boldText">Reference sample</td>
     241    <td class="input"> 
     242    <table class="noBorder" cellpadding="4">
     243      <tr>
     244        <td class="noBorder"><input type="radio" name="refSample" id="refSampleYes" value="yes"  onchange="checkRefSampleLogic();"/></td>
     245        <td class="noBorder">yes</td>
     246      </tr>
     247
     248      <tr>
     249        <td class="noBorder"><input type="radio"name="refSample" id="refSampleNo" value="no"  checked="checked"  onchange="checkRefSampleLogic();"/></td>
     250        <td class="noBorder">no</td>
     251      </tr>
     252    </table>       
     253    </td>
     254    <td>If you used a reference sample please indicate this here.</td>
     255  </tr>
    219256 
    220   <!-- question 10 -->
    221   <tr>
     257  <!-- pooling -->
     258  <tr id="poolingRow"  style="display:none">
    222259    <td class="boldText">Sample pooling:</td>
    223260    <td class="input">
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/mappings.jsp

    r548 r550  
    1515  final String ID = sc.getId();
    1616  final String requestId = request.getParameter("requestId");
    17 
    1817%>
    1918
     
    7372      tissueList += frm.elements[i].value + '\t';
    7473    }
     74    if(id.match("dyeInput"))
     75    {
     76      dyeList += frm.elements[i].value + '\t';
     77    }
    7578    if(id.match("combinationInput"))
    7679    {
     
    8184  frm.subjectList.value = subjectList;
    8285  frm.tissueList.value = tissueList;
     86  frm.dyeList.value = dyeList;
    8387  frm.combinationList.value = combinationList;
    8488}
     
    101105<input type="hidden" id="subjectList" name="subjectList" value""/>
    102106<input type="hidden" id="tissueList" name="tissueList" value""/>
     107<input type="hidden" id="dyeList" name="dyeList" value""/>
    103108<input type="hidden" id="combinationList" name="combinationList" value""/>
    104109
     
    120125    //extract the possible values from between the parentheses
    121126    String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(") + 1,
    122         rawFactors[i].indexOf(")"));
     127    rawFactors[i].indexOf(")"));
    123128    String[] values = allValues.split(",");
    124129    factorValues[i] = values;
     
    171176  {
    172177    singleChannel = true;
    173   } 
     178  }
    174179  int numReplicates = Integer.parseInt(inputDataBean.getNumReplicates());
    175180  int numTreatmentGroups = Integer.parseInt(inputDataBean.getNumTreatmentGroups());
    176181  int numTissues = inputDataBean.getTissues().split("\n").length;
    177   int numHybs = Tab2MageWriter.calcNumHybs(singleChannel,numReplicates, numTreatmentGroups, numTissues);
     182  boolean dyeSwapBool = false;
     183  boolean poolingBool = false;
     184  if(inputDataBean.getDyeSwap().equals("yes"))
     185  {
     186    dyeSwapBool = true;
     187  }
     188  if(inputDataBean.getPooling().equals("yes"))
     189  {
     190    poolingBool = true;
     191  }
     192   
     193  int numHybs = Tab2MageUtils.calcNumHybs(dyeSwapBool,poolingBool,Integer.parseInt(inputDataBean.getNumDesigns()), numReplicates, numTreatmentGroups,numTissues);
     194
    178195  System.out.println("numHybs = " + numHybs);
    179196  System.out.println("products.length = " + products.length);
    180197%>
    181198
    182 <h1>Tab2MAGE Import Wizard -- File Mappings</h1>
     199<h2>Tab2MAGE Import Wizard -- File Mappings</h2>
    183200<p>
    184201
     
    198215    <td class="header"><h3>Subject</h3></td>
    199216    <td class="header"><h3>Tissue</h3></td>
     217    <td class="header"><h3>Dye</h3></td>
    200218    <td class="header"><h3>Factor Value Combination</h3></td>
    201219
     
    205223
    206224  <%
    207     for (int i = 0; i < numHybs; i++)
    208     {
     225      for (int i = 0; i < numHybs; i++)
     226      {
    209227  %>
    210228
     
    215233    <td class="input" ><select id="fileInput<%=i %>">
    216234      <%
    217           for (int k = 0; k < fileNamesArr.length; k++)
    218           {
     235            for (int k = 0; k < fileNamesArr.length; k++)
     236            {
    219237      %>
    220238
     
    230248    <td class="input" ><select id="subjectInput<%=i %>">
    231249      <%
    232           for (int k = 0; k < subjectNames.length; k++)
    233           {
     250            for (int k = 0; k < subjectNames.length; k++)
     251            {
    234252      %>
    235253
     
    245263    <td class="input" ><select id="tissueInput<%=i %>">
    246264      <%
    247           for (int k = 0; k < tissueNames.length; k++)
    248           {
     265            for (int k = 0; k < tissueNames.length; k++)
     266            {
    249267      %>
    250268
     
    256274    </select></td>
    257275
    258 <!-- need a single cell with a select box that lets the user select from a list of unique factor value combinations -->
     276    <!-- select your dye here-->
     277
     278    <td class="input"><select id="dyeInput<%=i %>">
     279      <%
     280            if (!singleChannel)
     281            {
     282      %>
     283      <option>Cy3</option>
     284      <option>Cy5</option>
     285      <%
     286            }
     287            else
     288            {
     289      %>
     290      <option>biotin</option>
     291      <%
     292      }
     293      %>
     294
     295    </select></td>
     296
     297    <!-- need a single cell with a select box that lets the user select from a list of unique factor value combinations -->
    259298
    260299    <td>
    261300    <select id="combinationInput<%=i %>">
    262301      <%
    263           for (int k = 0; k < products.length; k++)
     302            for (int k = 0; k < products.length; k++)
     303            {
     304          //make a String with all the factor values in this combination
     305          //separate values in each combi with a space
     306          String combi = "";
     307          for (int j = 0; j < products[k].length; j++)
    264308          {
    265             //make a String with all the factor values in this combination
    266             //separate values in each combi with a space
    267             String combi = "";
    268             for (int j = 0; j < products[k].length; j++)
    269             {
    270               combi += products[k][j] + " ";
    271             }
     309            combi += products[k][j] + " ";
     310          }
    272311      %>
    273312
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/protocols.jsp

    r547 r550  
    122122<input type="hidden"name="requestId" value="<%=requestId%>">
    123123
    124 <h1>Tab2MAGE Import Wizard -- Your Protocols</h1>
     124<h2>Tab2MAGE Import Wizard -- Your Protocols</h2>
    125125<p>
    126126<table cellpadding="10">
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/spreadsheetdata.jsp

    r547 r550  
    3535<body>
    3636
    37 <h1>Tab2MAGE Import Wizard -- Enter Spreadsheet Data for Mappings</h1>
     37<h2>Tab2MAGE Import Wizard -- Enter Spreadsheet Data for Mappings</h2>
    3838
    3939<form name="spreadSheetMappingsForm" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/submit.jsp?ID=<%=ID%>" method="post">
     
    5151<li>Columns must be in the order as below and the column headers must be exactly as follows (please replace 'myFactorName1' etc. with your actual factor names):<p>
    5252<b>
    53 File&nbsp;&nbsp;&nbsp;Subject&nbsp;&nbsp;&nbsp;Tissue&nbsp;&nbsp;&nbsp;FactorValue[myFactorName1]&nbsp;&nbsp;&nbsp;FactorValue[myFactorName2]&nbsp;&nbsp;&nbsp;etc....
     53File&nbsp;&nbsp;&nbsp;Subject&nbsp;&nbsp;&nbsp;Tissue&nbsp;&nbsp;&nbsp;Dye&nbsp;&nbsp;&nbsp;FactorValue[myFactorName1]&nbsp;&nbsp;&nbsp;FactorValue[myFactorName2]&nbsp;&nbsp;&nbsp;etc....
    5454</b></p>
    5555</ul>
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/submit.jsp

    r548 r550  
    3131<body>
    3232
    33 <h1>Tab2MAGE Import Wizard -- Summary</h1>
     33<h2>Tab2MAGE Import Wizard -- Summary</h2>
    3434<p>
    3535
     
    145145<input type="hidden"name="parameter:subjectList" value="<%=inputDataBean.getSubjectList()%>" />
    146146<input type="hidden"name="parameter:tissueList" value="<%=inputDataBean.getTissueList()%>" />
     147<input type="hidden"name="parameter:dyeList" value="<%=inputDataBean.getDyeList()%>"/>
     148<input type="hidden"name="parameter:combinationList" value=""/>
    147149<input type="hidden"name="parameter:useWizard" value="<%=inputDataBean.getUseWizard()%>" />
    148150<input type="hidden"name="parameter:legacyData" value="<%=inputDataBean.getLegacyData()%>" />
     
    154156<input type="hidden"name="parameter:proceed" value="<%= inputDataBean.getProceed()%>"/>
    155157
    156 <input type="hidden"name="parameter:fileList" value=""/>
    157 <input type="hidden"name="parameter:subjectList" value=""/>
    158 <input type="hidden"name="parameter:tissueList" value=""/>
    159 <input type="hidden"name="parameter:combinationList" value=""/>
    160158
    161159
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/userchoice1.jsp

    r545 r550  
    5050<body>
    5151
    52 <h1>Tab2MAGE Importer -- Choose Import Mode</h1>
     52<h2>Tab2MAGE Importer -- Choose Import Mode</h2>
    5353<p>
    5454
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/userchoice2.jsp

    r548 r550  
    4141  if(document.getElementById("legacyDataNo").checked)
    4242  {
    43     form.action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/autogenerate.jsp?ID=<%=ID%>";
     43    var platform = '<%=inputDataBean.getPlatform()%>';
     44    var refSample = '<%=inputDataBean.getRefSample()%>';
     45    //two channel experiment without reference sample -- we need more info first, go to autogenerate.jsp
     46    if((platform != 'Affymetrix') && refSample == 'no')
     47    {
     48      form.action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/autogenerate.jsp?ID=<%=ID%>";
     49    }
     50    //single channel experiments and two channel experiment with reference sample - no extra info needed, proceed straight to submit page
     51    else
     52    {
     53      form.action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/submit.jsp?ID=<%=ID%>";
     54    }
    4455  }
     56 
    4557
    4658  //submit the form
     
    5365<body>
    5466
    55 <h1>Tab2MAGE Import Wizard -- Choose Data Mode</h1>
     67<h2>Tab2MAGE Import Wizard -- Choose Data Mode</h2>
    5668<p>
    5769
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/userchoice3.jsp

    r543 r550  
    4949<body>
    5050
    51 <h1>Tab2MAGE Import Wizard -- Choose Mappings Mode</h1>
     51<h2>Tab2MAGE Import Wizard -- Choose Mappings Mode</h2>
    5252<p>
    5353
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/DataBean.java

    r548 r550  
    5050  public String subjectList;
    5151  public String tissueList;
     52  public String dyeList;
    5253  public String combinationList;
    5354  public String useWizard;
     
    512513    this.timePoints = timePoints;
    513514  }
     515
     516  public String getDyeList()
     517  {
     518    return dyeList;
     519  }
     520
     521  public void setDyeList(String dyeList)
     522  {
     523    this.dyeList = dyeList;
     524  }
    514525 
    515526 
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java

    r548 r550  
    9898    "hybridizationProtocolParams","scanningProtocolParams","platform","organism",
    9999    "numDesigns","dyeSwap","refSample","numTreatmentGroups","expFactors","numReplicates",
    100     "tissues","pooling","path", "subjectNames", "fileList", "subjectList", "tissueList","combinationList", "useWizard",
     100    "tissues","pooling","path", "subjectNames", "fileList", "subjectList", "tissueList","dyeList", "combinationList", "useWizard",
    101101    "legacyData","mappingsMode","spreadSheetMappings","samplePairing","timeCourse","timePoints","proceed"};
    102102
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java

    r548 r550  
    55import java.io.Writer;
    66import java.lang.reflect.Field;
    7 import java.util.Arrays;
    8 import java.util.HashMap;
    9 import java.util.Iterator;
    10 import java.util.LinkedList;
    11 import java.util.List;
    12 import java.util.Map;
    137
    148import net.sf.basedb.core.DbControl;
     
    2721  ParameterValues job;
    2822  boolean singleChannel = false;
    29  
     23  int numHybs = 0;
     24  int numFactors = 0;
     25
    3026  String[] paramNames;
    3127  String[] factorNames;
     
    3329  String [] subjectNames;
    3430  String [] tissueNames;
     31  String [] dyeNames;
    3532  String [][] combinations;
    3633
     
    7875  public String subjectList;
    7976  public String tissueList;
     77  public String dyeList;
    8078  public String combinationList;
    8179  public String useWizard;
     
    103101  public Tab2MageWriter()
    104102  {
    105 
     103    initForTesting();
    106104  }
    107105
     
    110108  // sets all the values of the local variables to those found in the job
    111109  // object
    112   private void initJobParamValues()
     110  public void initJobParamValues()
    113111  {
    114112    try
     
    121119        {
    122120          field.set(this, job.getValue(paramNames[i]));
     121          if(job.getValue(paramNames[i]) == null)
     122          {
     123            field.set(this, "");
     124          }
    123125        }
    124126        catch (IllegalArgumentException e)
     
    126128        }
    127129      }
    128 
    129       //work out whether this is a single or dual channel experiment
    130       if (platform.equalsIgnoreCase("affymetrix"))
    131       {
    132         singleChannel = true;
    133       }
    134       //this extracts the individual factor names from the String that comes from the web page
    135       extractFactorNames();
    136       //now extract the factor values and store them suitably so we can access them
    137       makeFactorValueCombinations();
    138 
    139130    }
    140131    catch (Exception e)
     
    144135  }
    145136
    146 
    147   // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    148 
    149   public void makeFactorValueCombinations()
     137  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     138
     139  public void initForTesting()
     140  {
     141
     142    try
     143    {
     144      Class cls = Class.forName("uk.ac.ebi.nugo.plugins.Tab2MageWriter");
     145      Field [] fields = cls.getDeclaredFields();
     146      for (int i = 0; i < fields.length; i++)
     147      {
     148        try
     149        {
     150          fields[i].set(this, "");
     151        }
     152        catch (IllegalArgumentException e)
     153        {
     154        }
     155      }
     156    }
     157    catch (Exception e)
     158    {
     159      e.printStackTrace();
     160    }
     161
     162  }
     163
     164
     165  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     166
     167  //work out how many hybridizations we have in this experiment
     168  private void calcNumHybs()
     169  {
     170    //first work out how many hybs we are supposed to have
     171    boolean dyeSwapBool = false;
     172    boolean poolingBool = false;
     173    if(dyeSwap.equals("yes"))
     174    {
     175      dyeSwapBool = true;
     176    }
     177    if(pooling.equals("yes"))
     178    {
     179      poolingBool = true;
     180    }
     181    numHybs = Tab2MageUtils.calcNumHybs(dyeSwapBool,poolingBool, Integer.parseInt(numDesigns), Integer.parseInt(numReplicates), Integer.parseInt(numTreatmentGroups), tissues.split("\n").length);
     182  }
     183
     184
     185  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     186
     187  public String[][] makeFactorValueCombinations()
     188  {
     189    String[] rawFactors = expFactors.split("\n");
     190
     191    String[][] factorValues = new String[rawFactors.length][];
     192    factorNames = new String[rawFactors.length];
     193    numFactors = factorNames.length;
     194
     195    for (int i = 0; i < rawFactors.length; i++)
     196    {
     197      //extract the factor name
     198      String factorName = rawFactors[i].substring(0, rawFactors[i].indexOf("("));
     199      factorNames[i] = factorName;
     200      //extract the possible values from between the parentheses
     201      String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(") + 1,
     202      rawFactors[i].indexOf(")"));
     203      String[] values = allValues.split(",");
     204      factorValues[i] = values;
     205    }
     206
     207    //here we get hold of the cartesian product of all the factor values
     208    return CartesianProduct.getCartesianProduct(factorValues); 
     209  }
     210 
     211  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     212 
     213  private void initArrays()
    150214  {
    151215    //if the mappings were manually selected by the user, do this
     
    160224      subjectNames = subjectList.split("\t");
    161225      tissueNames = tissueList.split("\t");
     226      dyeNames = dyeList.split("\t");
    162227
    163228      //parse the list of factor value combinations and put it into a 2d array
     
    170235      }
    171236    }
    172    
     237
    173238    //if the mappings were copied and pasted from a spreadsheet we need to parse them into arrays to match the ones above
    174     else
     239    if(mappingsMode.equals("copyPaste"))
    175240    {
    176241      String [] entriesWithHeader = spreadSheetMappings.split("\n");
    177      
     242
    178243      //need to remove the header row - this akward with arrays but we need to use arrays here
    179244      String [] entries = new String [entriesWithHeader.length -1];
     
    182247        entries[i] = entriesWithHeader[i+1];
    183248      }
    184    
    185       String [] headerNames = entries[0].split("\t");
    186       int numFactors = headerNames.length - 3;
    187      
     249
    188250      //init the arrays
    189251      fileNames = new String [entries.length];
    190252      subjectNames = new String [entries.length];
    191253      tissueNames = new String [entries.length];
     254      dyeNames = new String [entries.length];
    192255      combinations = new String [entries.length][];
    193      
     256
    194257      //now populate the 2d array of factor value combinations as above
    195258      for (int i = 0; i < entries.length; i++)
     
    199262        subjectNames[i] = row[1];
    200263        tissueNames[i] = row[2];
     264        dyeNames[i] = row[3];
    201265        String [] combi = new String [numFactors];
    202266        for (int j = 0; j < combi.length; j++)
    203267        {
    204           combi[j] = row[j+3];
     268          combi[j] = row[j+4];
    205269        }
    206270        combinations[i] = combi;       
    207271      }
    208272    }
    209   }
    210 
    211   // ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
    212  
    213   public void extractFactorNames()
    214   {
    215     //get the factor names
    216     String[] rawFactors = expFactors.split("\n");
    217     factorNames = new String[rawFactors.length];
    218     for (int i = 0; i < factorNames.length; i++)
    219     {
    220       //extract the factor name
    221       String factorName = rawFactors[i].substring(0, rawFactors[i].indexOf("("));
    222       factorNames[i] = factorName;
    223       System.out.println("factorName = " + factorName);
    224     }
    225   }
     273
     274    //if the user chose new data rather than legacy data in the UI then we want to autogenerate the entire hybs section for them
     275    if(legacyData.equals("no"))
     276    {
     277      //get all possible factor value combinations
     278      String[][] cartesianProduct = makeFactorValueCombinations();
     279     
     280      //init the arrays needed here
     281      fileNames = new String [numHybs];
     282      subjectNames = new String [numHybs];
     283      tissueNames = new String [numHybs];
     284      dyeNames = new String [numHybs];
     285      combinations = new String [numHybs][];
     286     
     287      if(singleChannel)
     288      {
     289        int numSubjects = Integer.parseInt(numReplicates);
     290        String[] allTissues = tissues.split(",");
     291        int numGroups = Integer.parseInt(numTreatmentGroups);
     292        int numArrayDesigns = Integer.parseInt(numDesigns);
     293
     294        /* if no pooling, iterate through
     295        Number of ArrayDesigns
     296        Number of Study Groups
     297        Number of Subject per Study group
     298        Number of tissues per Subject
     299         */
     300        if(pooling.equals("no"))
     301        {
     302          int hybCount =0;
     303          // for each treatment group i.e. factor value combination
     304          for (int i = 0; i < numGroups; i++)
     305          {
     306            // for each subject within each group i.e. biological replicate within each factor value combination
     307            for (int j = 0; j < numSubjects; j++)
     308            {
     309              // for each target tissue for this subject
     310              for (int k = 0; k < allTissues.length; k++)
     311              {
     312                //init file names
     313                fileNames[hybCount] = "file" + hybCount;
     314                //init subject names
     315                subjectNames[hybCount] = "subject" + hybCount;
     316                //init dye names
     317                dyeNames[hybCount] = "biotin";
     318                //init tissue names
     319                tissueNames[hybCount] = allTissues[k];
     320                //init factor value combinations
     321                for(int n=0; n< numFactors; n++)
     322                {
     323                  combinations[hybCount] = new String[numFactors];
     324                  combinations[hybCount][n] =cartesianProduct[i][n];
     325                }
     326                hybCount++;
     327              }
     328            }
     329          }
     330        }
     331        /* if pooling, iterate through
     332        Number of ArrayDesigns
     333        Number of Study Groups
     334        Number of tissues per Subject
     335         */
     336        else
     337        {
     338         
     339        }
     340      }
     341
     342    }
     343  }
     344
     345
    226346
    227347
     
    303423  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    304424
    305   private void makeHybridizationsSection()
    306   {
     425  public String makeHybridizationsSection()
     426  {
     427    //work out the number of hybridizations
     428    calcNumHybs();
     429
     430    //work out whether this is a single or dual channel experiment
     431    if (platform.equalsIgnoreCase("affymetrix"))
     432    {
     433      singleChannel = true;
     434    }
     435
     436    //initialize the arrays we need
     437    initArrays();
     438
     439    String hybSection = "";
     440
    307441    // header for this section
    308     t2mContent += "Hybridization section\n";
     442    hybSection += "Hybridization section\n";
    309443
    310444    // print column headers for the section
     
    312446                                     { "File[raw]", "Array[accession]", "BioSource", "BioMaterialCharacteristics[Organism]",
    313447            "BioMaterialCharacteristics[OrganismPart]",
    314             "BioMaterialCharacteristics[CellType]", "Sample", "Protocol[grow]",
     448            "Sample", "Protocol[grow]",
    315449            "Extract", "Protocol[extraction]", "LabeledExtract",
    316450            "Protocol[labeling]", "Dye", "Hybridization",
     
    318452    for (int i = 0; i < colHeaders.length; i++)
    319453    {
    320       t2mContent += colHeaders[i] + "\t";
     454      hybSection += colHeaders[i] + "\t";
    321455    }
    322456
     
    324458    for (int i = 0; i < factorNames.length; i++)
    325459    {
    326       t2mContent += "FactorValue["+factorNames[i] + "]\t";
     460      hybSection += "FactorValue["+factorNames[i] + "]\t";
    327461    }
    328462
    329463    //next line will be data
    330     t2mContent += "\n";
    331 
    332 
    333     //the number of times we have to print the block of data below
    334     //with dual channel platforms we have to print each block (row) twice
    335     int numPrintRepeats = 2;
    336     if (singleChannel)
    337     {     
    338       numPrintRepeats = 1;
    339     }
    340 
    341     //we need a single record for each tissue in each subject here
    342     int count = 1;
    343     int numSubjects = Integer.parseInt(numReplicates);
    344     String[] allTissues = tissues.split(",");
    345     int numTissues = allTissues.length;
    346     int numGroups = Integer.parseInt(numTreatmentGroups);
    347 
    348     // for each treatment group i.e. factor value combination
    349     for (int i = 1; i <= numGroups; i++)
    350     {
    351       System.out.println("i=" +i);
    352       System.out.println("count = " + count);
    353       int subjectCount = 0;
    354       // for each subject within each group i.e. biological replicate within each factor value combination
    355       for (int j = 1; j <= numSubjects; j++)
    356       {
    357         subjectCount = (i - 1) * numSubjects + j;
    358         System.out.println("subjectCount = "+ subjectCount);
    359         // for each target tissue for this subject
    360         for (int k = 1; k <= numTissues; k++)
    361         {
    362           for(int r = 1; r<= numPrintRepeats; r++)
    363           {         
    364             String subjectName = subjectNames[count-1];
    365             System.out.println("subjectName = "+ subjectName);
    366 
    367             // file count first
    368             t2mContent += fileNames[count-1] + "\t" +
    369 
    370             // accession no. i.e the array
    371             // design
    372             accession + "\t" +
    373 
    374             // bio source
    375             subjectName + "\t" +
    376 
    377             // BioMaterialCharacteristics[Organism]
    378             organism + "\t" +
    379 
    380             // BioMaterialCharacteristics[OrganismPart]
    381             tissueNames[count-1] + "\t" +
    382 
    383             // BioMaterialCharacteristics[CellType]
    384             "" + "\t" +
    385 
    386             // sample
    387             subjectName + ".sample-" + k + "\t" +
    388 
    389             // Protocol[grow]
    390             "P-DIET-1" + "\t" +
    391 
    392             // Extract
    393             subjectName + ".sample-" + k + "-extract" + "\t" +
    394 
    395             // Protocol[extraction]
    396             "P-EXTR-1" + "\t" +
    397 
    398             // LabeledExtract
    399             subjectName + ".sample-" + k + "-extract-le" + "\t" +
    400 
    401             // Protocol[labeling]
    402             "P-LABL-1" + "\t" ;
    403 
    404             // Dye
    405             //depends on platform and repeat no.
    406             if(singleChannel)
    407             {
    408               t2mContent +="biotin" + "\t";
    409             }
    410             if(!singleChannel && r==1)
    411             {
    412               t2mContent +="Cy3" + "\t";
    413             }
    414             if(!singleChannel && r==2)
    415             {
    416               t2mContent +="Cy5" + "\t";
    417             }
    418 
    419             // Hybridization
    420             t2mContent += "hybridization-" + count + "\t" +
    421 
    422             // Protocol[hybridization]
    423             "P-HYBR-1" + "\t" +
    424 
    425             // Scan
    426             "scan-" + count + "\t" +
    427 
    428             // Protocol[scanning]
    429             "P-SCAN-1" + "\t";
    430 
    431             //now print all the factor values
    432             // FactorValue[Treatment Type]
    433             //"trt_group" + i + "\t";
    434             //System.out.println("cartesianProduct[0].length = " + cartesianProduct[0].length);
    435             for(int n=0; n< combinations[0].length; n++)
    436             {
    437               //System.out.println("n = "+ n);
    438               t2mContent +=combinations[i-1][n]+ "\t";
    439             }
    440 
    441             // new line
    442             t2mContent += "\n";
    443 
    444             //in two channel experiments increment the count only if this was the second printed block of data
    445             if((singleChannel==false && r == 2) || singleChannel == true)
    446             {
    447               System.out.println("incrementing count");
    448               count++;
    449             }           
    450           }
    451         }
    452       }
    453     }
    454   }
     464    hybSection += "\n";
     465
     466
     467    //also need to figure if we are to autogenerate labels or use those supplied by the user
     468    if(legacyData.equals("no"))
     469    {
     470      //autogenerate the contents of the hybs section
     471      HybridizationEntry hyb = new HybridizationEntry( true, singleChannel,  fileNames, subjectNames, tissueNames,dyeNames,combinations, accession, organism);
     472      for (int i = 0; i < numHybs; i++)
     473      {
     474        hybSection += hyb.makeRow(i);
     475      }
     476    }
     477    //otherwise use the data from the mappings we have obtained
     478    else
     479    {
     480      HybridizationEntry hyb = new HybridizationEntry( false, singleChannel,  fileNames, subjectNames, tissueNames,dyeNames,combinations, accession, organism);
     481      for (int i = 0; i < numHybs; i++)
     482      {
     483        hybSection += hyb.makeRow(i);
     484      }
     485    }
     486
     487    //append the hybs section to the general content
     488    t2mContent += hybSection;
     489    return hybSection;
     490  }
     491
    455492
    456493  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    522559  }
    523560
    524   // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    525 
    526   public static int calcNumHybs(boolean dyeSwap, boolean pooling, int numDesigns, int numReplicates, int numTreatmentGroups, int numTissues)
    527   {
    528     int numHybs = 0;
    529 
    530     /*
    531     Basic assumption:
    532       no pooling, one source ->one sample->one extract->one labeled extract->one hyb
    533       Number of hybridizations (NH) = Number of subjects (NS) x Number of Target Tissue (NTT) x Number of Study groups (NSG)
    534      */
    535     numHybs = numReplicates * numTissues * numTreatmentGroups;
    536 
    537     //a number of conditions can then modify the basic number of hybs:
    538 
    539     //dye swap results in twice the number of hybs
    540     //NHdye-swap=2 x NH
    541     if(dyeSwap)
    542     {     
    543       numHybs = numHybs *2;
    544     }
    545    
    546     //if several array designs are used all hybs must be applied to each of them
    547     //NHmultiple designs=Nad x NH
    548     if(numDesigns > 1)
    549     {
    550       numHybs = numHybs * numDesigns;
    551     }
    552    
    553     //pooling reduces the number of hybs as the biological replication gets cancelled out
    554     //NH(if pooling)= NH/Number of subjects (NS)
    555     if(pooling)
    556     {
    557       numHybs = numHybs/numReplicates;
    558     }
    559 
    560 
    561 
    562     return numHybs;
    563   }
    564561
    565562  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriterTest.java

    r547 r550  
    77import java.io.Writer;
    88
    9 public class Tab2MageWriterTest
     9import junit.framework.TestCase;
     10
     11public class Tab2MageWriterTest  //extends TestCase
    1012{
    1113
    12  
     14
    1315  public static void main(String [] args)
    1416  {
    15     try
    16     {
    17       //get the tab2mage output gerenated by the writer
    18       Tab2MageWriter writer = new Tab2MageWriter();
    19      
    20       //set parameters for testing
    21       writer.experimentId = "2";
    22       writer.domain = "scri.ac.uk";
    23       writer.accession = "E-SCRI-001";
    24       writer.qualityControl = "biological replicate,spike quality control";
    25       writer.experimentalDesign = "cell_component_comparison_design,RNA_stability_design,family_history_design,";
    26       writer.experimentName = "New experiment";
    27       writer.description = "description goes here";
    28       writer.releaseDate = "2007-12-03";
    29       writer.submissionDate = "2007-12-03";
    30       writer.submitter = "Joe Bloggs";
    31       writer.organization = "SCRI";
    32       writer.publicationTitle = "My Ropey Paper";
    33       writer.authors = "Bloggs, Joe";
    34       writer.journal = "The Journal of Irreproducible Results";
    35       writer.volume = "5";
    36       writer.issue = "2";
    37       writer.pages = "1234-1235";
    38       writer.year = "2007";
    39       writer.pubmedId = "11009762";
     17    //org.junit.runner.JUnitCore.main("uk.ac.ebi.nugo.plugins.Tab2MageWriterTest");
     18    //test0();
     19    //test1();
     20    test2();
     21  }
    4022
    41       // protocols
    42       writer.treatmentProtocol = "my treatment protocol text";
    43       writer.extractionProtocol = " my extraction protocol text";
    44       writer.labelingProtocol = " my labeling protocol text";
    45       writer.hybridizationProtocol = "my hybs protocol text";
    46       writer.scanningProtocol = " my scanning protocol text";
    47       writer.treatmentProtocolParams = "param1";
    48       writer.extractionProtocolParams = "param2";
    49       writer.labelingProtocolParams = "param3";
    50       writer.hybridizationProtocolParams = "param4";
    51       writer.scanningProtocolParams = " param5";
     23  //----------------------------------------------------------------------------------------------------------------------
    5224
    53       // hybs
    54       writer.platform = "Affymetrix";
    55       writer.organism = "Solanum tuberosum";
    56       writer.numDesigns = "1";
    57       writer.dyeSwap = "no";
    58       writer.refSample = "yes";
    59       writer.numTreatmentGroups = "4";
    60       writer.expFactors = "Strain(mutant,wildtype)\nTreatment(treated,control)";
    61       writer.numReplicates = "2";
    62       writer.tissues = "whole_organism";
    63       writer.pooling = "no";
    64       writer.path = "/home/michab/gen2.zip";
    65       writer.fileList ="file1\tfile2\tfile3\tfile4\tfile5\tfile6\tfile7\tfile8";
    66       writer.subjectList = "subject1\tsubject2\tsubject3\tsubject4\tsubject5\tsubject6\tsubject7\tsubject8";
    67       writer.tissueList = "whole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism";
    68       writer.combinationList = "mutant treated\twildtype treated\tmutant control\twildtype control\tmutant treated\twildtype treated\tmutant control\twildtype control";
    69       //writer.mappingsMode = "manualSelect";
    70       writer.mappingsMode = "copyPaste";
    71       writer.spreadSheetMappings = "File\tSample\tTissue\tFactorValue[Strain]\tFactorValue(Treatment)\nfile1\tsubject1\twhole_plant\tmutant\ttreated\nfile2\tsubject2\twhole_plant\twildtype\ttreated\nfile3\tsubject3\twhole_plant\tmutant\tcontrol\nfile4\tsubject4\twhole_plant\twildtype\tcontrol\nfile5\tsubject5\twhole_plant\tmutant\ttreated\nfile6\tsubject6\twhole_plant\twildtype\ttreated\nfile7\tsubject7\twhole_plant\tmutant\tcontrol\nfile8\tsubject8\twhole_plant\twildtype\tcontrol";
    72      
    73       writer.extractFactorNames();
    74       writer.makeFactorValueCombinations();
    75      
    76       String t2mContent = writer.generateFileContents();
    77       System.out.println("t2mContent = \n\n" + t2mContent);
    78      
    79       //write this to file
    80       File file = new File("c:\\tmp\\testTab2Mage.txt");
    81       Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
    82       out.write(t2mContent);
    83       out.close();
    84     }
    85     catch (Exception e)
    86     {
    87       e.printStackTrace();
    88     }
     25  public static void test0()
     26  {
     27    //here we simulate data coming from the web UI with mappings provided from a spreadsheet
     28    Tab2MageWriter writer = new Tab2MageWriter();
     29
     30    System.out.println("======================START TEST0============================");
     31
     32    writer.legacyData = "yes";
     33    writer.platform = "Affymetrix";
     34    writer.organism = "Solanum tuberosum";
     35    writer.numDesigns = "1";
     36    writer.dyeSwap = "no";
     37    writer.refSample = "yes";
     38    writer.numTreatmentGroups = "4";
     39    writer.expFactors = "Strain(mutant,wildtype)\nTreatment(treated,control)";
     40    writer.numReplicates = "2";
     41    writer.tissues = "whole_organism";
     42    writer.pooling = "no";
     43    writer.path = "/home/michab/gen2.zip";
     44    writer.fileList ="file1\tfile2\tfile3\tfile4\tfile5\tfile6\tfile7\tfile8";
     45    writer.subjectList = "subject1\tsubject2\tsubject3\tsubject4\tsubject5\tsubject6\tsubject7\tsubject8";
     46    writer.tissueList = "whole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism";
     47    writer.combinationList = "mutant treated\twildtype treated\tmutant control\twildtype control\tmutant treated\twildtype treated\tmutant control\twildtype control";
     48    writer.mappingsMode = "copyPaste";
     49    writer.spreadSheetMappings = "File\tSample\tTissue\tDye\tFactorValue[Strain]\tFactorValue(Treatment)\nfile1\tsubject1\twhole_plant\tbiotin\tmutant\ttreated\nfile2\tsubject2\twhole_plant\tbiotin\twildtype\ttreated\nfile3\tsubject3\twhole_plant\tbiotin\tmutant\tcontrol\nfile4\tsubject4\twhole_plant\tbiotin\twildtype\tcontrol\nfile5\tsubject5\twhole_plant\tbiotin\tmutant\ttreated\nfile6\tsubject6\twhole_plant\tbiotin\twildtype\ttreated\nfile7\tsubject7\twhole_plant\tbiotin\tmutant\tcontrol\nfile8\tsubject8\twhole_plant\tbiotin\twildtype\tcontrol";
     50
     51    String hybSection = writer.makeHybridizationsSection();
     52    System.out.println("hybs section = \n\n" + hybSection);
     53    System.out.println("======================END TEST0======================");
     54
    8955  }
     56
     57//  ----------------------------------------------------------------------------------------------------------------------
    9058 
    91  
    92 }
     59  public static void test1()
     60  {
     61    //here we simulate data coming from the web UI with mappings provided from a spreadsheet
     62    Tab2MageWriter writer = new Tab2MageWriter();
     63
     64    System.out.println("======================START TEST1============================");
     65
     66    writer.legacyData = "yes";
     67    writer.platform = "Affymetrix";
     68    writer.organism = "Solanum tuberosum";
     69    writer.numDesigns = "1";
     70    writer.dyeSwap = "no";
     71    writer.refSample = "yes";
     72    writer.numTreatmentGroups = "4";
     73    writer.expFactors = "Strain(mutant,wildtype)\nTreatment(treated,control)";
     74    writer.numReplicates = "2";
     75    writer.tissues = "whole_organism";
     76    writer.pooling = "no";
     77    writer.path = "/home/michab/gen2.zip";
     78    writer.fileList ="file1\tfile2\tfile3\tfile4\tfile5\tfile6\tfile7\tfile8";
     79    writer.subjectList = "subject1\tsubject2\tsubject3\tsubject4\tsubject5\tsubject6\tsubject7\tsubject8";
     80    writer.tissueList = "whole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism\twhole_organism";
     81    writer.combinationList = "mutant treated\twildtype treated\tmutant control\twildtype control\tmutant treated\twildtype treated\tmutant control\twildtype control";
     82    writer.dyeList = "biotin\tbiotin\tbiotin\tbiotin\tbiotin\tbiotin\tbiotin\tbiotin\t";
     83    writer.mappingsMode = "manualSelect";
     84
     85    String hybSection = writer.makeHybridizationsSection();
     86    System.out.println("hybs section = \n\n" + hybSection);
     87    System.out.println("======================END TEST1======================");
     88
     89  }
     90
     91//  ----------------------------------------------------------------------------------------------------------------------
     92
     93  //affy simple design, 1 factor, 6 files only
     94  //auto generate required
     95  public static void test2()
     96  {
     97
     98    /*
     99    platform  = Affymetrix
     100    number of array designs = 1
     101    dyeswap yes/no = not applicable
     102    refSample yes/no = no
     103    number of treatment groups = 2
     104    experimental factors list = genotype (wild type;PGC-1 beta transgenic)
     105    number of replicates within groups = 3
     106    list of tissues used = skeletal muscle (1)
     107    pooling yes/no = no
     108    Total number of Hybs/datafiles = 6
     109     */
     110
     111    Tab2MageWriter writer = new Tab2MageWriter();
     112
     113    System.out.println("======================START TEST2============================");
     114    writer.legacyData = "no";
     115    writer.platform = "Affymetrix";
     116    writer.organism = "Solanum tuberosum";
     117    writer.accession = "E-MEXP-939";
     118    writer.numDesigns = "1";
     119    writer.dyeSwap = "no";
     120    writer.refSample = "no";
     121    writer.numTreatmentGroups = "2";
     122    writer.expFactors = "Genotype(wild type,PGC-1 beta transgenic)\n";
     123    writer.numReplicates = "3";
     124    writer.tissues = "skeletal_muscle";
     125    writer.pooling = "no";
     126
     127    String hybSection = writer.makeHybridizationsSection();
     128    System.out.println("hybs section = \n\n" + hybSection);
     129    System.out.println("======================END TEST2======================");
     130  }
     131
     132//  ----------------------------------------------------------------------------------------------------------------------
     133
     134
     135}//end class
Note: See TracChangeset for help on using the changeset viewer.