Search in sources :

Example 1 with BioAssay

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

the class CuratableValueObjectTest method setUp.

@Before
public void setUp() throws Exception {
    arrayDesign = ArrayDesign.Factory.newInstance();
    arrayDesign.setName("testing audit " + RandomStringUtils.randomAlphanumeric(32));
    arrayDesign.setShortName(RandomStringUtils.randomAlphanumeric(8));
    arrayDesign.setPrimaryTaxon(this.getTaxon("human"));
    arrayDesign = (ArrayDesign) this.persisterHelper.persist(arrayDesign);
    assertTrue(arrayDesign.getAuditTrail() != null);
    Taxon taxon = Taxon.Factory.newInstance("text taxon scientific name " + RandomStringUtils.randomAlphanumeric(8), RandomStringUtils.randomAlphanumeric(8), "ttxn", 0, false, true);
    this.persisterHelper.persist(taxon);
    BioMaterial bm = BioMaterial.Factory.newInstance();
    bm.setName(RandomStringUtils.randomAlphanumeric(8));
    bm.setSourceTaxon(taxon);
    this.persisterHelper.persist(bm);
    BioAssay bioAssay = BioAssay.Factory.newInstance();
    bioAssay.setArrayDesignUsed(arrayDesign);
    bioAssay.setSampleUsed(bm);
    this.persisterHelper.persist(bioAssay);
    ExperimentalDesign ed = ExperimentalDesign.Factory.newInstance();
    ed.setName(RandomStringUtils.randomAlphanumeric(8));
    expressionExperiment = super.getTestPersistentBasicExpressionExperiment();
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) ExperimentalDesign(ubic.gemma.model.expression.experiment.ExperimentalDesign) Taxon(ubic.gemma.model.genome.Taxon) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) Before(org.junit.Before)

Example 2 with BioAssay

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

the class ArrayDesignControllerImpl method delete.

@Override
@RequestMapping("/deleteArrayDesign.html")
public ModelAndView delete(HttpServletRequest request, HttpServletResponse response) {
    String stringId = request.getParameter("id");
    if (stringId == null) {
        // should be a validation error.
        throw new EntityNotFoundException("Must provide an id");
    }
    Long id;
    try {
        id = Long.parseLong(stringId);
    } catch (NumberFormatException e) {
        throw new EntityNotFoundException("Identifier was invalid");
    }
    ArrayDesign arrayDesign = arrayDesignService.load(id);
    if (arrayDesign == null) {
        throw new EntityNotFoundException("Platform with id=" + id + " not found");
    }
    // check that no EE depend on the arraydesign we want to remove
    // Do this by checking if there are any bioassays that depend this AD
    Collection<BioAssay> assays = arrayDesignService.getAllAssociatedBioAssays(id);
    if (assays.size() != 0) {
        return new ModelAndView(new RedirectView("/arrays/showAllArrayDesigns.html", true)).addObject("message", "Array  " + arrayDesign.getName() + " can't be deleted. Dataset has a dependency on this Array.");
    }
    String taskId = taskRunningService.submitLocalTask(new TaskCommand(arrayDesign.getId()));
    return new ModelAndView().addObject("taskId", taskId);
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ModelAndView(org.springframework.web.servlet.ModelAndView) RedirectView(org.springframework.web.servlet.view.RedirectView) EntityNotFoundException(ubic.gemma.web.util.EntityNotFoundException) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) TaskCommand(ubic.gemma.core.job.TaskCommand) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with BioAssay

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

the class PersistentDummyObjectHelper method getTestNonPersistentBioAssay.

