Changeset 5778


Ignore:
Timestamp:
Sep 30, 2011, 2:00:03 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #1613: Extend the 'roles' test case with some sequence-related tests

  • Fixed reporter and array design test to use the same GTF file that the fpkm_tracking files use.
  • Raw bioassays and experiment now use the sequencing platform
  • Added isoforms.fpkm_tracking files and import data from them with the raw data importer.
  • Create a root bioassay set using the fpkm values and a filtered bioassay set were both data sets have a value (seems like the .2 data set has very few values).
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  
    3636import net.sf.basedb.core.ItemSubtype;
    3737import net.sf.basedb.core.Nameable;
     38import net.sf.basedb.core.Path;
    3839import net.sf.basedb.core.SystemItems;
    39 import net.sf.basedb.core.User;
    4040
    4141/**
     
    7878    }
    7979 
    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);
    8383    if (fileTypeId != null)
    8484    {
  • trunk/src/test/net/sf/basedb/test/SequenceData.java

    r5765 r5778  
    4545    parameters.put("dataHeaderRegexp", "<seqname>\\t.*<transcript_id>.*");
    4646    parameters.put("minDataColumns", 4);
     47    parameters.put("complexExpressions", "allow");
     48    parameters.put("trimQuotes", true);
    4749
    48     parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\");
     50    parameters.put("reporterIdColumnMapping", "\\<transcript_id>\\@\\<seqname>\\");
    4951    parameters.put("nameColumnMapping", "\\<transcript_id>\\");
    50     parameters.put("trimQuotes", true);
     52    parameters.put("symbolColumnMapping", "\\<gene_id>\\");
     53    parameters.put("extendedColumnMapping.chromosome", "\\<seqname>\\");
    5154   
    5255    return parameters;
     
    6265    parameters.put("dataHeaderRegexp", "<seqname>\\t.*<transcript_id>.*");
    6366    parameters.put("minDataColumns", 4);
     67    parameters.put("complexExpressions", "allow");
     68    parameters.put("trimQuotes", true);
    6469 
    6570    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>\\");
    6973   
    7074    return parameters;
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r5765 r5778  
    129129      File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.PLATE);
    130130      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);
    132132      dc.commit();
    133133     
  • trunk/src/test/net/sf/basedb/test/roles/AnalysisTest.java

    r5699 r5778  
    9797        activeProject, options, 0);
    9898     
    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");
    100103      dc.close();
    101104     
    102105      BioAssaySet root = createRootBioAssaySet(experiment,
    103         "Root bioassay set (" + user + ")", formula);
     106        "Root bioassay set (" + user + ")", meanFormula);
    104107      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);
    106111
    107112      BioAssaySet normalized = normalizeBioAssaySet(experiment, filtered,
    108113        "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);
    109120    }
    110121    catch (Throwable t)
     
    127138    throws Exception
    128139  {
    129     TestUtil.write("--Creating root bioassay set: " + name + "\n");
     140    TestUtil.write("--Creating root bioassay set in " + experiment.getName() + ": " + name + "\n");
    130141    DbControl dc = TestUtil.getDbControl();
    131142    try
     
    161172    Create a filtered bioassay set.
    162173  */
    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)
    164176    throws Exception
    165177  {
    166     TestUtil.write("--Creating filtered bioassay set: " + name + "\n");
     178    TestUtil.write("--Creating filtered bioassay set in " + experiment.getName() + ": " + name + "\n");
    167179    DbControl dc = TestUtil.getDbControl();
    168180    try
     
    175187      job.setParameterValue("childName", new StringParameterType(), name);
    176188      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      }
    177197      dc.saveItem(job);
    178198      dc.commit();
     
    196216    throws Exception
    197217  {
    198     TestUtil.write("--Creating normalized bioassay set: " + name + "\n");
     218    TestUtil.write("--Creating normalized bioassay set in " + experiment.getName() + ": " + name + "\n");
    199219    DbControl dc = TestUtil.getDbControl();
    200220    try
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r5765 r5778  
    174174
    175175      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",
    177177          SequenceData.getGtfFeatureParameters());
    178178     
     
    184184          "net.sf.basedb.plugins.RawDataFlatFileImporter", MouseData.getGenePixRawDataParameters(true));
    185185      Util.setAnnotation(rawDataImporterDyeSwap, dyeSwap, true, null);
    186      
     186   
    187187      PluginDefinition arrayDesignImporter = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.batchimport.ArrayDesignImporter");
    188188      PluginDefinition arrayBatchImporter = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.batchimport.ArrayBatchImporter");
     
    196196      File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", File.PRINT_MAP);
    197197      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);
    199199      File batchImportFile_ArrayBatch = null;
    200200      File batchImportFile_ArrayDesign = null;
  • trunk/src/test/net/sf/basedb/test/roles/RootTest.java

    r4514 r5778  
    2525
    2626import net.sf.basedb.core.DbControl;
     27import net.sf.basedb.core.Directory;
    2728import net.sf.basedb.core.Quota;
    2829import net.sf.basedb.core.Role;
     
    8283    TestUtil.write("--Creating administrator\n");
    8384    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));
    8586   
    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;
    8892  }
    8993 
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r5751 r5778  
    4848import net.sf.basedb.core.PlateGeometry;
    4949import net.sf.basedb.core.Platform;
     50import net.sf.basedb.core.PlatformVariant;
    5051import net.sf.basedb.core.PluginConfiguration;
    5152import net.sf.basedb.core.PluginDefinition;
     
    149150      Platform genericPlatform = Platform.getByExternalId(dc, Platform.GENERIC);
    150151      Platform affymetrixPlatform = Platform.getByExternalId(dc, Platform.AFFYMETRIX);
     152      PlatformVariant seqPlatform = PlatformVariant.getByExternalId(dc, PlatformVariant.SEQUENCING_EXPRESSION);
     153     
    151154      BioPlate bioPlate = createBioPlate(dc, "Bioplate A", Util.findGeometry(dc, 16, 24),
    152155          Util.findBioPlateType(dc, "Bioplate type A"));
     
    162165      File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", File.RAW_DATA);
    163166     
    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);
    168169      dc.commit();
    169170     
     
    190191      RawBioAssay seqRaw1 = null;
    191192      RawBioAssay seqRaw2 = null;
    192       RawBioAssay seqRawRef = null;
    193193     
    194194      if (!useBatchImporters)
     
    229229        Extract lib2 = createLibrary(dc, "Library A.24h", e2);
    230230        lib2.setBioWell(bioPlate.getBioWell(4, 1));
    231         Extract libRef = createLibrary(dc, "Library A.ref", eRef);
    232         libRef.setBioWell(bioPlate.getBioWell(4, 2));
    233231       
    234232        // Hybridizations, etc.
     
    244242       
    245243        // 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);
    247245       
    248246        // Scans
     
    264262        DerivedBioAssay assembly2 = createDerivedBioAssay(dc, "Assembly A.24h", sequencedAssay, lib2,
    265263            DerivedBioAssay.ARRANGEMENT, "TopHat Settings A", "TopHat");
    266         DerivedBioAssay assemblyRef = createDerivedBioAssay(dc, "Assembly A.ref", sequencedAssay, libRef,
    267             DerivedBioAssay.ARRANGEMENT, "TopHat Settings A", "TopHat");
    268264       
    269265        // Raw bioassays
     
    272268        ArrayDesign refSeqDesign = Util.findArrayDesign(dc, "RefSeqDesign A");
    273269        RawDataType genepix = RawDataTypes.getSafeRawDataType("genepix");
     270        RawDataType cufflinksRaw = RawDataTypes.getSafeRawDataType("cufflinks");
    274271        Protocol featureExtraction = Util.findProtocol(dc, "Feature extraction A");
    275272        Protocol cufflinksSettings = Util.findProtocol(dc, "Cufflinks Settings A");
     
    293290       
    294291        // 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);
    304297       
    305298        dc.commit();
     
    346339      seqRaw1 = Util.findRawBioAssay(dc, "SeqRaw A.00h");
    347340      seqRaw2 = Util.findRawBioAssay(dc, "SeqRaw A.24h");
    348       seqRawRef = Util.findRawBioAssay(dc, "SeqRaw A.ref");
    349341     
    350342      inheritAnnotations(dc, rba1, s1, bioSource, sc1);
     
    361353      inheritAnnotations(dc, seqRaw1, s1, bioSource);
    362354      inheritAnnotations(dc, seqRaw2, s2, bioSource);
    363       inheritAnnotations(dc, seqRawRef, sRef);
    364355     
    365356      PluginConfiguration rawDataImporter = Util.findPluginConfiguration(dc, "Raw data for project A");
    366357      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)");
    367359      dc.commit();
    368360     
     
    373365      importRawData(rawDataImporterDyeSwap, rawData2DyeSwap, rba2DyeSwap);
    374366     
    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);
    379369 
    380370      // Experiment
     
    384374      Experiment affyExperiment = createExperiment(dc, "Affymetrix A",
    385375        affymetrixPlatform.getRawDataType(), affyRaw1, affyRaw2, affyRaw3);
    386       // TODO (#1613) - use different raw data type when added by #1153
    387376      Experiment seqExperiment = createExperiment(dc, "Sequence A",
    388         RawDataTypes.getSafeRawDataType("genepix"), seqRaw1, seqRaw2, seqRawRef);
     377        RawDataTypes.getSafeRawDataType("cufflinks"), seqRaw1, seqRaw2);
    389378      dc.commit();
    390379     
     
    634623    return rba;
    635624  }
     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  }
    636644 
    637645  /**
     
    669677      job.setParameterValue("missingReporterError", new StringParameterType(), "null");
    670678      job.setParameterValue("featureMismatchError", new StringParameterType(), "smart");
     679      job.setParameterValue("numberFormatError", new StringParameterType(), "null");
    671680      dc.saveItem(job);
    672681      dc.commit();
  • trunk/src/test/net/sf/basedb/test/roles/Util.java

    r5765 r5778  
    259259    ItemQuery<PluginConfiguration> query = PluginConfiguration.getQuery();
    260260    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);
    262268  }
    263269
Note: See TracChangeset for help on using the changeset viewer.