Search in sources :

Example 11 with SimpleExpressionExperimentMetaData

use of ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData in project Gemma by PavlidisLab.

the class LoadSimpleExpressionDataCli method loadExperiment.

private void loadExperiment(String configurationLine) throws Exception {
    int i;
    String[] fields = configurationLine.split(LoadSimpleExpressionDataCli.SPLIT_CHAR);
    if (fields.length != LoadSimpleExpressionDataCli.TOTAL_FIELDS) {
        throw new IllegalArgumentException("Field Missing Got[" + fields.length + "]: " + configurationLine);
    }
    for (i = 0; i < fields.length; i++) fields[i] = StringUtils.trim(fields[i]);
    SimpleExpressionExperimentMetaData metaData = new SimpleExpressionExperimentMetaData();
    String shortName = fields[LoadSimpleExpressionDataCli.SHORT_NAME_I];
    ExpressionExperiment existing = eeService.findByShortName(shortName);
    if (existing != null) {
        throw new IllegalArgumentException("There is already an experiment with short name " + shortName + "; please choose something unique.");
    }
    metaData.setName(fields[LoadSimpleExpressionDataCli.NAME_I]);
    metaData.setShortName(shortName);
    metaData.setDescription(fields[LoadSimpleExpressionDataCli.DESCRIPTION_I]);
    this.configureTaxon(fields, metaData);
    this.configureArrayDesigns(fields, metaData);
    try (InputStream data = new FileInputStream(new File(this.dirName, fields[LoadSimpleExpressionDataCli.DATA_FILE_I]))) {
        metaData.setSourceUrl(fields[LoadSimpleExpressionDataCli.SOURCE_I]);
        String pubMedId = fields[LoadSimpleExpressionDataCli.PUBMED_I];
        if (StringUtils.isNotBlank(pubMedId)) {
            metaData.setPubMedId(Integer.parseInt(pubMedId));
        }
        this.configureQuantitationType(fields, metaData);
        ExpressionExperiment ee = eeLoaderService.create(metaData, data);
        this.eeService.thawLite(ee);
    }
}
Also used : SimpleExpressionExperimentMetaData(ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Aggregations

SimpleExpressionExperimentMetaData (ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData)11 InputStream (java.io.InputStream)10 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)10 Taxon (ubic.gemma.model.genome.Taxon)9 Before (org.junit.Before)6 Test (org.junit.Test)4 HashSet (java.util.HashSet)3 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)3 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)2 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)2 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)1