use of ubic.gemma.core.loader.expression.geo.service.GeoService in project Gemma by PavlidisLab.
the class ArrayDesignSequenceProcessorTest method testFetchAndLoadWithIdentifiers.
@Test
public void testFetchAndLoadWithIdentifiers() throws Exception {
String fastacmdExe = Settings.getString(SimpleFastaCmd.FASTA_CMD_ENV_VAR);
if (fastacmdExe == null) {
log.warn("No fastacmd executable is configured, skipping test");
return;
}
File fi = new File(fastacmdExe);
if (!fi.canRead()) {
log.warn(fastacmdExe + " not found, skipping test");
return;
}
GeoService geoService = this.getBean(GeoService.class);
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
@SuppressWarnings("unchecked") final Collection<ArrayDesign> ads = (Collection<ArrayDesign>) geoService.fetchAndLoad("GPL226", true, true, false, true, true);
result = ads.iterator().next();
result = arrayDesignService.thaw(result);
// have to specify taxon as this has two taxons in it
try (InputStream f = this.getClass().getResourceAsStream("/data/loader/expression/arrayDesign/identifierTest.txt")) {
Collection<BioSequence> res = app.processArrayDesign(result, f, new String[] { "testblastdb", "testblastdbPartTwo" }, FileTools.resourceToPath("/data/loader/genome/blast"), taxon, true);
assertNotNull(res);
for (BioSequence sequence : res) {
assertNotNull(sequence.getSequence());
}
for (CompositeSequence cs : result.getCompositeSequences()) {
assert cs.getBiologicalCharacteristic() != null;
}
}
}
use of ubic.gemma.core.loader.expression.geo.service.GeoService 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;
}
use of ubic.gemma.core.loader.expression.geo.service.GeoService in project Gemma by PavlidisLab.
the class ArrayDesignSequenceProcessorTest method testFetchAndLoadWithSequences.
@Test
public void testFetchAndLoadWithSequences() throws Exception {
GeoService geoService = this.getBean(GeoService.class);
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
@SuppressWarnings("unchecked") final Collection<ArrayDesign> ads = (Collection<ArrayDesign>) geoService.fetchAndLoad("GPL226", true, true, false);
result = ads.iterator().next();
result = arrayDesignService.thaw(result);
try {
Collection<BioSequence> res = app.processArrayDesign(result, new String[] { "testblastdb", "testblastdbPartTwo" }, FileTools.resourceToPath("/data/loader/genome/blast"), false);
assertNotNull(res);
for (BioSequence sequence : res) {
assertNotNull(sequence.getSequence());
}
} catch (Exception e) {
if (StringUtils.isNotBlank(e.getMessage()) && e.getMessage().contains("not found")) {
log.error("fastacmd is not installed or is misconfigured. Test skipped");
return;
}
throw e;
}
}
use of ubic.gemma.core.loader.expression.geo.service.GeoService in project Gemma by PavlidisLab.
the class AbstractArrayDesignProcessingTest method setupArrayDesign.
@Before
public void setupArrayDesign() {
ad = arrayDesignService.findByShortName(AbstractArrayDesignProcessingTest.ACCESSION);
if (ad == null) {
// first load small twoc-color
GeoService geoService = this.getBean(GeoService.class);
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
try {
@SuppressWarnings("unchecked") final Collection<ArrayDesign> ads = (Collection<ArrayDesign>) geoService.fetchAndLoad(AbstractArrayDesignProcessingTest.ACCESSION, true, true, false, true, true);
ad = ads.iterator().next();
} catch (Exception e) {
if (e.getCause() instanceof FileNotFoundException) {
log.warn("problem with initializing array design for test: " + e.getCause().getMessage());
return;
}
throw e;
}
}
ad = arrayDesignService.thaw(ad);
}
Aggregations