Search in sources :

Example 1 with ArrayDesignService

use of ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService in project Gemma by PavlidisLab.

the class GeoBrowserServiceParseTest method testParse.

@Test
public void testParse() throws Exception {
    String response = "<?xml version=\"1.0\"?>\n<!DOCTYPE eSummaryResult PUBLIC \"-//NLM//DTD eSummaryResult, 29 October 2004//EN\" \"http://www.ncbi.nlm.nih.gov/entrez/query/DTD/eSummary_041029.dtd\">\n" + "<eSummaryResult> <DocSum>   <Id>200004595</Id>  <Item Name=\"GDS\" Type=\"String\"></Item>  <Item Name=\"title\" Type=\"String\">Expression profiling of motor cortex in sporadic amyotrophic lateral sclerosis</Item> " + " <Item Name=\"summary\" Type=\"String\">We used oligonucleotide microarrays to find differentially" + " expressed genes between control subjects and those affected by sporadic amyotrophic lateral sclerosis. Keywords: disease state analysis</Item>   " + " <Item Name=\"GPL\" Type=\"String\">1708</Item>  <Item Name=\"GSE\" Type=\"String\">4595</Item>  <Item Name=\"taxon\" Type=\"String\">Homo sapiens</Item>  " + "  <Item Name=\"GSM_L\" Type=\"String\"></Item>    <Item Name=\"GSM_titles_L\" Type=\"String\"></Item>   " + "  <Item Name=\"entryType\" Type=\"String\">GSE</Item>   " + "  <Item Name=\"gdsType\" Type=\"String\">Expression profiling by array</Item>   " + "  <Item Name=\"ptechType\" Type=\"String\"></Item>    <Item Name=\"valType\" Type=\"String\"></Item> " + " <Item Name=\"SSInfo\" Type=\"String\"></Item>   <Item Name=\"subsetInfo\" Type=\"String\"></Item> " + "  <Item Name=\"PDAT\" Type=\"String\">2007/03/26</Item>   <Item Name=\"suppFile\" Type=\"String\"></Item>  " + "   <Item Name=\"Samples\" Type=\"List\">       <Item Name=\"Sample\" Type=\"Structure\">    " + "       <Item Name=\"Accession\" Type=\"String\">GSM102829</Item>      " + "     <Item Name=\"Title\" Type=\"String\">Control 2</Item>       </Item>    " + "    <Item Name=\"Sample\" Type=\"Structure\">       " + "    <Item Name=\"Accession\" Type=\"String\">GSM102832</Item>     " + "      <Item Name=\"Title\" Type=\"String\">Control 5</Item>   " + "    </Item>         <Item Name=\"Sample\" Type=\"Structure\">    " + "       <Item Name=\"Accession\" Type=\"String\">GSM102835</Item>  " + "        <Item Name=\"Title\" Type=\"String\">Control 8</Item>      " + " </Item>         <Item Name=\"Sample\" Type=\"Structure\">       " + "    <Item Name=\"Accession\" Type=\"String\">GSM102838</Item>       " + "    <Item Name=\"Title\" Type=\"String\">Diseased 2</Item>      </Item>   " + "      <Item Name=\"Sample\" Type=\"Structure\">        " + "   <Item Name=\"Accession\" Type=\"String\">GSM102845</Item>   " + "        <Item Name=\"Title\" Type=\"String\">Diseased 7</Item>      </Item>   " + "      <Item Name=\"Sample\" Type=\"Structure\">         " + "  <Item Name=\"Accession\" Type=\"String\">GSM102830</Item>    " + "       <Item Name=\"Title\" Type=\"String\">Control 3</Item>       </Item>   " + "      <Item Name=\"Sample\" Type=\"Structure\">  " + "         <Item Name=\"Accession\" Type=\"String\">GSM102837</Item>     " + "      <Item Name=\"Title\" Type=\"String\">Diseased 1</Item>      </Item>   " + "      <Item Name=\"Sample\" Type=\"Structure\">         " + "  <Item Name=\"Accession\" Type=\"String\">GSM102840</Item>   " + "        <Item Name=\"Title\" Type=\"String\">Diseased 4</Item>      </Item>  " + "      <Item Name=\"Sample\" Type=\"Structure\">   " + "        <Item Name=\"Accession\" Type=\"String\">GSM102846</Item>   " + "        <Item Name=\"Title\" Type=\"String\">Diseased 8</Item>      </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">     " + "      <Item Name=\"Accession\" Type=\"String\">GSM102828</Item>       " + "    <Item Name=\"Title\" Type=\"String\">Control 1</Item>       </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">      " + "     <Item Name=\"Accession\" Type=\"String\">GSM102831</Item>    " + "       <Item Name=\"Title\" Type=\"String\">Control 4</Item>       </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">    " + "      <Item Name=\"Accession\" Type=\"String\">GSM102834</Item>   " + "       <Item Name=\"Title\" Type=\"String\">Control 7</Item>       </Item>    " + "     <Item Name=\"Sample\" Type=\"Structure\">    " + "      <Item Name=\"Accession\" Type=\"String\">GSM102841</Item>     " + "     <Item Name=\"Title\" Type=\"String\">Diseased 5</Item>      </Item>    " + "     <Item Name=\"Sample\" Type=\"Structure\">      " + "     <Item Name=\"Accession\" Type=\"String\">GSM102844</Item>    " + "      <Item Name=\"Title\" Type=\"String\">Diseased 6</Item>      </Item>    " + "     <Item Name=\"Sample\" Type=\"Structure\">     " + "      <Item Name=\"Accession\" Type=\"String\">GSM102847</Item>    " + "       <Item Name=\"Title\" Type=\"String\">Diseased 9</Item>      </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">     " + "     <Item Name=\"Accession\" Type=\"String\">GSM102833</Item>    " + "       <Item Name=\"Title\" Type=\"String\">Control 6</Item>       </Item>      " + "   <Item Name=\"Sample\" Type=\"Structure\">      " + "     <Item Name=\"Accession\" Type=\"String\">GSM102836</Item>     " + "      <Item Name=\"Title\" Type=\"String\">Control 9</Item>       </Item>    " + "     <Item Name=\"Sample\" Type=\"Structure\">     " + "      <Item Name=\"Accession\" Type=\"String\">GSM102839</Item>      " + "     <Item Name=\"Title\" Type=\"String\">Diseased 3</Item>      </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">      " + "     <Item Name=\"Accession\" Type=\"String\">GSM102849</Item>     " + "      <Item Name=\"Title\" Type=\"String\">Diseased 10</Item>         </Item>     " + "    <Item Name=\"Sample\" Type=\"Structure\">     " + "     <Item Name=\"Accession\" Type=\"String\">GSM102852</Item>    " + "       <Item Name=\"Title\" Type=\"String\">Diseased 11</Item>         </Item> " + "    </Item>     <Item Name=\"Relations\" Type=\"List\"></Item> " + " <Item Name=\"n_samples\" Type=\"Integer\">20</Item>  " + "   <Item Name=\"SeriesTitle\" Type=\"String\"></Item> " + " <Item Name=\"PlatformTitle\" Type=\"String\"></Item>   " + " <Item Name=\"PlatformTaxa\" Type=\"String\"></Item>  " + "   <Item Name=\"SamplesTaxa\" Type=\"String\"></Item> " + " <Item Name=\"PubMedIds\" Type=\"List\">   " + "      <Item Name=\"int\" Type=\"Integer\">17244347</Item>     </Item>  " + "   <Item Name=\"Projects\" Type=\"List\"></Item> </DocSum> " + " <DocSum>   <Id>100001708</Id>  <Item Name=\"GDS\" Type=\"String\">2080;2824;3268;3429;3432;3433</Item>   " + "  <Item Name=\"title\" Type=\"String\">Agilent-012391 Whole Human Genome Oligo Microarray G4112A (Feature Number version)</Item> " + " <Item Name=\"summary\" Type=\"String\">This single 44K formatted microarray represents a compiled view of the human genome as it is understood today." + " The sequence information used to design this product was derived from a broad survey of well known sources such as RefSeq, Goldenpath, Ensembl, Unigene and others." + " The resulting view of the human genome covers 41K unique genes and transcripts which have been verified and optimized by alignment to the human genome assembly " + "and by Agilent's Empirical Validation process. Arrays of this design have barcodes that begin with 16012391 or 2512391." + " Orientation: Features are numbered numbered Left-to-Right, Top-to-Bottom as scanned by an Agilent scanner (barcode on the left, DNA on the back surface," + " scanned through the glass), matching the FeatureNum output from Agilent's Feature Extraction software. The ID column represents the Agilent " + "Feature Extraction feature number. Rows and columns are numbered as scanned by an Axon Scanner (barcode on the bottom, DNA on the front surface). To match data scanned on an Axon scanner, " + "use the RefNumber column contained in the Agilent-provided GAL file as the ID_REF column in sample submissions. " + "*** A different version of this platform with the Agilent Probe names in the ID column is assigned accession number GPL6848. Protocol: see manufacturer's web site at http://www.agilent.com/</Item>   " + "  <Item Name=\"GPL\" Type=\"String\">1708</Item> " + " <Item Name=\"GSE\" Type=\"String\">2740;4809;4864;5272;5346;5966;6711;7190;8347;8511;8845;9709;9815;10198;11223;11422;12164;14063;15956;18276;18372;20062;20191;25303;25534;2035;4214;4763;7215;7315;" + "7469;8873;9014;10621;11003;11064;12154;12244;12449;12472;15110;15862;16957;18188;" + "20582;20881;3155;4595;4707;4823;4906;5176;5350;5546;7316;7329;7413;7512;8190;9170;9578;10195;10613;11108;11423;" + "11429;11975;12428;13029;15356;15838;15966;16255;23851;25143;25175;4117;4901;6427;7317;7410;7423;7960;8834;8917;" + "9637;10601;10704;12391;12622;13673;14466;15112;15363;15739;17011;18229;20147;20350;23611;24151;24639</Item>  " + "   <Item Name=\"taxon\" Type=\"String\">Homo sapiens</Item> " + "   <Item Name=\"GSM_L\" Type=\"String\"></Item>    <Item Name=\"GSM_titles_L\" Type=\"String\"></Item>   " + "  <Item Name=\"entryType\" Type=\"String\">GPL</Item>     <Item Name=\"gdsType\" Type=\"String\"></Item> " + " <Item Name=\"ptechType\" Type=\"String\">in situ oligonucleotide</Item>  " + "   <Item Name=\"valType\" Type=\"String\"></Item>  <Item Name=\"SSInfo\" Type=\"String\"></Item> " + "  <Item Name=\"subsetInfo\" Type=\"String\"></Item>   <Item Name=\"PDAT\" Type=\"String\">2004/11/17</Item>   " + "<Item Name=\"suppFile\" Type=\"String\"></Item>     <Item Name=\"Samples\" Type=\"List\"></Item> " + "   <Item Name=\"Relations\" Type=\"List\">         <Item Name=\"Relation\" Type=\"Structure\">     " + "        <Item Name=\"RelationType\" Type=\"String\">Alternative to</Item>      " + "     <Item Name=\"TargetObject\" Type=\"String\">GPL6848</Item>      </Item>     </Item>  " + "   <Item Name=\"n_samples\" Type=\"Integer\">2758</Item>   <Item Name=\"SeriesTitle\" Type=\"String\"></Item> " + " <Item Name=\"PlatformTitle\" Type=\"String\"></Item>    <Item Name=\"PlatformTaxa\" Type=\"String\"></Item>  " + "   <Item Name=\"SamplesTaxa\" Type=\"String\"></Item>  <Item Name=\"PubMedIds\" Type=\"List\"></Item>" + "  <Item Name=\"Projects\" Type=\"List\"></Item> </DocSum>  </eSummaryResult>";
    GeoBrowserServiceImpl serv = new GeoBrowserServiceImpl();
    serv.afterPropertiesSet();
    ArrayDesignService ads = createMock(ArrayDesignService.class);
    ExpressionExperimentService ees = createMock(ExpressionExperimentService.class);
    serv.arrayDesignService = ads;
    serv.expressionExperimentService = ees;
    expect(ads.findByShortName("GPL1708")).andReturn(null);
    expect(ees.findByShortName("GSE4595")).andReturn(null);
    // expect( ads.thawLite( null ) ).andReturn( null );
    replay(ads);
    serv.formatDetails(response);
}
Also used : ExpressionExperimentService(ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentService) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService) Test(org.junit.Test)

