Changeset 1543
- Timestamp:
- Feb 28, 2012, 2:43:36 PM (12 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 7 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/META-INF/servlets.xml
r1518 r1543 30 30 </servlet> 31 31 <servlet> 32 <servlet-name>RnaQc</servlet-name> 33 <servlet-class>net.sf.basedb.reggie.servlet.RnaQcServlet</servlet-class> 34 </servlet> 35 <servlet> 36 <servlet-name>Subtype</servlet-name> 37 <servlet-class>net.sf.basedb.reggie.servlet.SubtypeServlet</servlet-class> 38 </servlet> 39 <servlet> 32 40 <servlet-name>SampleReport</servlet-name> 33 41 <servlet-class>net.sf.basedb.reggie.servlet.SampleReportServlet</servlet-class> -
extensions/net.sf.basedb.reggie/trunk/resources/css/base30.css
r1538 r1543 39 39 } 40 40 41 .highlight:hover 42 { 43 background-color: #F8F8E8 !important; 44 border-top: 1px solid #2288AA !important; 45 border-bottom: 1px solid #2288AA !important; 46 } 47 48 .buttonclass.disabled, .buttonclass.disabled:hover 49 { 50 color: #666666; 51 background: #D0D0D0; 52 cursor: default; 53 } 54 55 .buttonclass.disabled img 56 { 57 filter: gray; /* IE */ 58 opacity: 0.5; 59 } 60 41 61 .content 42 62 { … … 57 77 overflow: auto; 58 78 } 79 80 -
extensions/net.sf.basedb.reggie/trunk/resources/css/reggie.css
r1538 r1543 90 90 .status.invalid:before 91 91 { 92 content: url('../ ../images/error.gif');92 content: url('../images/error.png'); 93 93 } 94 94 .status.warning:before 95 95 { 96 content: url('../ ../images/warning.gif');96 content: url('../images/warning.png'); 97 97 } 98 98 .status.valid:before 99 99 { 100 content: url('../ ../images/ok.gif');100 content: url('../images/ok.png'); 101 101 } 102 102 .success ul 103 103 { 104 list-style-image: url('../ ../images/ok.gif');104 list-style-image: url('../images/ok.png'); 105 105 } 106 106 -
extensions/net.sf.basedb.reggie/trunk/resources/index.jsp
r1538 r1543 224 224 </dd> 225 225 <% 226 } 226 } 227 if (hasCreateExtractPermission) 228 { 229 %> 230 <dt> 231 <base:icon image="<%=home+"/images/rnaqc.png" %>" /> 232 RNA quality control wizards 233 </dt> 234 <dd> 235 <ul> 236 <li><a href="rnaqc_aliquot.jsp?ID=<%=ID%>">Create aliquots on Bioanalyzer/Caliper plates</a> 237 <li><a href="rnaqc_plate_export.jsp?ID=<%=ID%>">Export Caliper plate information</a> 238 <li><a href="rnaqc_plate_import.jsp?ID=<%=ID%>">Import RQS scores from Caliper data file</a> 239 </ul> 240 </dd> 241 <% 242 } 227 243 %> 228 244 </dl> -
extensions/net.sf.basedb.reggie/trunk/resources/install.jsp
r1538 r1543 63 63 var numIncomplete = 0; 64 64 var checks = response.checks; 65 var tblHeader = '<tr><th class="itemTypeCol">Item type</th><th class="nameCol">Name</th><th class="iconCol"></th><th class="statusCol">Status</th></tr>'; 65 66 var html = '<table class="report">'; 66 html += '<tr><th id="itemTypeCol">Item type</th><th id="nameCol">Name</th><th id="iconCol"></th><th id="statusCol">Status</th></tr>';67 html += tblHeader; 67 68 var lastItemType = null; 68 69 for (var i = 0; i < checks.length; i++) … … 92 93 if (lastItemType != check.itemType) 93 94 { 94 html += '<tr class="newitemtype"><td>'+check.itemType+'</td>'; 95 if (check.itemType == 'ANNOTATIONTYPE') 96 { 97 // End the left side and start on the right 98 html += '</table>'; 99 setInnerHTML('validationResult', html); 100 html = '<table class="report">'; 101 html += tblHeader; 102 } 103 html += '<tr class="newitemtype highlight"><td>'+check.itemType+'</td>'; 95 104 } 96 105 else 97 106 { 98 html += '<tr class="sameitemtype "><td> </td>';107 html += '<tr class="sameitemtype highlight"><td> </td>'; 99 108 } 100 109 lastItemType = check.itemType; … … 125 134 } 126 135 html += '</table>'; 127 128 setInnerHTML('validationResult', html); 136 setInnerHTML('validationResult2', html); 129 137 130 138 if (numErrors > 0) … … 156 164 width: 100%; 157 165 table-layout: fixed; 158 } 159 160 .report #itemTypeCol 161 { 162 width: 18em; 163 } 164 165 .report #nameCol 166 border-collapse: collapse; 167 } 168 169 .report .itemTypeCol 170 { 171 width: 15em; 172 overflow: hidden; 173 text-overflow: ellipsis; 174 } 175 176 .report .nameCol 166 177 { 167 178 width: 20em; 168 } 169 .report #iconCol 179 overflow: hidden; 180 text-overflow: ellipsis; 181 } 182 .report .iconCol 170 183 { 171 184 width: 20px; 172 185 } 173 .report #statusCol186 .report .statusCol 174 187 {} 175 188 … … 188 201 } 189 202 190 .report .newitemtype td203 .report .newitemtype 191 204 { 192 205 border-top: 1px solid #A0A0A0; 193 206 } 194 .report .sameitemtype td207 .report .sameitemtype 195 208 { 196 209 border-top: 1px dotted #A0A0A0; 210 border-bottom: 1px dotted #A0A0A0; 197 211 } 198 212 </style> … … 207 221 <div class="content" style="padding-left: 2em;"> 208 222 209 <div id="validationResult" class="absolutefull fullborder" style="bottom: 10em; left: 1em; right: 1em; "> 210 Checking; please wait... 223 <div class="absolutefull" style="width: 50%; bottom: 10em;"> 224 <div id="validationResult" class="absolutefull fullborder" style="left: 1em; right: 0.5em; "> 225 Checking; please wait... 226 </div> 227 </div> 228 229 <div class="absolutefull" style="width: 50%; bottom: 10em; left: auto;"> 230 <div id="validationResult2" class="absolutefull fullborder" style="left: 0.5em; right: 1em; "> 231 </div> 211 232 </div> 212 233 -
extensions/net.sf.basedb.reggie/trunk/resources/reggie.js
r1532 r1543 270 270 } 271 271 } 272 273 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java
r1536 r1543 10 10 import net.sf.basedb.core.AnnotationType; 11 11 import net.sf.basedb.core.AnnotationTypeCategory; 12 import net.sf.basedb.core.BioPlateType; 12 13 import net.sf.basedb.core.DbControl; 13 14 import net.sf.basedb.core.Group; … … 24 25 import net.sf.basedb.reggie.converter.DateToStringConverter; 25 26 import net.sf.basedb.reggie.converter.StringToDateConverter; 27 import net.sf.basedb.reggie.dao.BioplateType; 26 28 import net.sf.basedb.reggie.dao.Subtype; 27 29 … … 206 208 public static final String ANNOTATION_BLOOD_SERUM = "BloodSerum"; 207 209 210 /** 211 The name of the "QCRunDate" annotation, used 212 for bioplates (RNA). It is a date annotation type. 213 @since 2.4 214 */ 215 public static final String ANNOTATION_QC_RUN_DATE = "QCRunDate"; 216 217 /** 218 The name of the "QCOperator" annotation, used 219 for bioplates (RNA). It is a string annotation type. 220 @since 2.4 221 */ 222 public static final String ANNOTATION_QC_OPERATOR = "QCOperator"; 223 208 224 /** 209 225 Default converter for date values to string values: yyyyMMdd … … 270 286 return s; 271 287 } 288 289 /** 290 List all bioplate types with given name. 291 @since 2.4 292 */ 293 public static List<BioPlateType> listBioPlateTypes(DbControl dc, BioplateType plateType) 294 { 295 ItemQuery<BioPlateType> query = BioPlateType.getQuery(); 296 query.restrict( 297 Restrictions.eq( 298 Hql.property("name"), 299 Expressions.parameter("name", plateType.getName(), Type.STRING) 300 )); 301 query.include(Include.ALL); 302 return query.list(dc); 303 } 304 305 /** 306 Find a single bioplate type with the given name. If exactly one is found it 307 is returned, otherwise null is returned or an exception is thrown 308 depending on the exceptionIfNotFound parameter. 309 @since 2.4 310 */ 311 public static BioPlateType findBioplateType(DbControl dc, BioplateType plateType, boolean exceptionIfNotFound) 312 { 313 ItemQuery<BioPlateType> query = BioPlateType.getQuery(); 314 query.restrict( 315 Restrictions.eq( 316 Hql.property("name"), 317 Expressions.parameter("name", plateType.getName(), Type.STRING) 318 )); 319 query.include(Include.ALL); 320 List<BioPlateType> result = listBioPlateTypes(dc, plateType); 321 BioPlateType s = null; 322 if (result.size() == 0) 323 { 324 if (exceptionIfNotFound) throw new ItemNotFoundException("BioPlateType["+plateType.getName()+"]"); 325 } 326 else if (result.size() > 1) 327 { 328 if (exceptionIfNotFound) throw new InvalidDataException("Found > 1 BioPlateType["+plateType.getName()+"]"); 329 } 330 else 331 { 332 s = result.get(0); 333 } 334 return s; 335 } 336 272 337 273 338 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Subtype.java
r1526 r1543 1 1 package net.sf.basedb.reggie.dao; 2 3 import org.json.simple.JSONObject; 2 4 3 5 import net.sf.basedb.core.DbControl; … … 8 10 import net.sf.basedb.core.query.Expressions; 9 11 import net.sf.basedb.core.query.Hql; 12 import net.sf.basedb.core.query.Restriction; 10 13 import net.sf.basedb.core.query.Restrictions; 11 14 import net.sf.basedb.reggie.Reggie; … … 69 72 public static final Subtype LYSATE = new Subtype("Lysate", Item.EXTRACT); 70 73 71 74 /** 75 The definition of the "DNA" extract subtype. 76 @since 2.4 77 */ 78 public static final Subtype DNA = new Subtype("DNA", Item.EXTRACT); 79 80 /** 81 The definition of the "RNA" extract subtype. 82 @since 2.4 83 */ 84 public static final Subtype RNA = new Subtype("RNA", Item.EXTRACT); 85 86 /** 87 The definition of the "RNA Quality control" extract subtype. 88 @since 2.4 89 */ 90 public static final Subtype RNAQC = new Subtype("RNAQC", Item.EXTRACT); 91 92 93 /** 94 The definition of the "Quality control" protocol subtype. 95 @since 2.4 96 */ 97 public static final Subtype QUALITY_CONTROL = new Subtype("Quality control", Item.PROTOCOL); 98 99 /** 100 Create a subtype representation of an ItemSubtype object. 101 @since 2.4 102 */ 103 public static final Subtype get(ItemSubtype subtype) 104 { 105 Subtype s = new Subtype(subtype.getName(), subtype.getMainItemType()); 106 s.id = subtype.getId(); 107 return s; 108 } 72 109 73 110 private final String name; 74 111 private final Item mainType; 75 112 private int id; 113 private JSONObject json; 76 114 77 115 /** … … 85 123 this.mainType = mainType; 86 124 } 87 125 88 126 /** 89 127 Get the name of the subtype. … … 100 138 { 101 139 return mainType; 140 } 141 142 /** 143 Get the subtype information as a JSON object ready to be sent as an AJAX response. 144 @since 2.4 145 */ 146 @SuppressWarnings("unchecked") 147 public JSONObject asJSONObject(DbControl dc) 148 { 149 if (json == null) 150 { 151 if (id==0) load(dc); // Ensure that the subtype has been loaded 152 json = new JSONObject(); 153 json.put("id", id); 154 json.put("name", getName()); 155 json.put("mainType", getMainType().name()); 156 } 157 return json; 102 158 } 103 159 … … 146 202 @since 2.1 147 203 */ 148 public void addFilter(DbControl dc, ItemQuery<? extends Subtypable> query, String alias) 204 public void addFilter(DbControl dc, ItemQuery<?> query, String alias) 205 { 206 query.restrict(restriction(dc, alias)); 207 } 208 209 public Restriction restriction(DbControl dc, String alias) 149 210 { 150 211 if (id==0) load(dc); // Ensure that the subtype has been loaded 151 query.restrict(Restrictions.eq(Hql.property(alias, "itemSubtype"), Expressions.integer(id)));152 } 153 212 return Restrictions.eq(Hql.property(alias, "itemSubtype.id"), Expressions.integer(id)); 213 } 214 154 215 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r1526 r1543 19 19 import net.sf.basedb.core.AnnotationTypeCategory; 20 20 import net.sf.basedb.core.Application; 21 import net.sf.basedb.core.BioPlateType; 21 22 import net.sf.basedb.core.DbControl; 22 23 import net.sf.basedb.core.Group; … … 32 33 import net.sf.basedb.core.Type; 33 34 import net.sf.basedb.reggie.Reggie; 35 import net.sf.basedb.reggie.dao.BioplateType; 34 36 import net.sf.basedb.reggie.dao.Subtype; 35 37 import net.sf.basedb.util.EqualsHelper; … … 106 108 jsonChecks.add(checkSubtype(dc, Subtype.HISTOLOGY, createIfMissing, Subtype.SPECIMEN)); 107 109 jsonChecks.add(checkSubtype(dc, Subtype.LYSATE, createIfMissing, Subtype.SPECIMEN)); 110 jsonChecks.add(checkSubtype(dc, Subtype.DNA, createIfMissing, Subtype.LYSATE)); 111 jsonChecks.add(checkSubtype(dc, Subtype.RNA, createIfMissing, Subtype.LYSATE)); 112 jsonChecks.add(checkSubtype(dc, Subtype.QUALITY_CONTROL, createIfMissing)); 113 jsonChecks.add(checkSubtype(dc, Subtype.RNAQC, createIfMissing, Subtype.RNA, Subtype.QUALITY_CONTROL)); 114 115 // Bioplate types 116 jsonChecks.add(checkBioplateType(dc, BioplateType.BA_RNAQC, createIfMissing)); 117 jsonChecks.add(checkBioplateType(dc, BioplateType.CALIPER_RNAQC, createIfMissing)); 108 118 109 119 // Annotation type checks … … 165 175 null, effectiveOptions, createIfMissing)); 166 176 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PARTITION_DATE, new Item[]{Item.SAMPLE, Item.EXTRACT}, Type.DATE, 1, 177 null, effectiveOptions, createIfMissing)); 178 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_QC_RUN_DATE, new Item[] { Item.BIOPLATE}, Type.DATE, 1, 179 null, effectiveOptions, createIfMissing)); 180 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_QC_OPERATOR, new Item[] { Item.BIOPLATE}, Type.STRING, 1, 167 181 null, effectiveOptions, createIfMissing)); 168 182 … … 192 206 Reggie.ANNOTATION_PARTITION_DATE)); 193 207 208 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.RNA, createIfMissing, 209 Reggie.ANNOTATION_QC_RUN_DATE, Reggie.ANNOTATION_QC_OPERATOR)); 210 211 212 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.DNA, createIfMissing)); 213 214 jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.RNAQC, createIfMissing)); 215 194 216 json.put("checks", jsonChecks); 195 217 } 196 197 218 } 198 219 catch (Throwable t) … … 722 743 } 723 744 745 /** 746 Create a bioplate type with the given options. The bioplate type is created in 747 a separate transaction. 748 @since 2.4 749 */ 750 public BioPlateType createBioPlateType(SessionControl sc, BioplateType def) 751 { 752 BioPlateType plateType = null; 753 DbControl dc = sc.newDbControl(); 754 try 755 { 756 plateType = BioPlateType.getNew(dc); 757 plateType.setName(def.getName()); 758 plateType.setBioMaterialType(def.getBioMaterialType()); 759 if (def.getSubtype() != null) 760 { 761 plateType.setItemSubtype(def.getSubtype().load(dc)); 762 } 763 plateType.setLockMode(def.getLockMode()); 764 765 dc.saveItem(plateType); 766 dc.commit(); 767 } 768 finally 769 { 770 if (dc != null) dc.close(); 771 } 772 return plateType; 773 } 774 775 776 /** 777 Check for an existing bioplate type with the given options. 778 A JSONObject is returned with the result. The following 779 keys are used: 780 <ul> 781 <li>itemType: BIOPLATETYPE 782 <li>name: The name of the bioplate type 783 <li>id: The id of the bioplate type if it exists 784 <li>bioMaterialType: The bioMaterial type that can be used on bioplates with the given type 785 <li>status: ok, error, or missing 786 <li>message: A descriptive message in case of an error 787 </ul> 788 @since 2.0 789 */ 790 @SuppressWarnings("unchecked") 791 public JSONObject checkBioplateType(DbControl dc, BioplateType plateType, 792 boolean createIfMissing) 793 { 794 795 JSONObject json = new JSONObject(); 796 JSONArray jsonMessages = new JSONArray(); 797 json.put("itemType", Item.BIOPLATETYPE.name()); 798 json.put("name", plateType.getName()); 799 json.put("bioMaterialType", plateType.getBioMaterialType().name()); 800 801 List<BioPlateType> result = Reggie.listBioPlateTypes(dc, plateType); 802 if (result.size() == 0) 803 { 804 if (createIfMissing) 805 { 806 BioPlateType t = createBioPlateType(dc.getSessionControl(), plateType); 807 json.put("id", t.getId()); 808 json.put("status", "ok"); 809 jsonMessages.add("Created"); 810 } 811 else 812 { 813 json.put("status", "missing"); 814 jsonMessages.add("Not found"); 815 } 816 } 817 else if (result.size() > 1) 818 { 819 json.put("status", "error"); 820 jsonMessages.add("Found > 1 bioplate type"); 821 } 822 else 823 { 824 BioPlateType t = result.get(0); 825 json.put("id", t.getId()); 826 json.put("status", "ok"); // For now -- more checks below 827 828 if (t.getBioMaterialType() != plateType.getBioMaterialType()) 829 { 830 json.put("status", "error"); 831 jsonMessages.add("Can't be used by '" + plateType.getBioMaterialType() + "' items."); 832 } 833 834 Subtype subtype = plateType.getSubtype(); 835 if (subtype != null) 836 { 837 if (!subtype.load(dc).equals(t.getItemSubtype())) 838 { 839 json.put("status", "error"); 840 jsonMessages.add("Should be locked to '" + subtype.getName() + "' (" + subtype.getMainType() + ") items."); 841 } 842 } 843 844 if (t.getLockMode() != plateType.getLockMode()) 845 { 846 json.put("status", "error"); 847 jsonMessages.add("Should be using '" + plateType.getLockMode().name() + "' well lock mode"); 848 } 849 } 850 if (jsonMessages.size() == 0) jsonMessages.add("Ok"); 851 json.put("messages", jsonMessages); 852 return json; 853 854 } 855 724 856 725 857 /**
Note: See TracChangeset
for help on using the changeset viewer.