use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class ProcessedExpressionDataVectorDaoImpl method isTwoChannel.
/**
* @param expressionExperiment ee
* @return true if any platform used by the ee is two-channel
*/
private boolean isTwoChannel(ExpressionExperiment expressionExperiment) {
boolean isTwoChannel = false;
Collection<ArrayDesign> arrayDesignsUsed = CommonQueries.getArrayDesignsUsed(expressionExperiment, this.getSessionFactory().getCurrentSession());
for (ArrayDesign ad : arrayDesignsUsed) {
TechnologyType technologyType = ad.getTechnologyType();
if (technologyType == null) {
throw new IllegalStateException("Array designs must have a technology type assigned before processed vector computation");
}
if (!technologyType.equals(TechnologyType.ONECOLOR) && !technologyType.equals(TechnologyType.NONE)) {
isTwoChannel = true;
}
}
return isTwoChannel;
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class CompositeSequenceServiceImpl method findByNamesInArrayDesigns.
/**
* Checks to see if the CompositeSequence exists in any of the array designs. If so, it is internally stored in the
* collection of composite sequences as a HashSet, preserving order based on insertion.
*/
@Override
public Collection<CompositeSequence> findByNamesInArrayDesigns(Collection<String> compositeSequenceNames, Collection<ArrayDesign> arrayDesigns) {
LinkedHashMap<String, CompositeSequence> compositeSequencesMap = new LinkedHashMap<>();
for (ArrayDesign arrayDesign : arrayDesigns) {
for (Object obj : compositeSequenceNames) {
String name = (String) obj;
name = StringUtils.trim(name);
AbstractService.log.debug("entered: " + name);
CompositeSequence cs = this.findByName(arrayDesign, name);
if (cs != null && !compositeSequencesMap.containsKey(cs.getName())) {
compositeSequencesMap.put(cs.getName(), cs);
} else {
AbstractService.log.warn("Composite sequence " + name + " does not exist. Discarding ... ");
}
}
}
if (compositeSequencesMap.isEmpty())
return null;
return compositeSequencesMap.values();
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class ArrayDesignDaoImpl method putIdsInListCheckMerger.
private void putIdsInListCheckMerger(Map<Long, Boolean> eventMap, List<Object[]> list) {
for (Object[] o : list) {
Long id = (Long) o[0];
ArrayDesign merger = (ArrayDesign) o[1];
if (merger != null) {
eventMap.put(id, Boolean.TRUE);
}
}
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class ArrayDesignDaoImpl method getBioSequences.
@Override
public Map<CompositeSequence, BioSequence> getBioSequences(ArrayDesign arrayDesign) {
if (arrayDesign.getId() == null) {
throw new IllegalArgumentException("Cannot fetch sequences for a non-persistent array design");
}
StopWatch timer = new StopWatch();
timer.start();
String queryString = "select ad from ArrayDesign ad inner join fetch ad.compositeSequences cs " + "left outer join fetch cs.biologicalCharacteristic bs where ad = :ad";
// have to include ad in the select to be able to use fetch join
Query query = this.getSessionFactory().getCurrentSession().createQuery(queryString).setParameter("ad", arrayDesign);
List result = query.list();
Map<CompositeSequence, BioSequence> bioSequences = new HashMap<>();
if (result.isEmpty()) {
return bioSequences;
}
for (CompositeSequence cs : ((ArrayDesign) result.get(0)).getCompositeSequences()) {
bioSequences.put(cs, cs.getBiologicalCharacteristic());
}
if (timer.getTime() > 1000) {
AbstractDao.log.info("Fetch sequences: " + timer.getTime() + "ms");
}
return bioSequences;
}
use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.
the class ArrayDesignServiceImpl method getMostRecentEvents.
private void getMostRecentEvents(Map<Long, Collection<AuditEvent>> eventMap, Map<Long, AuditEvent> lastEventMap, Set<Long> aaIds, Class<? extends ArrayDesignAnalysisEvent> eventclass) {
for (Long arrayDesignId : aaIds) {
Collection<AuditEvent> events = eventMap.get(arrayDesignId);
AuditEvent lastEvent;
if (events == null) {
lastEventMap.put(arrayDesignId, null);
} else {
ArrayDesign ad = this.load(arrayDesignId);
lastEvent = this.auditEventDao.getLastEvent(ad, eventclass);
lastEventMap.put(arrayDesignId, lastEvent);
}
/*
* Check if the subsuming or merged array (if any) was updated more recently. To do this: 1) load the AA; 2)
* check for merged; check for subsumed; check events for those.
*/
ArrayDesign arrayDesign = this.load(arrayDesignId);
if (arrayDesign.getSubsumingArrayDesign() != null) {
ArrayDesign subsumedInto = arrayDesign.getSubsumingArrayDesign();
this.checkForMoreRecentMethod(lastEventMap, eventclass, arrayDesignId, subsumedInto);
}
if (arrayDesign.getMergedInto() != null) {
ArrayDesign mergedInto = arrayDesign.getMergedInto();
this.checkForMoreRecentMethod(lastEventMap, eventclass, arrayDesignId, mergedInto);
}
}
}
Aggregations