Example 2 with ArrayDesignService

use of ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService in project Gemma by PavlidisLab.

the class GeoBrowserServiceParseTest method testParse2.

@Test
public void testParse2() throws Exception {
    try (InputStream is = this.getClass().getResourceAsStream("/data/loader/expression/geo/geo.esummary.test1.xml");
        BufferedReader r = new BufferedReader(new InputStreamReader(is))) {
        String l;
        StringBuilder buf = new StringBuilder();
        while ((l = r.readLine()) != null) {
            buf.append(l);
        }
        String response = buf.toString();
        GeoBrowserServiceImpl serv = new GeoBrowserServiceImpl();
        serv.afterPropertiesSet();
        ArrayDesignService ads = createMock(ArrayDesignService.class);
        ExpressionExperimentService ees = createMock(ExpressionExperimentService.class);
        serv.arrayDesignService = ads;
        serv.expressionExperimentService = ees;
        expect(ads.findByShortName("GPL570")).andReturn(null);
        expect(ees.findByShortName("GSE27128")).andReturn(null);
        replay(ads);
        serv.formatDetails(response);
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) BufferedReader(java.io.BufferedReader) ExpressionExperimentService(ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentService) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService) Test(org.junit.Test)

Example 3 with ArrayDesignService

use of ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService in project Gemma by PavlidisLab.

