Changeset 1745


Ignore:
Timestamp:
Nov 27, 2012, 1:06:55 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #425: Generate a lab protocol for RNA -> cDNA processing

Two variants of the protocol can be created. One with a list layout and aone with a plate layout.

Location:
extensions/net.sf.basedb.reggie/branches/ticket-422
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/ticket-422/.classpath

    r1606 r1745  
    99  <classpathentry kind="lib" path="lib/compile/base-webclient-3.1.0.jar"/>
    1010  <classpathentry kind="lib" path="lib/compile/base-webservices-client-3.1.0.jar"/>
    11   <classpathentry kind="output" path="build"/>
     11  <classpathentry kind="output" path=".build"/>
    1212</classpath>
  • extensions/net.sf.basedb.reggie/branches/ticket-422/resources/index.jsp

    r1742 r1745  
    289289            <ul>
    290290            <li><a href="libprep/select_rna.jsp?ID=<%=ID%>">Create new mRNA plate</a>
    291             <li><a href="?ID=<%=ID%>">Lab tracking protocol for mRNA and cDNA preparation</a>
     291            <li><a href="libprep/mrna_protocol.jsp?ID=<%=ID%>">Lab tracking protocol for mRNA and cDNA preparation</a>
    292292            <li><a href="?ID=<%=ID%>">Export files for mRNA quality control</a>
    293293            <li><a href="?ID=<%=ID%>">Import mRNA quality control results</a>
  • extensions/net.sf.basedb.reggie/branches/ticket-422/src/net/sf/basedb/reggie/dao/Rna.java

    r1742 r1745  
    6969  }
    7070 
     71  public static Rna get(Extract extract)
     72  {
     73    return new Rna(extract);
     74  }
    7175 
    7276  public static List<Rna> toRna(Collection<Extract> extracts)
  • extensions/net.sf.basedb.reggie/branches/ticket-422/src/net/sf/basedb/reggie/servlet/MRnaServlet.java

    r1742 r1745  
    22
    33import java.io.IOException;
    4 import java.io.Writer;
    5 import java.util.Date;
    64import java.util.HashMap;
    75import java.util.List;
     
    1715import org.json.simple.parser.JSONParser;
    1816
    19 import net.sf.basedb.core.AnnotationType;
    2017import net.sf.basedb.core.Application;
    2118import net.sf.basedb.core.BioMaterialEventSource;
     
    2825import net.sf.basedb.core.DbControl;
    2926import net.sf.basedb.core.Extract;
    30 import net.sf.basedb.core.File;
    3127import net.sf.basedb.core.Include;
    32 import net.sf.basedb.core.ItemNotFoundException;
    3328import net.sf.basedb.core.ItemQuery;
    3429import net.sf.basedb.core.ItemSubtype;
    35 import net.sf.basedb.core.Path;
    3630import net.sf.basedb.core.PlateGeometry;
    37 import net.sf.basedb.core.PluginConfiguration;
    38 import net.sf.basedb.core.PluginDefinition;
    39 import net.sf.basedb.core.Protocol;
    4031import net.sf.basedb.core.SessionControl;
    4132import net.sf.basedb.core.Type;
    42 import net.sf.basedb.core.plugin.ParameterValues;
    4333import net.sf.basedb.core.query.Expressions;
    4434import net.sf.basedb.core.query.Hql;
     
    4838import net.sf.basedb.reggie.dao.Annotationtype;
    4939import net.sf.basedb.reggie.dao.BioplateType;
    50 import net.sf.basedb.reggie.dao.ReactionPlate;
     40import net.sf.basedb.reggie.dao.MRna;
    5141import net.sf.basedb.reggie.dao.Rna;
    5242import net.sf.basedb.reggie.dao.Subtype;
    53 import net.sf.basedb.reggie.plugins.CaliperPlateImporter;
    54 import net.sf.basedb.reggie.plugins.CaliperRunParametersExporter;
    55 import net.sf.basedb.reggie.plugins.CaliperSampleNameExporter;
    56 import net.sf.basedb.util.Coordinate;
    5743import net.sf.basedb.util.Values;
    5844import net.sf.basedb.util.error.ThrowableUtil;
     
    8167    JSONObject json = new JSONObject();
    8268    json.put("status", "ok");
    83  
     69   
    8470    final SessionControl sc = Application.getSessionControl(ID, req.getRemoteAddr());
    8571    DbControl dc = null;
     
    9581        json.put("name", bioPlateType.generateNextName(dc, 1));
    9682      }
     83      else if ("GetUnprocessedMRnaPlates".equals(cmd))
     84      {
     85        dc = sc.newDbControl();
     86       
     87        ItemQuery<BioPlate> query = BioPlate.getQuery();
     88        query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     89        query.restrict(Restrictions.eq(Hql.property("eventDate"), null));
     90        BioplateType.MRNA.addFilter(dc, query, true);
     91        query.order(Orders.desc(Hql.property("id")));
     92       
     93        List<BioPlate> result = query.list(dc);
     94        JSONArray jsonLists = new JSONArray();
     95        for (BioPlate plate: result)
     96        {
     97          JSONObject jsonList = new JSONObject();
     98         
     99          jsonList.put("id", plate.getId());
     100          jsonList.put("name", plate.getName());
     101         
     102          jsonLists.add(jsonList);
     103        }
     104        json.put("bioplates", jsonLists);
     105      }
     106      else if ("GetMRnaInfoForPlate".equals(cmd))
     107      {
     108        int mRnaPlateId = Values.getInt(req.getParameter("bioplate"));
     109        dc = sc.newDbControl();
     110
     111        BioPlate mRnaPlate = BioPlate.getById(dc, mRnaPlateId);
     112
     113        ItemQuery<Extract> query = Extract.getQuery();
     114        query.join(Hql.innerJoin(null, "bioWell", "bw", true));
     115        query.join(Hql.innerJoin("bw", "bioPlate", "bp"));
     116        query.restrict(Restrictions.eq(Hql.alias("bp"), Hql.entity(mRnaPlate)));
     117        query.order(Orders.asc(Hql.property("bw", "column")));
     118        query.order(Orders.asc(Hql.property("bw", "row")));
     119
     120        List<MRna> mrna = MRna.toList(query.list(dc));
     121        JSONArray jsonMRna = new JSONArray();
     122       
     123        for (MRna r : mrna)
     124        {
     125          r.loadBioPlateLocation();
     126         
     127          Rna rna = r.getRna();
     128          rna.loadBioPlateLocation();
     129          rna.loadAnnotations(dc, "NDConc", Annotationtype.ND_CONC, null);
     130         
     131          Float used = r.getItem().getCreationEvent().getUsedQuantity(rna.getItem());
     132          Float remain = rna.getItem().getRemainingQuantity();
     133          rna.setAnnotation("usedQuantity", used);
     134          if (used != null && remain != null)
     135          {
     136            rna.setAnnotation("remainingQuantity", remain+used);
     137          }
     138         
     139          r.setAnnotation("rna", rna.asJSONObject());
     140          jsonMRna.add(r.asJSONObject());
     141         
     142        }
     143               
     144        json.put("mrna", jsonMRna);
     145      }
     146
    97147     
    98148    }
Note: See TracChangeset for help on using the changeset viewer.