Search in sources :

Example 41 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class BaseExpressionDataMatrix method setMatBioAssayValues.

<R, C, V> void setMatBioAssayValues(AbstractMatrix<R, C, V> mat, Integer rowIndex, V[] vals, Collection<BioAssay> bioAssays, Iterator<BioAssay> it) {
    for (int j = 0; j < bioAssays.size(); j++) {
        BioAssay bioAssay = it.next();
        Integer column = this.columnAssayMap.get(bioAssay);
        assert column != null;
        mat.set(rowIndex, column, vals[j]);
    }
}
Also used : BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 42 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class BaseExpressionDataMatrix method columns.

@Override
public int columns(CompositeSequence el) {
    int j = 0;
    ArrayDesign ad = el.getArrayDesign();
    for (int i = 0; i < this.columns(); i++) {
        Collection<BioAssay> bioAssay = this.columnBioAssayMapByInteger.get(i);
        for (BioAssay assay : bioAssay) {
            if (assay.getArrayDesignUsed().equals(ad)) {
                j++;
                break;
            }
        }
    }
    return j;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 43 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class ExpressionExperimentDeleteTest method testRemove.

@Test
public final void testRemove() {
    ExpressionExperiment ee = getTestPersistentCompleteExpressionExperiment(false);
    List<Long> ids = new ArrayList<>();
    for (BioAssay ba : ee.getBioAssays()) {
        ids.add(ba.getId());
    }
    svc.remove(ee);
    assertNull(svc.load(ee.getId()));
    // sure bioassays are gone.
    for (Long id : ids) {
        BioAssay ba = bioAssayService.load(id);
        assertNull(ba);
    }
}
Also used : ArrayList(java.util.ArrayList) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Test(org.junit.Test)

Example 44 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class ExpressionExperimentPlatformSwitchService method doMultiSample.

private BioAssayDimension doMultiSample(ExpressionExperiment ee, Collection<BioAssayDimension> unusedBADs, int maxSize) {
    BioAssayDimension maxBAD = null;
    for (BioAssay ba : ee.getBioAssays()) {
        Collection<BioAssayDimension> oldBioAssayDims = bioAssayService.findBioAssayDimensions(ba);
        for (BioAssayDimension bioAssayDim : oldBioAssayDims) {
            unusedBADs.add(bioAssayDim);
            int size = bioAssayDim.getBioAssays().size();
            if (size > maxSize) {
                maxSize = size;
                maxBAD = bioAssayDim;
            }
        }
    }
    // otherwise we shouldn't be here.
    assert unusedBADs.size() > 1;
    unusedBADs.remove(maxBAD);
    /*
         * Make sure all biomaterials in the study are included in the chosen bioassaydimension. If not, we'd have
         * to make a new BAD. I haven't implemented that case.
         */
    if (maxBAD != null) {
        Collection<BioMaterial> bmsInmaxBAD = new HashSet<>();
        for (BioAssay ba : maxBAD.getBioAssays()) {
            bmsInmaxBAD.add(ba.getSampleUsed());
        }
        for (BioAssay ba : ee.getBioAssays()) {
            if (!bmsInmaxBAD.contains(ba.getSampleUsed())) {
                ExpressionExperimentPlatformSwitchService.log.warn("This experiment looked like it had samples run on more than one platform, " + "but it also has no BioAssayDimension that is eligible to accomodate all samples (Example: " + ba.getSampleUsed() + ") The experiment will be switched to the merged platform, but no BioAssayDimension switch will be done.");
                maxBAD = null;
                break;
            }
        }
    }
    return maxBAD;
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 45 with BioAssay

use of ubic.gemma.model.expression.bioAssay.BioAssay in project Gemma by PavlidisLab.

the class GeoServiceImpl method updateReports.

private void updateReports(Collection<?> entities) {
    Collection<ArrayDesign> adsToUpdate = new HashSet<>();
    for (Object entity : entities) {
        if (entity instanceof ExpressionExperiment) {
            ExpressionExperiment expressionExperiment = (ExpressionExperiment) entity;
            expressionExperiment = this.expressionExperimentService.thaw(expressionExperiment);
            this.expressionExperimentReportService.generateSummary(expressionExperiment.getId());
            expressionExperiment = this.expressionExperimentService.thaw(expressionExperiment);
            for (BioAssay ba : expressionExperiment.getBioAssays()) {
                adsToUpdate.add(ba.getArrayDesignUsed());
            }
        } else if (entity instanceof ArrayDesign) {
            adsToUpdate.add((ArrayDesign) entity);
        }
    }
    for (ArrayDesign arrayDesign : adsToUpdate) {
        this.arrayDesignReportService.generateArrayDesignReport(arrayDesign.getId());
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Aggregations

BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)144 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)67 Test (org.junit.Test)29 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)29 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)24 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)20 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)18 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)16 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)15 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)14 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)14 InputStream (java.io.InputStream)11 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)10 HashSet (java.util.HashSet)9 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)8 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)8 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ModelAndView (org.springframework.web.servlet.ModelAndView)7 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)7