the class RNASeqDataAddCli method locateArrayDesign.

private ArrayDesign locateArrayDesign(String name) {
    ArrayDesign arrayDesign = null;
    ArrayDesignService arrayDesignService = this.getBean(ArrayDesignService.class);
    Collection<ArrayDesign> byname = arrayDesignService.findByName(name.trim().toUpperCase());
    if (byname.size() > 1) {
        throw new IllegalArgumentException("Ambiguous name: " + name);
    } else if (byname.size() == 1) {
        arrayDesign = byname.iterator().next();
    }
    if (arrayDesign == null) {
        arrayDesign = arrayDesignService.findByShortName(name);
    }
    if (arrayDesign == null) {
        AbstractCLI.log.error("No arrayDesign " + name + " found");
        this.bail(ErrorCode.INVALID_OPTION);
    }
    return arrayDesign;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService)

Example 4 with ArrayDesignService

use of ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService in project Gemma by PavlidisLab.

the class GenericGenelistDesignGenerator method processOptions.

@Override
protected void processOptions() {
    super.processOptions();
    geneService = this.getBean(GeneService.class);
    arrayDesignAnnotationService = this.getBean(ArrayDesignAnnotationService.class);
    TaxonService taxonService = this.getBean(TaxonService.class);
    bioSequenceService = this.getBean(BioSequenceService.class);
    arrayDesignService = this.getBean(ArrayDesignService.class);
    compositeSequenceService = this.getBean(CompositeSequenceService.class);
    annotationAssociationService = this.getBean(AnnotationAssociationService.class);
    externalDatabaseService = this.getBean(ExternalDatabaseService.class);
    arrayDesignReportService = this.getBean(ArrayDesignReportService.class);
    if (this.hasOption('t')) {
        this.taxon = this.setTaxonByName(taxonService);
    }
    if (this.hasOption("ncbiids")) {
        this.useNCBIIds = true;
    } else if (this.hasOption("ensembl")) {
        this.useEnsemblIds = true;
    }
    if (useNCBIIds && useEnsemblIds) {
        throw new IllegalArgumentException("Choose one of ensembl or ncbi ids or gene symbols");
    }
}
Also used : GeneService(ubic.gemma.core.genome.gene.service.GeneService) AnnotationAssociationService(ubic.gemma.persistence.service.genome.sequenceAnalysis.AnnotationAssociationService) ExternalDatabaseService(ubic.gemma.persistence.service.common.description.ExternalDatabaseService) TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService) ArrayDesignAnnotationService(ubic.gemma.core.analysis.service.ArrayDesignAnnotationService) BioSequenceService(ubic.gemma.persistence.service.genome.biosequence.BioSequenceService) CompositeSequenceService(ubic.gemma.persistence.service.expression.designElement.CompositeSequenceService) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService) ArrayDesignReportService(ubic.gemma.core.analysis.report.ArrayDesignReportService)

