use of ca.corefacility.bioinformatics.irida.model.run.SequencingRun in project irida by phac-nml.
the class SequencingRunController method getPageDetails.
private Model getPageDetails(Long runId, Model model) {
SequencingRun run = sequencingRunService.read(runId);
Set<SequencingObject> sequencingObjectsForSequencingRun = objectService.getSequencingObjectsForSequencingRun(run);
int fileCount = sequencingObjectsForSequencingRun.stream().mapToInt(o -> o.getFiles().size()).sum();
model.addAttribute("sequencingObjects", sequencingObjectsForSequencingRun);
model.addAttribute("fileCount", fileCount);
model.addAttribute("run", run);
return model;
}
use of ca.corefacility.bioinformatics.irida.model.run.SequencingRun in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testCoverage.
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testCoverage() throws IOException, InterruptedException {
Project project = projectService.read(1L);
project.setGenomeSize(3L);
project.setMinimumCoverage(2);
project = projectService.update(project);
Sample s = sampleService.read(1L);
SequenceFile sf = new SequenceFile();
Path sequenceFile = Files.createTempFile("TEMPORARY-SEQUENCE-FILE", ".gz");
OutputStream gzOut = new GZIPOutputStream(Files.newOutputStream(sequenceFile));
gzOut.write(FASTQ_FILE_CONTENTS);
gzOut.close();
sf.setFile(sequenceFile);
SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
objectService.createSequencingObjectInSample(so, s);
SequencingRun mr = sequencingRunService.read(1L);
sequencingRunService.addSequencingObjectToSequencingRun(mr, so);
// Wait 10 seconds. file processing should have run by then.
Thread.sleep(10000);
Sample readSample = sampleService.read(s.getId());
List<QCEntry> qcEntries = sampleService.getQCEntriesForSample(readSample);
assertEquals("should be one qc entry", 1, qcEntries.size());
QCEntry qcEntry = qcEntries.iterator().next();
qcEntry.addProjectSettings(project);
assertTrue("should be coverage entry", qcEntry instanceof CoverageQCEntry);
assertEquals("qc should have passed", QCEntryStatus.POSITIVE, qcEntry.getStatus());
assertEquals("should be 6x coverage", "6x", qcEntry.getMessage());
project.setMinimumCoverage(10);
project = projectService.update(project);
// Wait 10 seconds. file processing should have run by then.
Thread.sleep(10000);
qcEntries = sampleService.getQCEntriesForSample(readSample);
assertEquals("should be one qc entry", 1, qcEntries.size());
qcEntry = qcEntries.iterator().next();
qcEntry.addProjectSettings(project);
assertTrue("should be coverage entry", qcEntry instanceof CoverageQCEntry);
assertEquals("qc should have failed", QCEntryStatus.NEGATIVE, qcEntry.getStatus());
}
use of ca.corefacility.bioinformatics.irida.model.run.SequencingRun in project irida by phac-nml.
the class SequencingRunServiceImplIT method testAddDetachedRunToSequenceFile.
/**
* This test simulates a bug that happens from the REST API when uploading
* sequence files to samples, where a new sequence file is created, then
* detached from a transaction.
*
* @throws IOException
* @throws InterruptedException
*/
@Test
@WithMockUser(username = "fbristow", password = "password1", roles = "ADMIN")
public void testAddDetachedRunToSequenceFile() throws IOException, InterruptedException {
final String SEQUENCE = "ACGTACGTN";
final byte[] FASTQ_FILE_CONTENTS = ("@testread\n" + SEQUENCE + "\n+\n?????????\n@testread2\n" + SEQUENCE + "\n+\n?????????").getBytes();
Path p = Files.createTempFile(null, null);
Files.write(p, FASTQ_FILE_CONTENTS);
SequenceFile sf = new SequenceFile();
sf.setFile(p);
SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
Sample sample = sampleService.read(1L);
SequencingRun run = miseqRunService.read(2L);
objectService.createSequencingObjectInSample(so, sample);
miseqRunService.addSequencingObjectToSequencingRun(run, so);
AnalysisFastQC analysis = null;
do {
try {
analysis = analysisService.getFastQCAnalysisForSequenceFile(so, sf.getId());
} catch (final EntityNotFoundException e) {
logger.info("Fastqc still isn't finished, sleeping a bit.");
Thread.sleep(1000);
}
} while (analysis == null);
assertNotNull("FastQC analysis should have been created for sequence file.", analysis);
}
use of ca.corefacility.bioinformatics.irida.model.run.SequencingRun in project irida by phac-nml.
the class SequencingRunServiceImplIT method testFindAll.
@Test
@WithMockUser(username = "user", password = "password1", roles = "USER")
public void testFindAll() {
Iterable<SequencingRun> findAll = miseqRunService.findAll();
List<SequencingRun> runs = Lists.newArrayList(findAll);
assertEquals("user should be able to see 1 run", 1, runs.size());
SequencingRun run = runs.iterator().next();
assertEquals("id should be 1", new Long(1), run.getId());
}
use of ca.corefacility.bioinformatics.irida.model.run.SequencingRun in project irida by phac-nml.
the class SequencingRunServiceImplIT method testUpdateMiseqRunAsUserFail.
@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "user", password = "password1", roles = "USER")
public void testUpdateMiseqRunAsUserFail() {
// run 2 is not owned by "user"
SequencingRun mr = miseqRunService.read(2L);
mr.setDescription("different description");
miseqRunService.update(mr);
}
Aggregations