private BioAssay getTestNonPersistentBioAssay(ArrayDesign ad, BioMaterial bm) {
    BioAssay ba = ubic.gemma.model.expression.bioAssay.BioAssay.Factory.newInstance();
    ba.setName(RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH) + "_testbioassay");
    ba.setSampleUsed(bm);
    ba.setArrayDesignUsed(ad);
    ba.setIsOutlier(false);
    ba.setSequencePairedReads(false);
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    de.setExternalDatabase(PersistentDummyObjectHelper.geo);
    de.setAccession(ba.getName());
    ba.setAccession(de);
    LocalFile file = LocalFile.Factory.newInstance();
    try {
        file.setLocalURL(new URL("file:///tmp/" + ba.getName()));
    } catch (MalformedURLException e) {
        log.error("Malformed URL");
    }
    ba.setRawDataFile(file);
    LocalFile fileb = LocalFile.Factory.newInstance();
    try {
        fileb.setLocalURL(new URL("file:///tmp/raw" + ba.getName()));
    } catch (MalformedURLException e) {
        log.error("Malformed URL");
    }
    ba.setRawDataFile(file);
    ba.getDerivedDataFiles().add(fileb);
    return ba;
}
Also used : MalformedURLException(java.net.MalformedURLException) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) URL(java.net.URL)

Example 4 with BioAssay

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

the class PersistentDummyObjectHelper method getBioAssays.

private List<BioAssay> getBioAssays(Collection<BioMaterial> bioMaterials, ArrayDesign ad) {
    List<BioAssay> baCol = new ArrayList<>();
    for (BioMaterial bm : bioMaterials) {
        BioAssay ba = this.getTestNonPersistentBioAssay(ad, bm);
        bm.getBioAssaysUsedIn().add(ba);
        baCol.add(ba);
    }
    return baCol;
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 5 with BioAssay

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

the class PersistentDummyObjectHelper method getTestExpressionExperimentWithAllDependencies.

public ExpressionExperiment getTestExpressionExperimentWithAllDependencies(ExpressionExperiment prototype) {
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    ee.setShortName(RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
    ee.setName("Expression Experiment " + RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
    ee.setDescription("A test expression experiment");
    ee.setSource("https://www.ncbi.nlm.nih.gov/geo/");
    DatabaseEntry de1 = this.getTestPersistentDatabaseEntry(PersistentDummyObjectHelper.geo);
    ee.setAccession(de1);
    LocalFile file = LocalFile.Factory.newInstance();
    try {
        file.setLocalURL(new URL("file:///just/a/placeholder/" + ee.getShortName()));
    } catch (MalformedURLException e) {
        log.error("Malformed URL");
    }
    ee.setRawDataFile(file);
    Collection<FactorValue> allFactorValues = new HashSet<>();
    ExperimentalDesign ed = this.getExperimentalDesign(allFactorValues);
    Collection<BioMaterial> bioMaterials = this.getBioMaterials(allFactorValues);
    ee.setExperimentalDesign(ed);
    ee.setOwner(this.getTestPersistentContact());
    List<ArrayDesign> arrayDesignsUsed = new ArrayList<>(eeService.getArrayDesignsUsed(prototype));
    Collection<BioAssay> bioAssays = new HashSet<>();
    Collection<QuantitationType> quantitationTypes = this.addQuantitationTypes(new HashSet<QuantitationType>());
    eeService.thaw(prototype);
    Collection<RawExpressionDataVector> vectors = new HashSet<>();
    for (ArrayDesign ad : arrayDesignsUsed) {
        List<BioAssay> bas = this.getBioAssays(bioMaterials, ad);
        bioAssays.addAll(bas);
        ad = this.adService.thaw(ad);
        vectors.addAll(this.getDesignElementDataVectors(ee, quantitationTypes, bas, ad));
    }
    ee.setBioAssays(bioAssays);
    assert quantitationTypes.size() > 0;
    ee.setQuantitationTypes(quantitationTypes);
    ee.setRawExpressionDataVectors(vectors);
    ArrayDesignsForExperimentCache c = persisterHelper.prepare(ee);
    ee = persisterHelper.persist(ee, c);
    return ee;
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) MalformedURLException(java.net.MalformedURLException) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ArrayDesignsForExperimentCache(ubic.gemma.persistence.util.ArrayDesignsForExperimentCache) URL(java.net.URL) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) 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