use of ubic.gemma.model.common.description.LocalFile in project Gemma by PavlidisLab.
the class AclTestUtils method checkDeleteEEAcls.
/**
* CHeck the entire entity graph of an ee for ACL deletion.
*
* @param ee ee
*/
public void checkDeleteEEAcls(ExpressionExperiment ee) {
this.checkDeletedAcl(ee);
this.checkDeletedAcl(ee.getRawDataFile());
this.checkDeletedAcl(ee.getExperimentalDesign());
for (ExperimentalFactor f : ee.getExperimentalDesign().getExperimentalFactors()) {
this.checkDeletedAcl(f);
for (FactorValue fv : f.getFactorValues()) {
this.checkDeletedAcl(fv);
}
}
assertTrue(ee.getBioAssays().size() > 0);
for (BioAssay ba : ee.getBioAssays()) {
this.checkDeletedAcl(ba);
LocalFile rawDataFile = ba.getRawDataFile();
for (LocalFile f : ba.getDerivedDataFiles()) {
this.checkDeletedAcl(f);
}
if (rawDataFile != null) {
this.checkDeletedAcl(rawDataFile);
}
BioMaterial bm = ba.getSampleUsed();
this.checkDeletedAcl(bm);
}
}
use of ubic.gemma.model.common.description.LocalFile in project Gemma by PavlidisLab.
the class AclTestUtils method checkEEAcls.
/**
* Validate ACLs on EE
*
* @param ee ee
*/
public void checkEEAcls(ExpressionExperiment ee) {
ee = expressionExperimentService.thawLite(ee);
this.checkHasAcl(ee);
this.checkHasAces(ee);
ExperimentalDesign experimentalDesign = ee.getExperimentalDesign();
this.checkHasAcl(experimentalDesign);
this.checkHasAclParent(experimentalDesign, ee);
this.checkLacksAces(experimentalDesign);
if (ee.getRawDataFile() != null) {
this.checkHasAcl(ee.getRawDataFile());
this.checkHasAclParent(ee.getRawDataFile(), ee);
this.checkLacksAces(ee.getRawDataFile());
}
for (ExperimentalFactor f : experimentalDesign.getExperimentalFactors()) {
this.checkHasAcl(f);
this.checkHasAclParent(f, ee);
this.checkLacksAces(f);
for (FactorValue fv : f.getFactorValues()) {
this.checkHasAcl(fv);
this.checkHasAclParent(fv, ee);
this.checkLacksAces(fv);
}
}
// make sure ACLs for the child objects are there
assertTrue(ee.getBioAssays().size() > 0);
for (BioAssay ba : ee.getBioAssays()) {
this.checkHasAcl(ba);
this.checkHasAclParent(ba, ee);
this.checkLacksAces(ba);
LocalFile rawDataFile = ba.getRawDataFile();
if (rawDataFile != null) {
this.checkHasAcl(rawDataFile);
this.checkHasAclParent(rawDataFile, null);
this.checkLacksAces(rawDataFile);
}
for (LocalFile f : ba.getDerivedDataFiles()) {
this.checkHasAcl(f);
this.checkHasAclParent(f, null);
this.checkLacksAces(f);
}
BioMaterial bm = ba.getSampleUsed();
this.checkHasAcl(bm);
this.checkHasAclParent(bm, ee);
this.checkLacksAces(bm);
ArrayDesign arrayDesign = ba.getArrayDesignUsed();
this.checkHasAcl(arrayDesign);
assertTrue(this.getParentAcl(arrayDesign) == null);
// make sure the localfiles are associated with the array design, not the ee.
arrayDesign = arrayDesignService.thawLite(arrayDesign);
for (LocalFile lf : arrayDesign.getLocalFiles()) {
this.checkHasAcl(lf);
this.checkLacksAces(lf);
this.checkHasAclParent(lf, arrayDesign);
}
}
}
use of ubic.gemma.model.common.description.LocalFile in project Gemma by PavlidisLab.
the class StringProteinFetcherIntegrationTest method testDownloadProteinAliasFile.
/*
* Test fetching a small file from string in this case a taxon file.
*/
@Test
public void testDownloadProteinAliasFile() {
Collection<LocalFile> localFile = stringProteinLinksDetailedFetcher.fetch(testFileName);
String outputfilenamegzip;
String outputfilename;
stringProteinLinksDetailedFetcher.unPackFile(localFile);
for (LocalFile file : localFile) {
outputfilenamegzip = file.getLocalURL().getFile();
assertNotNull(outputfilenamegzip);
String archiveMethod = "gz";
int lastIndexOf = outputfilenamegzip.lastIndexOf("." + archiveMethod);
if (lastIndexOf != -1) {
outputfilename = outputfilenamegzip.substring(0, lastIndexOf);
// check that the file has been downloaded and unzipped
assertTrue(new File(outputfilename).canRead());
} else {
fail();
}
}
}
use of ubic.gemma.model.common.description.LocalFile in project Gemma by PavlidisLab.
the class HttpFetcherTest method testFetch.
/*
* Test method for 'ubic.gemma.core.loader.loaderutils.HttpFetcher.fetch(String)'
*/
public void testFetch() {
HttpFetcher hf = new HttpFetcher();
try {
hf.setForce(true);
Collection<LocalFile> results = hf.fetch("http://www.yahoo.com");
TestCase.assertNotNull(results);
TestCase.assertTrue(results.size() > 0 && results.iterator().next().getLocalURL() != null);
f = new File(results.iterator().next().getLocalURL().toURI());
TestCase.assertTrue(f.length() > 0);
} catch (Exception e) {
if (e.getCause() instanceof IOException) {
HttpFetcherTest.log.error("Got IOException, skipping test");
}
}
}
use of ubic.gemma.model.common.description.LocalFile in project Gemma by PavlidisLab.
the class BatchInfoParser method getBatchInfo.
public Map<BioMaterial, Date> getBatchInfo(ExpressionExperiment ee, Collection<LocalFile> files) {
Map<String, BioAssay> assayAccessions = this.getAccessionToBioAssayMap(ee);
if (assayAccessions.isEmpty()) {
throw new UnsupportedOperationException("Couldn't get any scan date information, could not determine provider or it is not supported for " + ee.getShortName());
}
Map<BioAssay, File> bioAssays2Files = this.matchBioAssaysToRawDataFiles(files, assayAccessions);
/*
* Check if we should go on
*/
if (bioAssays2Files.size() < assayAccessions.size()) {
if (bioAssays2Files.size() > 0) {
/*
* Missing a few for some reason.
*/
for (BioAssay ba : bioAssays2Files.keySet()) {
if (!assayAccessions.containsKey(ba.getAccession().getAccession())) {
BatchInfoParser.log.warn("Missing raw data file for " + ba + " on " + ee.getShortName());
}
}
}
throw new IllegalStateException("Did not get enough raw files :got " + bioAssays2Files.size() + ", expected " + assayAccessions.size() + " while processing " + ee.getShortName());
}
return this.getBatchInformationFromFiles(bioAssays2Files);
}
Aggregations