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();
}
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);
}
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;
}
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;
}
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;
}
Aggregations