use of ubic.gemma.core.externalDb.GoldenPathSequenceAnalysis in project Gemma by PavlidisLab.
the class ProbeMapperTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
tester = new ArrayList<>();
tester.add(400d);
tester.add(200d);
tester.add(100d);
tester.add(50d);
try (InputStream is = this.getClass().getResourceAsStream("/data/loader/genome/col8a1.blatresults.txt")) {
BlatResultParser brp = new BlatResultParser();
Taxon m = Taxon.Factory.newInstance();
m.setCommonName("mouse");
brp.setTaxon(m);
brp.parse(is);
blatres = brp.getResults();
assert blatres != null && blatres.size() > 0;
}
String databaseHost = Settings.getString("gemma.testdb.host");
String databaseUser = Settings.getString("gemma.testdb.user");
String databasePassword = Settings.getString("gemma.testdb.password");
mousegp = new GoldenPathSequenceAnalysis(3306, Settings.getString("gemma.goldenpath.db.mouse"), databaseHost, databaseUser, databasePassword);
humangp = new GoldenPathSequenceAnalysis(3306, Settings.getString("gemma.goldenpath.db.human"), databaseHost, databaseUser, databasePassword);
}
use of ubic.gemma.core.externalDb.GoldenPathSequenceAnalysis in project Gemma by PavlidisLab.
the class ArrayDesignProbeMapperServiceImpl method processArrayDesign.
@Override
public void processArrayDesign(ArrayDesign arrayDesign, ProbeMapperConfig config, boolean useDB) {
assert config != null;
if (arrayDesign.getTechnologyType().equals(TechnologyType.NONE)) {
throw new IllegalArgumentException("Do not use this service to process platforms that do not use an probe-based technology.");
}
Collection<Taxon> taxa = arrayDesignService.getTaxa(arrayDesign.getId());
Taxon taxon = arrayDesign.getPrimaryTaxon();
if (taxa.size() > 1 && taxon == null) {
throw new IllegalArgumentException("Array design has sequence from multiple taxa and has no primary taxon set: " + arrayDesign);
}
GoldenPathSequenceAnalysis goldenPathDb = new GoldenPathSequenceAnalysis(taxon);
BlockingQueue<BACS> persistingQueue = new ArrayBlockingQueue<>(ArrayDesignProbeMapperServiceImpl.QUEUE_SIZE);
AtomicBoolean generatorDone = new AtomicBoolean(false);
AtomicBoolean loaderDone = new AtomicBoolean(false);
this.load(persistingQueue, generatorDone, loaderDone, useDB);
if (useDB) {
ArrayDesignProbeMapperServiceImpl.log.info("Removing any old associations");
arrayDesignService.deleteGeneProductAssociations(arrayDesign);
}
int count = 0;
int hits = 0;
ArrayDesignProbeMapperServiceImpl.log.info("Start processing " + arrayDesign.getCompositeSequences().size() + " probes ...");
for (CompositeSequence compositeSequence : arrayDesign.getCompositeSequences()) {
if (compositeSequence.getName().equals("1431126_a_at")) {
ArrayDesignProbeMapperServiceImpl.log.debug("HERE");
}
Map<String, Collection<BlatAssociation>> results = this.processCompositeSequence(config, taxon, goldenPathDb, compositeSequence);
if (results == null)
continue;
for (Collection<BlatAssociation> col : results.values()) {
for (BlatAssociation association : col) {
if (ArrayDesignProbeMapperServiceImpl.log.isDebugEnabled())
ArrayDesignProbeMapperServiceImpl.log.debug(association);
persistingQueue.add(new BACS(compositeSequence, association));
}
++hits;
}
if (++count % 200 == 0) {
ArrayDesignProbeMapperServiceImpl.log.info("Processed " + count + " composite sequences" + " with blat results; " + hits + " mappings found.");
}
}
generatorDone.set(true);
ArrayDesignProbeMapperServiceImpl.log.info("Waiting for loading to complete ...");
while (!loaderDone.get()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
ArrayDesignProbeMapperServiceImpl.log.info("Processed " + count + " composite sequences with blat results; " + hits + " mappings found.");
arrayDesignReportService.generateArrayDesignReport(arrayDesign.getId());
this.deleteOldFiles(arrayDesign);
}
use of ubic.gemma.core.externalDb.GoldenPathSequenceAnalysis in project Gemma by PavlidisLab.
the class ArrayDesignProbeMapperServiceImpl method processCompositeSequence.
@Override
@Transactional
public Map<String, Collection<BlatAssociation>> processCompositeSequence(ProbeMapperConfig config, Taxon taxon, GoldenPathSequenceAnalysis goldenPathDb, CompositeSequence compositeSequence) {
BioSequence bs = compositeSequence.getBiologicalCharacteristic();
if (bs == null)
return null;
/*
* It isn't 100% clear what the right thing to do is. But this seems at least _reasonable_ when there is a
* mismatch
*/
if (taxon != null && !bs.getTaxon().equals(taxon)) {
return null;
}
GoldenPathSequenceAnalysis db;
if (goldenPathDb == null) {
db = new GoldenPathSequenceAnalysis(bs.getTaxon());
} else {
db = goldenPathDb;
}
final Collection<BlatResult> blatResults = blatResultService.findByBioSequence(bs);
ProbeMapUtils.removeDuplicates(blatResults);
if (blatResults.isEmpty())
return null;
return probeMapper.processBlatResults(db, blatResults, config);
}
Aggregations