Example 5 with ArrayDesignService

use of ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService in project Gemma by PavlidisLab.

the class LoadExpressionDataCli method doWork.

@Override
protected Exception doWork(String[] args) {
    Exception err = this.processCommandLine(args);
    if (err != null) {
        return err;
    }
    try {
        GeoService geoService = this.getBean(GeoService.class);
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
        if (accessions == null && accessionFile == null) {
            return new IllegalArgumentException("You must specific either a file or accessions on the command line");
        }
        if (accessions != null) {
            AbstractCLI.log.info("Got accession(s) from command line " + accessions);
            String[] accsToRun = StringUtils.split(accessions, ',');
            for (String accession : accsToRun) {
                accession = StringUtils.strip(accession);
                if (StringUtils.isBlank(accession)) {
                    continue;
                }
                if (platformOnly) {
                    Collection<?> designs = geoService.fetchAndLoad(accession, true, true, false, true, true);
                    ArrayDesignService ads = this.getBean(ArrayDesignService.class);
                    for (Object object : designs) {
                        assert object instanceof ArrayDesign;
                        ArrayDesign ad = (ArrayDesign) object;
                        ad = ads.thawLite(ad);
                        successObjects.add(ad.getName() + " (" + ad.getExternalReferences().iterator().next().getAccession() + ")");
                    }
                } else {
                    this.processAccession(geoService, accession);
                }
            }
        }
        if (accessionFile != null) {
            AbstractCLI.log.info("Loading accessions from " + accessionFile);
            InputStream is = new FileInputStream(accessionFile);
            try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
                String accession;
                while ((accession = br.readLine()) != null) {
                    if (StringUtils.isBlank(accession)) {
                        continue;
                    }
                    this.processAccession(geoService, accession);
                }
            }
        }
        this.summarizeProcessing();
    } catch (Exception e) {
        AbstractCLI.log.error(e);
        return e;
    }
    return null;
}
Also used : InputStreamReader(java.io.InputStreamReader) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) PreprocessingException(ubic.gemma.core.analysis.preprocess.PreprocessingException) FileInputStream(java.io.FileInputStream) GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) GeoService(ubic.gemma.core.loader.expression.geo.service.GeoService) BufferedReader(java.io.BufferedReader) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService)

Aggregations

ArrayDesignService (ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService)7 InputStream (java.io.InputStream)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 Test (org.junit.Test)3 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)3 ExpressionExperimentService (ubic.gemma.persistence.service.expression.experiment.ExpressionExperimentService)3 FileInputStream (java.io.FileInputStream)2 File (java.io.File)1 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)1 LinkAnalysisPersister (ubic.gemma.core.analysis.expression.coexpression.links.LinkAnalysisPersister)1 LinkAnalysisService (ubic.gemma.core.analysis.expression.coexpression.links.LinkAnalysisService)1 PreprocessingException (ubic.gemma.core.analysis.preprocess.PreprocessingException)1 ArrayDesignReportService (ubic.gemma.core.analysis.report.ArrayDesignReportService)1 ArrayDesignAnnotationService (ubic.gemma.core.analysis.service.ArrayDesignAnnotationService)1 GeneService (ubic.gemma.core.genome.gene.service.GeneService)1 GeoDomainObjectGenerator (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator)1 GeoService (ubic.gemma.core.loader.expression.geo.service.GeoService)1 SimpleExpressionDataLoaderService (ubic.gemma.core.loader.expression.simple.SimpleExpressionDataLoaderService)1 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)1