Changeset 5778
- Timestamp:
- Sep 30, 2011, 2:00:03 PM (11 years ago)
- Location:
- trunk/src/test/net/sf/basedb/test
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/test/net/sf/basedb/test/FileUtil.java
r5630 r5778 36 36 import net.sf.basedb.core.ItemSubtype; 37 37 import net.sf.basedb.core.Nameable; 38 import net.sf.basedb.core.Path; 38 39 import net.sf.basedb.core.SystemItems; 39 import net.sf.basedb.core.User;40 40 41 41 /** … … 78 78 } 79 79 80 Directory home = User.getById(dc, dc.getSessionControl().getLoggedInUserId()).getHomeDirectory();81 if (home == null) home = Directory.getById(dc, SystemItems.getId(Directory.ROOT));82 File file = File.getFile(dc, home, filename, true);80 Path pathOnBase = new Path("~/" + filename, Path.Type.FILE); 81 Directory dirOnBase = Directory.getNew(dc, pathOnBase); 82 File file = File.getFile(dc, dirOnBase, pathOnBase.getFilename(), true); 83 83 if (fileTypeId != null) 84 84 { -
trunk/src/test/net/sf/basedb/test/SequenceData.java
r5765 r5778 45 45 parameters.put("dataHeaderRegexp", "<seqname>\\t.*<transcript_id>.*"); 46 46 parameters.put("minDataColumns", 4); 47 parameters.put("complexExpressions", "allow"); 48 parameters.put("trimQuotes", true); 47 49 48 parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\ ");50 parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\@\\<seqname>\\"); 49 51 parameters.put("nameColumnMapping", "\\<transcript_id>\\"); 50 parameters.put("trimQuotes", true); 52 parameters.put("symbolColumnMapping", "\\<gene_id>\\"); 53 parameters.put("extendedColumnMapping.chromosome", "\\<seqname>\\"); 51 54 52 55 return parameters; … … 62 65 parameters.put("dataHeaderRegexp", "<seqname>\\t.*<transcript_id>.*"); 63 66 parameters.put("minDataColumns", 4); 67 parameters.put("complexExpressions", "allow"); 68 parameters.put("trimQuotes", true); 64 69 65 70 parameters.put("featureIdentification", "FEATURE_ID"); 66 parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\"); 67 parameters.put("featureIdColumnMapping", "\\<transcript_id>\\"); 68 parameters.put("trimQuotes", true); 71 parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\@\\<seqname>\\"); 72 parameters.put("featureIdColumnMapping", "\\<transcript_id>\\@\\<seqname>\\"); 69 73 70 74 return parameters; -
trunk/src/test/net/sf/basedb/test/roles/AdminTest.java
r5765 r5778 129 129 File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.PLATE); 130 130 File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", File.REPORTER); 131 File gtfReporters = FileUtil.uploadFile(dc, "/sequencing", " refseq_CDS_fasta-hg19.gtf.tar.bz2", File.REPORTER);131 File gtfReporters = FileUtil.uploadFile(dc, "/sequencing", "UCSC_Human_hg19_RefSeqGenes.gtf.tar.bz2", File.REPORTER); 132 132 dc.commit(); 133 133 -
trunk/src/test/net/sf/basedb/test/roles/AnalysisTest.java
r5699 r5778 97 97 activeProject, options, 0); 98 98 99 Formula formula = Util.findFormula(dc, RawDataTypes.getSafeRawDataType("genepix"), Formula.Type.INTENSITY_EXPRESSION, "Mean FG - Mean BG"); 99 Formula meanFormula = Util.findFormula(dc, RawDataTypes.getSafeRawDataType("genepix"), 100 Formula.Type.INTENSITY_EXPRESSION, "Mean FG - Mean BG"); 101 Formula fpkmFormula = Util.findFormula(dc, RawDataTypes.getSafeRawDataType("cufflinks"), 102 Formula.Type.INTENSITY_EXPRESSION, "FPKM"); 100 103 dc.close(); 101 104 102 105 BioAssaySet root = createRootBioAssaySet(experiment, 103 "Root bioassay set (" + user + ")", formula);106 "Root bioassay set (" + user + ")", meanFormula); 104 107 BioAssaySet filtered = filterBioAssaySet(experiment, root, 105 "Filtered bioassay set (" + user + ")", "ch(1) > 0 && ch(2) > 0 && rep('id') != null"); 108 "Filtered bioassay set (" + user + ")", 109 "ch(1) > 0 && ch(2) > 0 && rep('id') != null", 110 null, null); 106 111 107 112 BioAssaySet normalized = normalizeBioAssaySet(experiment, filtered, 108 113 "Normalized bioassay set (" + user + ")"); 114 115 BioAssaySet rootSeq = createRootBioAssaySet(seqExperiment, 116 "Root bioassay set ("+user+")", fpkmFormula); 117 BioAssaySet filteredSeq = filterBioAssaySet(seqExperiment, rootSeq, 118 "Filtered bioassay set (" + user + ")", 119 "ch(1) > 0.1", null, 2); 109 120 } 110 121 catch (Throwable t) … … 127 138 throws Exception 128 139 { 129 TestUtil.write("--Creating root bioassay set : " + name + "\n");140 TestUtil.write("--Creating root bioassay set in " + experiment.getName() + ": " + name + "\n"); 130 141 DbControl dc = TestUtil.getDbControl(); 131 142 try … … 161 172 Create a filtered bioassay set. 162 173 */ 163 public static BioAssaySet filterBioAssaySet(Experiment experiment, BioAssaySet source, String name, String expression) 174 public static BioAssaySet filterBioAssaySet(Experiment experiment, BioAssaySet source, String name, 175 String expression, Integer includeLimit, Integer excludeLimit) 164 176 throws Exception 165 177 { 166 TestUtil.write("--Creating filtered bioassay set : " + name + "\n");178 TestUtil.write("--Creating filtered bioassay set in " + experiment.getName() + ": " + name + "\n"); 167 179 DbControl dc = TestUtil.getDbControl(); 168 180 try … … 175 187 job.setParameterValue("childName", new StringParameterType(), name); 176 188 job.setParameterValue("expression", new StringParameterType(), expression); 189 if (includeLimit != null) 190 { 191 job.setParameterValue("includeLimit", new IntegerParameterType(), includeLimit); 192 } 193 if (excludeLimit != null) 194 { 195 job.setParameterValue("excludeLimit", new IntegerParameterType(), excludeLimit); 196 } 177 197 dc.saveItem(job); 178 198 dc.commit(); … … 196 216 throws Exception 197 217 { 198 TestUtil.write("--Creating normalized bioassay set : " + name + "\n");218 TestUtil.write("--Creating normalized bioassay set in " + experiment.getName() + ": " + name + "\n"); 199 219 DbControl dc = TestUtil.getDbControl(); 200 220 try -
trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java
r5765 r5778 174 174 175 175 PluginConfiguration gtfFeatureImporter = PluginUtil.createPluginConfiguration(dc, 176 "GTF feature for project A", "net.sf.basedb.plugins.gtf.GtfReporterMapImporter",176 "GTF features for project A", "net.sf.basedb.plugins.gtf.GtfReporterMapImporter", 177 177 SequenceData.getGtfFeatureParameters()); 178 178 … … 184 184 "net.sf.basedb.plugins.RawDataFlatFileImporter", MouseData.getGenePixRawDataParameters(true)); 185 185 Util.setAnnotation(rawDataImporterDyeSwap, dyeSwap, true, null); 186 186 187 187 PluginDefinition arrayDesignImporter = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.batchimport.ArrayDesignImporter"); 188 188 PluginDefinition arrayBatchImporter = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.batchimport.ArrayBatchImporter"); … … 196 196 File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", File.PRINT_MAP); 197 197 File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", File.REPORTER_MAP); 198 File refSeqFile = FileUtil.uploadFile(dc, "/sequencing", " refseq_CDS_fasta-hg19.gtf.tar.bz2", File.REPORTER_MAP);198 File refSeqFile = FileUtil.uploadFile(dc, "/sequencing", "UCSC_Human_hg19_RefSeqGenes.gtf.tar.bz2", File.REPORTER_MAP); 199 199 File batchImportFile_ArrayBatch = null; 200 200 File batchImportFile_ArrayDesign = null; -
trunk/src/test/net/sf/basedb/test/roles/RootTest.java
r4514 r5778 25 25 26 26 import net.sf.basedb.core.DbControl; 27 import net.sf.basedb.core.Directory; 27 28 import net.sf.basedb.core.Quota; 28 29 import net.sf.basedb.core.Role; … … 82 83 TestUtil.write("--Creating administrator\n"); 83 84 Quota unlimited = Quota.getById(dc, SystemItems.getId(Quota.UNRESTRICTED)); 84 Role admin = Role.getById(dc, SystemItems.getId(Role.ADMINISTRATOR));85 Role adminRole = Role.getById(dc, SystemItems.getId(Role.ADMINISTRATOR)); 85 86 86 return Util.createUser(dc, "Administrator", "admin", "admin", unlimited, null, 87 Collections.singleton(admin), null); 87 User admin = Util.createUser(dc, "Administrator", "admin", "admin", unlimited, null, 88 Collections.singleton(adminRole), null); 89 Directory.createHomeDirectory(dc, admin, false); 90 91 return admin; 88 92 } 89 93 -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5751 r5778 48 48 import net.sf.basedb.core.PlateGeometry; 49 49 import net.sf.basedb.core.Platform; 50 import net.sf.basedb.core.PlatformVariant; 50 51 import net.sf.basedb.core.PluginConfiguration; 51 52 import net.sf.basedb.core.PluginDefinition; … … 149 150 Platform genericPlatform = Platform.getByExternalId(dc, Platform.GENERIC); 150 151 Platform affymetrixPlatform = Platform.getByExternalId(dc, Platform.AFFYMETRIX); 152 PlatformVariant seqPlatform = PlatformVariant.getByExternalId(dc, PlatformVariant.SEQUENCING_EXPRESSION); 153 151 154 BioPlate bioPlate = createBioPlate(dc, "Bioplate A", Util.findGeometry(dc, 16, 24), 152 155 Util.findBioPlateType(dc, "Bioplate type A")); … … 162 165 File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", File.RAW_DATA); 163 166 164 // TODO (#1613) - when we have test data files from cufflinks 165 // File seqData1 = FileUtil.uploadFile(dc, "/illumina", "seq-raw1.txt", File.RAW_DATA); 166 // File seqData2 = FileUtil.uploadFile(dc, "/illumina", "seq-raw2.txt", File.RAW_DATA); 167 // File seqDataRef = FileUtil.uploadFile(dc, "/illumina", "seq-raw-ref.txt", File.RAW_DATA); 167 File seqData1 = FileUtil.uploadFile(dc, "/sequencing", "dataset1_norm1/isoforms.fpkm_tracking.tar.bz2", File.RAW_DATA); 168 File seqData2 = FileUtil.uploadFile(dc, "/sequencing", "dataset2_norm1/isoforms.fpkm_tracking.tar.bz2", File.RAW_DATA); 168 169 dc.commit(); 169 170 … … 190 191 RawBioAssay seqRaw1 = null; 191 192 RawBioAssay seqRaw2 = null; 192 RawBioAssay seqRawRef = null;193 193 194 194 if (!useBatchImporters) … … 229 229 Extract lib2 = createLibrary(dc, "Library A.24h", e2); 230 230 lib2.setBioWell(bioPlate.getBioWell(4, 1)); 231 Extract libRef = createLibrary(dc, "Library A.ref", eRef);232 libRef.setBioWell(bioPlate.getBioWell(4, 2));233 231 234 232 // Hybridizations, etc. … … 244 242 245 243 // Flow cell 246 PhysicalBioAssay flowCell1 = createFlowCell(dc, "Flow cell A", 8, lib1, lib2 , libRef);244 PhysicalBioAssay flowCell1 = createFlowCell(dc, "Flow cell A", 8, lib1, lib2); 247 245 248 246 // Scans … … 264 262 DerivedBioAssay assembly2 = createDerivedBioAssay(dc, "Assembly A.24h", sequencedAssay, lib2, 265 263 DerivedBioAssay.ARRANGEMENT, "TopHat Settings A", "TopHat"); 266 DerivedBioAssay assemblyRef = createDerivedBioAssay(dc, "Assembly A.ref", sequencedAssay, libRef,267 DerivedBioAssay.ARRANGEMENT, "TopHat Settings A", "TopHat");268 264 269 265 // Raw bioassays … … 272 268 ArrayDesign refSeqDesign = Util.findArrayDesign(dc, "RefSeqDesign A"); 273 269 RawDataType genepix = RawDataTypes.getSafeRawDataType("genepix"); 270 RawDataType cufflinksRaw = RawDataTypes.getSafeRawDataType("cufflinks"); 274 271 Protocol featureExtraction = Util.findProtocol(dc, "Feature extraction A"); 275 272 Protocol cufflinksSettings = Util.findProtocol(dc, "Cufflinks Settings A"); … … 293 290 294 291 // Sequence raw bioassays 295 // TODO (#1613) - use different raw data type when added by #1153 296 seqRaw1 = createRawBioAssay(dc, genericPlatform, genepix, "SeqRaw A.00h", assembly1, lib1, cufflinksSettings, cufflinks, refSeqDesign); 297 seqRaw2 = createRawBioAssay(dc, genericPlatform, genepix, "SeqRaw A.24h", assembly2, lib2, cufflinksSettings, cufflinks, refSeqDesign); 298 seqRawRef = createRawBioAssay(dc, genericPlatform, genepix, "SeqRaw A.ref", assemblyRef, libRef, cufflinksSettings, cufflinks, refSeqDesign); 299 300 // TODO (#1613) - when we have defined a seq raw file type and have some test data files 301 // FileUtil.addDataFile(dc, seqRaw1, DataFileType.SEQ_RAW, seqData1, true); 302 // FileUtil.addDataFile(dc, seqRaw2, DataFileType.SEQ_RAW, seqData2, true); 303 // FileUtil.addDataFile(dc, seqRawRef, DataFileType.SEQ_RAW, seqDataRef, true); 292 seqRaw1 = createRawBioAssay(dc, seqPlatform, cufflinksRaw, "SeqRaw A.00h", assembly1, lib1, cufflinksSettings, cufflinks, refSeqDesign); 293 seqRaw2 = createRawBioAssay(dc, seqPlatform, cufflinksRaw, "SeqRaw A.24h", assembly2, lib2, cufflinksSettings, cufflinks, refSeqDesign); 294 295 FileUtil.addDataFile(dc, seqRaw1, DataFileType.FPKM_TRACKING, seqData1, true); 296 FileUtil.addDataFile(dc, seqRaw2, DataFileType.FPKM_TRACKING, seqData2, true); 304 297 305 298 dc.commit(); … … 346 339 seqRaw1 = Util.findRawBioAssay(dc, "SeqRaw A.00h"); 347 340 seqRaw2 = Util.findRawBioAssay(dc, "SeqRaw A.24h"); 348 seqRawRef = Util.findRawBioAssay(dc, "SeqRaw A.ref");349 341 350 342 inheritAnnotations(dc, rba1, s1, bioSource, sc1); … … 361 353 inheritAnnotations(dc, seqRaw1, s1, bioSource); 362 354 inheritAnnotations(dc, seqRaw2, s2, bioSource); 363 inheritAnnotations(dc, seqRawRef, sRef);364 355 365 356 PluginConfiguration rawDataImporter = Util.findPluginConfiguration(dc, "Raw data for project A"); 366 357 PluginConfiguration rawDataImporterDyeSwap = Util.findPluginConfiguration(dc, "Raw data for project A (dye-swap)"); 358 PluginConfiguration seqRawImporter = Util.findPluginConfiguration(dc, "Cufflinks isoform FPKM (transcript_id@seqname; no prefix)"); 367 359 dc.commit(); 368 360 … … 373 365 importRawData(rawDataImporterDyeSwap, rawData2DyeSwap, rba2DyeSwap); 374 366 375 // TODO (#1613) - when we have the importer and raw data files 376 // importRawData(seqRawImporter, seqData1, seqRaw1); 377 // importRawData(seqRawImporter, seqData2, seqRaw2); 378 // importRawData(seqRawImporter, seqDataRef, seqRawRef); 367 importRawData(seqRawImporter, seqData1, seqRaw1); 368 importRawData(seqRawImporter, seqData2, seqRaw2); 379 369 380 370 // Experiment … … 384 374 Experiment affyExperiment = createExperiment(dc, "Affymetrix A", 385 375 affymetrixPlatform.getRawDataType(), affyRaw1, affyRaw2, affyRaw3); 386 // TODO (#1613) - use different raw data type when added by #1153387 376 Experiment seqExperiment = createExperiment(dc, "Sequence A", 388 RawDataTypes.getSafeRawDataType(" genepix"), seqRaw1, seqRaw2, seqRawRef);377 RawDataTypes.getSafeRawDataType("cufflinks"), seqRaw1, seqRaw2); 389 378 dc.commit(); 390 379 … … 634 623 return rba; 635 624 } 625 626 /** 627 Create a raw bioassay. 628 */ 629 public static RawBioAssay createRawBioAssay(DbControl dc, PlatformVariant variant, 630 RawDataType rawDataType, String name, DerivedBioAssay bioAssay, Extract extract, 631 Protocol protocol, Software software, ArrayDesign design) 632 { 633 TestUtil.write("--Creating raw bioassay: " + name + "\n"); 634 RawBioAssay rba = RawBioAssay.getNew(dc, variant, rawDataType); 635 rba.setName(name); 636 rba.setParentBioAssay(bioAssay); 637 rba.setParentExtract(extract); 638 rba.setProtocol(protocol); 639 rba.setSoftware(software); 640 rba.setArrayDesign(design); 641 dc.saveItem(rba); 642 return rba; 643 } 636 644 637 645 /** … … 669 677 job.setParameterValue("missingReporterError", new StringParameterType(), "null"); 670 678 job.setParameterValue("featureMismatchError", new StringParameterType(), "smart"); 679 job.setParameterValue("numberFormatError", new StringParameterType(), "null"); 671 680 dc.saveItem(job); 672 681 dc.commit(); -
trunk/src/test/net/sf/basedb/test/roles/Util.java
r5765 r5778 259 259 ItemQuery<PluginConfiguration> query = PluginConfiguration.getQuery(); 260 260 query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name))); 261 return query.list(dc).get(0); 261 List<PluginConfiguration> result = query.list(dc); 262 if (result.size() == 0) 263 { 264 query.include(Include.SHARED); 265 result = query.list(dc); 266 } 267 return result.get(0); 262 268 } 263 269
Note: See TracChangeset
for help on using the changeset viewer.