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;
}
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;
}
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;
}
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);
}
}
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);
}
}
Aggregations