Ignore:
Timestamp:
Sep 27, 2011, 3:38:36 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

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

  • Added GTF reporter importer test (in admin test)
  • Added GTF file and GTF feature importer test (in power user test)
Location:
trunk/src/test/net/sf/basedb/test
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/test/net/sf/basedb/test/PluginUtil.java

    r4514 r5765  
    7575      ParameterType stringType = new StringParameterType();
    7676      ParameterType intType = new IntegerParameterType();
     77      ParameterType boolType = new BooleanParameterType();
    7778      for (Map.Entry<String, Object> param : parameters.entrySet())
    7879      {
     
    8687        {
    8788          config.setParameterValues(param.getKey(), intType, values);
     89        }
     90        else if (value instanceof Boolean)
     91        {
     92          config.setParameterValues(param.getKey(), boolType, values);
    8893        }
    8994        else
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r5699 r5765  
    5252import net.sf.basedb.test.MouseData;
    5353import net.sf.basedb.test.PluginUtil;
     54import net.sf.basedb.test.SequenceData;
    5455import net.sf.basedb.test.TestUtil;
    5556
     
    118119          "Reporters from Affymetrix annotations file",
    119120          "net.sf.basedb.plugins.ReporterFlatFileImporter", AffymetrixData.getReporterParameters());
     121     
     122      PluginConfiguration gtfReporterImporter = PluginUtil.createPluginConfiguration(dc,
     123          "Reporters from GTF file",
     124          "net.sf.basedb.plugins.gtf.GtfReporterImporter", SequenceData.getGtfReporterParameters());
    120125      dc.commit();
    121126     
     
    124129      File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.PLATE);
    125130      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);
    126132      dc.commit();
    127133     
    128134      //Import reporters
    129135      PluginUtil.importReporters(reporterImporter, reporters, "Importing reporters for project A");
    130       PluginUtil.importReporters(affyReporterImporter, affyReporters, "Importing Affymetrix reporter for project A");
     136      PluginUtil.importReporters(affyReporterImporter, affyReporters, "Importing Affymetrix reporters for project A");
     137      PluginUtil.importReporters(gtfReporterImporter, gtfReporters, "Importing GTF reporters for project A");
    131138      TestUtil.logout();
    132139    }
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r5751 r5765  
    4949import net.sf.basedb.core.PlateType;
    5050import net.sf.basedb.core.Platform;
     51import net.sf.basedb.core.PlatformVariant;
    5152import net.sf.basedb.core.PluginConfiguration;
    5253import net.sf.basedb.core.PluginDefinition;
     
    6465import net.sf.basedb.test.MouseData;
    6566import net.sf.basedb.test.PluginUtil;
     67import net.sf.basedb.test.SequenceData;
    6668import net.sf.basedb.test.TestUtil;
    6769
     
    171173      PluginDefinition printMapImporter = PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.PrintMapFlatFileImporter");
    172174
     175      PluginConfiguration gtfFeatureImporter = PluginUtil.createPluginConfiguration(dc,
     176          "GTF feature for project A", "net.sf.basedb.plugins.gtf.GtfReporterMapImporter",
     177          SequenceData.getGtfFeatureParameters());
     178     
    173179      PluginConfiguration rawDataImporter = PluginUtil.createPluginConfiguration(dc, "Raw data for project A",
    174180          "net.sf.basedb.plugins.RawDataFlatFileImporter", MouseData.getGenePixRawDataParameters(false));
     
    190196      File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", File.PRINT_MAP);
    191197      File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", File.REPORTER_MAP);
    192       // TODO (#1613) - When we have a RefSeq test file
    193       // File refSeqFile = FileUtil.uploadFile(dc, "/illumina", "refseq.txt", File.REPORTER_MAP);
     198      File refSeqFile = FileUtil.uploadFile(dc, "/sequencing", "refseq_CDS_fasta-hg19.gtf.tar.bz2", File.REPORTER_MAP);
    194199      File batchImportFile_ArrayBatch = null;
    195200      File batchImportFile_ArrayDesign = null;
     
    211216      Platform genericPlatform = Platform.getByExternalId(dc, Platform.GENERIC);
    212217      Platform affymetrixPlatform = Platform.getByExternalId(dc, Platform.AFFYMETRIX);
     218      PlatformVariant seqPlatform = PlatformVariant.getByExternalId(dc, PlatformVariant.SEQUENCING_EXPRESSION);
    213219      if (!useBatchImporters)
    214220      {
     
    217223        affyDesign = createArrayDesign(dc, affymetrixPlatform, "Affymetrix A", null);
    218224        FileUtil.addDataFile(dc, affyDesign, DataFileType.AFFYMETRIX_CDF, cdfFile, true);
    219         // TODO (#1613) - use different platform when it has been defined by #1153
    220         refSeqDesign = createArrayDesign(dc, genericPlatform, "RefSeqDesign A", null);
    221         // TODO (#1613) - when a ref-seq file type has been defined by #1153
    222         // and we have a test data set -- DO NOT FORGET TO ADD TO THE BATCH IMPORTER FILES
    223         //FileUtil.addDataFile(dc, refSeqDesign, DataFileType.REF_SEQ, refSeqFile, true);
     225        refSeqDesign = createArrayDesign(dc, seqPlatform, "RefSeqDesign A", null);
     226        FileUtil.addDataFile(dc, refSeqDesign, DataFileType.REF_SEQ_GTF, refSeqFile, true);
    224227      }
    225228      else
     
    234237     
    235238      importFeatures(printMapImporter, printMap, design);
    236       // TODO (#1613) - when we have the importer, data file, etc.
    237       // importFeatures(refSeqImporter, refSeqFile, refSeqDesign);
     239      importFeatures(gtfFeatureImporter, refSeqFile, refSeqDesign);
    238240     
    239241      dc = TestUtil.getDbControl();
     
    461463
    462464  /**
     465    Create an array design.
     466  */
     467  public static ArrayDesign createArrayDesign(DbControl dc, PlatformVariant variant, String name, String linkToPlatesPattern)
     468  {
     469    TestUtil.write("--Creating array design: " + name + "\n");
     470    ArrayDesign design = ArrayDesign.getNew(dc, variant);
     471    design.setName(name);
     472   
     473    if (linkToPlatesPattern != null)
     474    {
     475      List<Plate> plates = Util.findPlates(dc, linkToPlatesPattern);
     476      design.setPlateList(plates);
     477    }
     478   
     479    dc.saveItem(design);
     480    return design;
     481  }
     482
     483  /**
    463484    Create an array batch.
    464485  */
     
    537558    }
    538559  }
     560
     561  /**
     562    Import features.
     563  */
     564  public static void importFeatures(PluginConfiguration config, File file, ArrayDesign design)
     565    throws Exception
     566  {
     567    TestUtil.write("--Importing features from file: " + file.getName() + "\n");
     568    DbControl dc = TestUtil.getDbControl();
     569    try
     570    {
     571      config = PluginConfiguration.getById(dc, config.getId());
     572      Job job = Job.getNew(dc, config.getPluginDefinition(), config, null);
     573      job.setName("Importing features to array design: " + design.getName());
     574      job.setParameterValue("file", new FileParameterType(), file);
     575      job.setParameterValue("arrayDesign",
     576        new ItemParameterType<ArrayDesign>(ArrayDesign.class, null), design);
     577      dc.saveItem(job);
     578      dc.commit();
     579      PluginUtil.executeJob(job);
     580    }
     581    finally
     582    {
     583      if (dc != null) dc.close();
     584    }
     585  }
     586
    539587 
    540588  public static void importArrayBatches(PluginDefinition batchImporter, File file)
     
    588636      job.setParameterValue("numArraysColumnMapping", new StringParameterType(), "\\Arrays/slide\\");
    589637      job.setParameterValue("platformColumnMapping", new StringParameterType(), "\\Platform\\");
     638      job.setParameterValue("variantColumnMapping", new StringParameterType(), "\\Variant\\");
    590639      job.setParameterValue("fileTypeColumnMapping", new StringParameterType(), "\\File type\\");
    591640      job.setParameterValue("fileColumnMapping", new StringParameterType(), "\\File\\");
  • trunk/src/test/net/sf/basedb/test/roles/Util.java

    r5751 r5765  
    198198    }
    199199    query.order(Orders.asc(Hql.property("name")));
    200     System.out.println("Find plates: " + query.toQl(dc));
    201200    return query.list(dc);
    202201  }
Note: See TracChangeset for help on using the changeset viewer.