Search in sources :

Example 1 with DatabaseEntry

use of ubic.gemma.model.common.description.DatabaseEntry in project Gemma by PavlidisLab.

the class ExternalDatabaseUtils method getGenbankAccession.

/**
 * @param accession in the form XXXXXX or XXXXX.N where N is a version number. The first part becomes the accession,
 *                  the second the version
 * @return a DatabaseEntry representing the genbank accession.
 */
public static DatabaseEntry getGenbankAccession(String accession) {
    DatabaseEntry dbEntry = DatabaseEntry.Factory.newInstance();
    String[] split = accession.split("\\.");
    dbEntry.setAccession(split[0]);
    if (split.length == 2)
        dbEntry.setAccessionVersion(split[1]);
    dbEntry.setExternalDatabase(ExternalDatabaseUtils.getGenbank());
    return dbEntry;
}
Also used : DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry)

Example 2 with DatabaseEntry

use of ubic.gemma.model.common.description.DatabaseEntry in project Gemma by PavlidisLab.

the class MockFastaCmd method makeSequence.

private BioSequence makeSequence(Object object) {
    BioSequence result = BioSequence.Factory.newInstance(taxon);
    result.setName(object.toString());
    result.setLength(100L);
    result.setPolymerType(PolymerType.DNA);
    result.setIsApproximateLength(false);
    result.setIsCircular(false);
    result.setFractionRepeats(0.0);
    result.setSequence(RandomStringUtils.random(100, "ATGC"));
    DatabaseEntry genbank = ExternalDatabaseUtils.getGenbankAccession(object.toString());
    result.setSequenceDatabaseEntry(genbank);
    return result;
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry)

Example 3 with DatabaseEntry

use of ubic.gemma.model.common.description.DatabaseEntry in project Gemma by PavlidisLab.

the class BatchInfoParser method getAccessionToBioAssayMap.

private Map<String, BioAssay> getAccessionToBioAssayMap(ExpressionExperiment ee) {
    Map<String, BioAssay> assayAccessions = new HashMap<>();
    for (BioAssay ba : ee.getBioAssays()) {
        DatabaseEntry accession = ba.getAccession();
        if (StringUtils.isBlank(accession.getAccession())) {
            throw new IllegalStateException("Must have accession for each bioassay to get batch information from source for " + ee.getShortName());
        }
        assayAccessions.put(accession.getAccession(), ba);
    }
    return assayAccessions;
}
Also used : DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 4 with DatabaseEntry

use of ubic.gemma.model.common.description.DatabaseEntry in project Gemma by PavlidisLab.

the class ExpressionExperimentBibRefFinderTest method testLocatePrimaryReference.

@Test
public void testLocatePrimaryReference() throws Exception {
    ExpressionExperimentBibRefFinder finder = new ExpressionExperimentBibRefFinder();
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    ExternalDatabase ed = ExternalDatabase.Factory.newInstance();
    ed.setName("GEO");
    de.setAccession("GSE3023");
    de.setExternalDatabase(ed);
    ee.setAccession(de);
    try {
        BibliographicReference bibref = null;
        for (int i = 0; i < 3; i++) {
            bibref = finder.locatePrimaryReference(ee);
            if (bibref != null)
                break;
            Thread.sleep(1000);
        }
        assertNotNull(bibref);
        assertEquals("Differential gene expression in anatomical compartments of the human eye.", bibref.getTitle());
    } catch (Exception e) {
        checkCause(e);
    }
}
Also used : ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) IOException(java.io.IOException) Test(org.junit.Test)

Example 5 with DatabaseEntry

use of ubic.gemma.model.common.description.DatabaseEntry in project Gemma by PavlidisLab.

the class ExpressionExperimentBibRefFinderTest method testLocatePrimaryReferenceInvalidGSE.

@Test
public void testLocatePrimaryReferenceInvalidGSE() throws Exception {
    ExpressionExperimentBibRefFinder finder = new ExpressionExperimentBibRefFinder();
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    ExternalDatabase ed = ExternalDatabase.Factory.newInstance();
    ed.setName("GEO");
    de.setAccession("GSE30231111111111111");
    de.setExternalDatabase(ed);
    ee.setAccession(de);
    try {
        BibliographicReference bibref = finder.locatePrimaryReference(ee);
        assert (bibref == null);
    } catch (Exception e) {
        checkCause(e);
    }
}
Also used : ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)37 ExternalDatabase (ubic.gemma.model.common.description.ExternalDatabase)11 GeneProduct (ubic.gemma.model.genome.gene.GeneProduct)8 HashSet (java.util.HashSet)6 Test (org.junit.Test)6 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)6 Gene (ubic.gemma.model.genome.Gene)6 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)6 Taxon (ubic.gemma.model.genome.Taxon)5 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)4 BioSequence2GeneProduct (ubic.gemma.model.association.BioSequence2GeneProduct)4 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)4 HashMap (java.util.HashMap)3 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)3 AnnotationAssociation (ubic.gemma.model.genome.sequenceAnalysis.AnnotationAssociation)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)2 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)2