Search in sources :

Example 71 with ArrayDesign

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;
}
Also used : TechnologyType(ubic.gemma.model.expression.arrayDesign.TechnologyType) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign)

Example 72 with ArrayDesign

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();
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) BioSequenceValueObject(ubic.gemma.model.genome.sequenceAnalysis.BioSequenceValueObject) BlatResultValueObject(ubic.gemma.model.genome.sequenceAnalysis.BlatResultValueObject) CompositeSequenceValueObject(ubic.gemma.model.expression.designElement.CompositeSequenceValueObject) GeneProductValueObject(ubic.gemma.model.genome.gene.GeneProductValueObject) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence)

Example 73 with ArrayDesign

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);
        }
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ArrayDesignValueObject(ubic.gemma.model.expression.arrayDesign.ArrayDesignValueObject)

Example 74 with ArrayDesign

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;
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 75 with ArrayDesign

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);
        }
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) AuditEvent(ubic.gemma.model.common.auditAndSecurity.AuditEvent)

Aggregations

ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)186 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)43 Test (org.junit.Test)32 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)26 InputStream (java.io.InputStream)25 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)24 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)24 Taxon (ubic.gemma.model.genome.Taxon)23 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)19 HashSet (java.util.HashSet)16 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)16 Collection (java.util.Collection)14 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)13 StopWatch (org.apache.commons.lang3.time.StopWatch)12 Before (org.junit.Before)12 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)12 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)9 GZIPInputStream (java.util.zip.GZIPInputStream)8 SimpleExpressionExperimentMetaData (ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData)8 File (java.io.File)7