use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ExpressionExperimentServiceTest method testGetRawExpressionDataVectors.
@Test
public final void testGetRawExpressionDataVectors() {
ExpressionExperiment eel = this.getTestPersistentCompleteExpressionExperiment(false);
Collection<CompositeSequence> designElements = new HashSet<>();
QuantitationType quantitationType = eel.getRawExpressionDataVectors().iterator().next().getQuantitationType();
Collection<RawExpressionDataVector> allv = eel.getRawExpressionDataVectors();
assertNotNull(quantitationType);
assertTrue(allv.size() > 1);
for (RawExpressionDataVector anAllv : allv) {
CompositeSequence designElement = anAllv.getDesignElement();
assertNotNull(designElement);
designElements.add(designElement);
if (designElements.size() == 2)
break;
}
assertEquals(2, designElements.size());
Collection<? extends DesignElementDataVector> vectors = rawExpressionDataVectorService.find(designElements, quantitationType);
assertEquals(2, vectors.size());
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method testThaw.
@Test
public void testThaw() {
ad = super.getTestPersistentArrayDesign(5, true);
ad = arrayDesignService.load(ad.getId());
ad = arrayDesignService.thaw(ad);
// make sure we can do this...
// noinspection ResultOfMethodCallIgnored
ad.getPrimaryTaxon().equals(this.taxonService.load(1L));
auditTrailService.addUpdateEvent(ad, "testing");
for (CompositeSequence cs : ad.getCompositeSequences()) {
// noinspection ResultOfMethodCallIgnored
cs.getBiologicalCharacteristic().getName();
}
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method testCascadeCreateCompositeSequences.
@Test
public void testCascadeCreateCompositeSequences() {
ad = (ArrayDesign) persisterHelper.persist(ad);
ad = arrayDesignService.find(ad);
ad = arrayDesignService.thaw(ad);
CompositeSequence cs = ad.getCompositeSequences().iterator().next();
assertNotNull(cs.getId());
assertNotNull(cs.getArrayDesign().getId());
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ArrayDesignServiceTest method testDelete.
@Test
public void testDelete() {
ad = (ArrayDesign) persisterHelper.persist(ad);
Collection<CompositeSequence> seqs = ad.getCompositeSequences();
Collection<Long> seqIds = new ArrayList<>();
for (CompositeSequence seq : seqs) {
if (seq.getId() == null) {
// why?
continue;
}
seqIds.add(seq.getId());
}
// just a wrinkle to this test -- ensure ACLs are there
securityService.isPublic(ad);
arrayDesignService.remove(ad);
ad = null;
for (Long id : seqIds) {
try {
CompositeSequence cs = compositeSequenceService.load(id);
if (cs != null)
fail(cs + " was still in the system");
} catch (HibernateObjectRetrievalFailureException e) {
// ok
}
}
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ExpressionExperimentPlatformSwitchService method processVector.
/**
* @param designElementMap Mapping of sequences to probes for the platform that is being switch from. This is used
* to identify new candidates.
* @param usedDesignElements probes from the new design that have already been assigned to probes from the old
* design. If things are done correctly (the old design was merged into the new) then there should be enough.
* Map is of the new design probe to the old design probe it was used for (this is debugging information)
* @param vector vector
* @param bad BioAssayDimension to use, if necessary. If this is null or already the one used, it's igored.
* Otherwise the vector data will be rewritten to match it.
* @throws IllegalStateException if there is no (unused) design element matching the vector's biosequence
*/
private void processVector(Map<BioSequence, Collection<CompositeSequence>> designElementMap, Map<CompositeSequence, Collection<BioAssayDimension>> usedDesignElements, DesignElementDataVector vector, BioAssayDimension bad) {
CompositeSequence oldDe = vector.getDesignElement();
Collection<CompositeSequence> newElCandidates;
BioSequence seq = oldDe.getBiologicalCharacteristic();
if (seq == null) {
newElCandidates = designElementMap.get(ExpressionExperimentPlatformSwitchService.NULL_BIOSEQUENCE);
} else {
newElCandidates = designElementMap.get(seq);
}
if (newElCandidates == null || newElCandidates.isEmpty()) {
throw new IllegalStateException("There are no candidates probes for sequence: " + seq + "('null' should be okay)");
}
for (CompositeSequence newEl : newElCandidates) {
if (!usedDesignElements.containsKey(newEl)) {
vector.setDesignElement(newEl);
usedDesignElements.put(newEl, new HashSet<BioAssayDimension>());
usedDesignElements.get(newEl).add(vector.getBioAssayDimension());
break;
}
if (!usedDesignElements.get(newEl).contains(vector.getBioAssayDimension())) {
/*
* Then it's okay to use it.
*/
vector.setDesignElement(newEl);
usedDesignElements.get(newEl).add(vector.getBioAssayDimension());
break;
}
}
if (bad != null && !vector.getBioAssayDimension().equals(bad)) {
/*
* 1. Check if they are already the same; then just switch it to the desired BAD
* 2. If not, then the vector data has to be rewritten.
*/
this.vectorReWrite(vector, bad);
}
}
Aggregations