Changeset 530


Ignore:
Timestamp:
Jan 10, 2008, 1:44:06 PM (13 years ago)
Author:
mbayer
Message:

file mappings now filter through into tab2mage file but still have to implement two channel arrays

Location:
branches/uk_ac_ebi_Tab2MageImporter
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/experiment.jsp

    r529 r530  
    44<%@ page import="java.util.*"%>
    55
    6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application"/>
     6<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session"/>
    77<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    88<jsp:setProperty name="inputDataBean" property="*"/>
     
    1111final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    1212final String ID = sc.getId();
    13 final String requestID = request.getParameter("requestID");
     13final String requestId = request.getParameter("requestId");
    1414
    1515//we also need to figure out the name/id of the currently selected experiment that this import is getting initiated from
     
    130130<form name="experimentData" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/protocols.jsp" method="post">
    131131<input type="hidden" name="ID" value="<%=ID%>">
    132 <input type="hidden"name="requestID" value="<%=requestID%>">
     132<input type="hidden"name="requestId" value="<%=requestId%>">
    133133
    134134<table cellpadding="0" cellspacing="0">
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/hybridizations.jsp

    r529 r530  
    44<%@ page import="java.util.*"%>
    55
    6 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" />
     6<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
    77<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    88<jsp:setProperty name="inputDataBean" property="*" />
     
    1111final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    1212final String ID = sc.getId();
    13 final String requestID = request.getParameter("requestID");
     13final String requestId = request.getParameter("requestId");
    1414 %>
    1515
     
    8787<form name="hybridizations"action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/mappings.jsp" method="post">
    8888<input type="hidden" name="ID" value="<%=ID%>"> <input type="hidden" name="cmd" value="SetParameters">
    89 <input type="hidden"name="requestID" value="<%=requestID%>">
     89<input type="hidden"name="requestId" value="<%=requestId%>">
    9090
    9191<input type="hidden" name="file_id" value="">
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/mappings.jsp

    r529 r530  
    77<%@ page import="uk.ac.ebi.nugo.plugins.*"%>
    88
    9 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" />
     9<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
    1010<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    1111<jsp:setProperty name="inputDataBean" property="*" />
     
    1414  final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    1515  final String ID = sc.getId();
    16   final String requestID = request.getParameter("requestID");
     16  final String requestId = request.getParameter("requestId");
    1717%>
    1818
     
    3131function submit()
    3232{
     33  gatherValues();
     34  document.mappings.submit();
     35}
     36
     37
     38function getRoot()
     39{
     40  return '/base/';
     41}
     42
     43function getScale()
     44{
     45  return 1.0;
     46}
     47
     48
     49//collects all the values from the file selector boxes and strings them together so they can be
     50//passed on as a single parameter for plugin configuration
     51function gatherValues()
     52{
     53  var fileString = '';
    3354  var frm = document.forms['mappings'];
    34   frm.submit();
    35 }
    36 
    37 
    38 function getRoot()
    39 {
    40   return '/base/';
    41 }
    42 
    43 function getScale()
    44 {
    45   return 1.0;
    46 }
     55  var numElements = frm.elements.length;
     56  //document.write(numElements);
     57  //document.write("<br />");
     58  for(var i = 0; i < numElements; i++)
     59  {
     60    var value = frm.elements[i].value;
     61    var id = frm.elements[i].id;
     62
     63    if(id.match("fileinput"))
     64    {
     65      //document.write("id = " + id);
     66      //document.write("<br />");
     67      //document.write("value = " + value);
     68      //document.write("<br />");
     69      fileString += frm.elements[i].value + '\t';
     70    }
     71  }
     72  //document.write('combined output = ' + fileString);
     73  frm.fileStringParam.value = fileString;
     74  //document.write('value of hidden input = ' + frm.fileStringParam.value);
     75}
     76
    4777</script>
    4878
     
    5787<input type="hidden" name="ID" value="<%=ID%>">
    5888<input type="hidden" name="cmd" value="SetParameters">
    59 <input type="hidden" name="requestID" value="<%=requestID%>">
    60 <input type="hidden" id="fileStringParam" name="param:fileStringParam" value""/>
     89<input type="hidden" name="requestId" value="<%=requestId%>">
     90<input type="hidden" id="fileStringParam" name="parameter:fileStringParam" value""/>
    6191
    6292<!-- these are the parameters from the previous input pages; need to pick them up individually from the bean here; ugly as hell but can't be done any other way -->
     
    249279</form>
    250280
    251 <script language="JavaScript" type="text/javascript">
    252 //collects all the values from the file selector boxes and strings them together so they can be
    253 //passed on as a single parameter for plugin configuration
    254 {
    255   var fileString = '';
    256   var frm = document.forms['mappings'];
    257   var numElements = frm.elements.length;
    258   document.write(numElements);
    259   document.write("<br />");
    260   for(var i = 0; i < numElements; i++)
    261   {
    262     var value = frm.elements[i].value;
    263     var id = frm.elements[i].id;
    264 
    265     if(id.match("fileinput"))
    266     {
    267       document.write("id = " + id);
    268       document.write("<br />");
    269       document.write("value = " + value);
    270       document.write("<br />");
    271       fileString += frm.elements[i].value + '\t';
    272     }
    273   }
    274   document.write('combined output = ' + fileString);
    275   frm.fileStringParam.value = fileString;
    276   document.write('value of hidden input = ' + frm.fileStringParam.value);
    277 }
    278 </script>
     281
    279282
    280283</body>
  • branches/uk_ac_ebi_Tab2MageImporter/jsp/uk/ac/ebi/nugo/plugins/protocols.jsp

    r529 r530  
    55<%@ page import="java.lang.*"%>
    66
    7 <jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="application" />
     7<jsp:useBean id="inputDataBean" class="uk.ac.ebi.nugo.plugins.DataBean" scope="session" />
    88<!-- submits the form data back to the bean assuming that each form element is matched to a variable in the bean by the same name -->
    99<jsp:setProperty name="inputDataBean" property="*" />
     
    3434final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
    3535final String ID = sc.getId();
    36 final String requestID = request.getParameter("requestID");
     36final String requestId = request.getParameter("requestId");
    3737
    3838
     
    120120<form name="protocols" action="<%= request.getContextPath()%>/plugins/uk/ac/ebi/nugo/plugins/hybridizations.jsp" method="post">
    121121<input type="hidden" name="ID" value="<%=ID%>">
    122 <input type="hidden"name="requestID" value="<%=requestID%>">
     122<input type="hidden"name="requestId" value="<%=requestId%>">
    123123
    124124<h1>Tab2MAGE Importer -- Your Protocols</h1>
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageImporter.java

    r529 r530  
    156156    System.out.println(" configure request = "  +request + ", command = " + request.getCommand());
    157157
     158   
    158159    try
    159160    {
     
    180181        //set the response as done
    181182        //response.setDone("Job configuration complete", Job.ExecutionTime.SHORT);
    182 
     183       
     184       
    183185        //print out current values
    184186        System.out.println("=================================================================");
     
    191193        }
    192194        System.out.println("=================================================================");
    193       }
    194     }
    195     catch (Exception ex)
     195
     196      }
     197    }
     198    catch (Throwable ex)
    196199    {
    197200      System.out.println("exception in configure method");
     
    257260      requestInformation = new RequestInformation(Request.COMMAND_CONFIGURE_JOB, null, null, params, "experiment.jsp");
    258261    }
    259     catch (Exception e)
     262    catch (Throwable e)
    260263    {
    261264      e.printStackTrace();
  • branches/uk_ac_ebi_Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/Tab2MageWriter.java

    r526 r530  
    2525  ParameterValues job;
    2626  String[] paramNames;
    27   HashMap<String,LinkedList> factors;
     27
     28  String[][] cartesianProduct;
     29  String[] factorNames;
     30  String [] fileNames;
    2831 
    2932  String domain;
     
    6770  String zipFile;
    6871  String experimentId;
     72  String fileStringParam;
     73 
    6974
    7075  // ===================================================c'tor================================================
     
    101106     
    102107      //now extract the factor values and store them suitably so we can access them
    103       extractFactorValues();
     108      makeFactorValueCombinations();
    104109    }
    105110    catch (Exception e)
     
    110115 
    111116  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    112   //extracts the factor names and their list of possible values from the single string that we obtain from the web page
    113   public void extractFactorValues()
    114   {
    115     factors = new HashMap<String,LinkedList>();
    116117   
    117     String [] rawFactors = expFactors.split("\n");
     118  private void makeFactorValueCombinations()
     119  {
     120    //first extract the factor names and the possible values
     121    String[] rawFactors = expFactors.split("\n");
     122
     123    String[][] factorValues = new String[rawFactors.length][];
     124    factorNames = new String[rawFactors.length];
     125
    118126    for (int i = 0; i < rawFactors.length; i++)
    119127    {
    120128      //extract the factor name
    121129      String factorName = rawFactors[i].substring(0, rawFactors[i].indexOf("("));
     130      factorNames[i] = factorName;
    122131      //extract the possible values from between the parentheses
    123       String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(")+1,rawFactors[i].length()-1);
    124       String [] values = allValues.split(",");
    125       System.out.println("factorName = " + factorName);
    126       System.out.println("allValues = "+ allValues);
    127       //add them to a linkedlist object
    128       LinkedList<String> valueList = new LinkedList<String>();
    129       for (int j = 0; j < values.length; j++)
     132      String allValues = rawFactors[i].substring(rawFactors[i].indexOf("(") + 1,
     133              rawFactors[i].indexOf(")"));
     134      String[] values = allValues.split(",");
     135      factorValues[i] = values;
     136    }
     137
     138    //here we get hold of the cartesian product of all the factor values
     139    cartesianProduct = CartesianProduct.getCartesianProduct(factorValues);
     140    for (int i = 0; i < cartesianProduct.length; i++)
     141    {
     142      System.out.print("factor value combination: ");
     143      for (int j = 0; j < factorValues.length; j++)
    130144      {
    131         System.out.println("value: " + values[j]);
    132         valueList.add(values[j]);
    133        
     145        System.out.print(cartesianProduct[i][j] + "     ");
    134146      }
    135       //add this pair to the hashmap
    136       factors.put(factorName, valueList);
    137     }   
    138   }
     147      System.out.println();
     148    }
     149   
     150    //now we want the filenames in a separate array so we can add them to their appropriate combinations as selected
     151    //by the user in the UI
     152    //this requires us to parse out the file string (which had to be sent as a single parameter from the web page) and add the files to the
     153    //array in the order we find them in the string
     154    //they then match the order of the combinations in the cartesian product
     155    fileNames = fileStringParam.split("\t");
     156  }
     157 
    139158
    140159  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    227246            "Extract", "Protocol[extraction]", "LabeledExtract",
    228247            "Protocol[labeling]", "Dye", "Hybridization",
    229             "Protocol[hybridization]", "Scan", "Protocol[scanning]",
    230             "FactorValue[Treatment Type]" };
     248            "Protocol[hybridization]", "Scan", "Protocol[scanning]" };
    231249    for (int i = 0; i < colHeaders.length; i++)
    232250    {
    233251      t2mContent += colHeaders[i] + "\t";
    234252    }
     253   
    235254    //now print the factorvalue headers
    236     for (Iterator iter = factors.entrySet().iterator(); iter.hasNext();)
    237     {
    238       Map.Entry<String, LinkedList> entry = (Map.Entry<String, LinkedList>)iter.next();
    239       String factorName = entry.getKey();     
     255    for (int i = 0; i < factorNames.length; i++)
     256    {
     257      t2mContent += "FactorValue["+factorNames[i] + "]\t";
    240258    }
    241259   
     
    257275      for (int i = 1; i <= numGroups; i++)
    258276      {
     277        System.out.println("i=" +i);
    259278        int subjectCount = 0;
    260279        // for each subject within each group
     
    267286
    268287            // file count first
    269             t2mContent += "file" + count + ".CEL" + "\t" +
     288            t2mContent += fileNames[count-1] + "\t" +
    270289            // accession no. i.e the array
    271290            // design
     
    300319            "scan-" + count + "\t" +
    301320            // Protocol[scanning]
    302             "P-SCAN-1" + "\t" +
     321            "P-SCAN-1" + "\t";
     322           
     323            //now print all the factor values
    303324            // FactorValue[Treatment Type]
    304             "trt_group" + i + "\t";
     325            //"trt_group" + i + "\t";
     326            System.out.println("cartesianProduct[0].length = " + cartesianProduct[0].length);
     327            for(int n=0; n< cartesianProduct[0].length; n++)
     328            {
     329              System.out.println("count = " + count);
     330              System.out.println("n = "+ n);
     331              t2mContent +=cartesianProduct[i-1][n]+ "\t";
     332            }
    305333
    306334            // new line
     
    338366
    339367            // file count first
    340             t2mContent += "file" + count + ".gpr" + "\t" +
     368            t2mContent += fileNames[count-1] + "\t" +
    341369            // accession no. i.e the array
    342370            // design
     
    382410
    383411            // file count first
    384             t2mContent += "file" + count + ".gpr" + "\t" +
     412            t2mContent += fileNames[count-1] + "\t" +
    385413            // accession no. i.e the array
    386414            // design
     
    436464  public void writeTab2MageFile()
    437465  {
     466    DbControl dc = null;
    438467    try
    439468    {
    440469      // set up a file writer
    441       DbControl dc = sc.newDbControl();
     470      dc = sc.newDbControl();
    442471      net.sf.basedb.core.File t2mFile = net.sf.basedb.core.File.getNew(dc, dir);
    443472      System.out.println("dir for writing new tab2mage file = " + dir.getName());
     
    455484
    456485      dc.commit();
     486
     487    }
     488    catch (Exception e)
     489    {
     490      e.printStackTrace();
     491    }
     492    finally
     493    {
    457494      if (dc != null)
    458495        dc.close();
    459     }
    460     catch (Exception e)
    461     {
    462       e.printStackTrace();
    463496    }
    464497  }
     
    522555    experimentId = "2";
    523556    domain = "scri.ac.uk";
    524     accession = "Agilent1";
     557    accession = "Affymetrix1";
    525558    qualityControl = "biological replicate,spike quality control";
    526559    experimentalDesign = "cell_component_comparison_design,RNA_stability_design,family_history_design,";
     
    554587    // hybs
    555588    platform = "Affymetrix";
    556     organism = "Homo_sapiens";
     589    organism = "Solanum tuberosum";
    557590    numDesigns = "1";
    558591    dyeSwap = "no";
    559592    refSample = "yes";
    560     numTreatmentGroups = "6";
    561     expFactors = "compound(aspirin,ibuprofen)\ndose(none,medium,high)";
    562     numReplicates = "4";
    563     tissues = "liver,heart,brain";
     593    numTreatmentGroups = "4";
     594    expFactors = "Strain(mutant,wildtype)\nTreatment(treated,control)";
     595    numReplicates = "2";
     596    tissues = "stem";
    564597    pooling = "no";
    565598    zipFile = "/home/michab/potato_small.zip";
     599    fileStringParam = "file1.CEL\tfile2.CEL\tfile3.CEL\tfile4.CEL\tfile5.CEL\tfile6.CEL\tfile7.CEL\tfile8.CEL";
    566600   
    567     extractFactorValues();
    568 
     601   
     602    //now extract the factor values and store them suitably so we can access them
     603    makeFactorValueCombinations();
     604   
    569605  }
    570606  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.