use of ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testCreateSequenceFileInSample.
@Test
@WithMockUser(username = "fbristow", roles = "SEQUENCER")
public void testCreateSequenceFileInSample() throws IOException, InterruptedException {
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);
// Sleeping for a bit to let file processing run
Thread.sleep(10000);
Sample readSample = sampleService.read(s.getId());
List<QCEntry> qcEntries = sampleService.getQCEntriesForSample(readSample);
assertEquals("should be one qc entries", 1, qcEntries.size());
QCEntry qcEntry = qcEntries.iterator().next();
assertTrue("should be coverage entry", qcEntry instanceof CoverageQCEntry);
CoverageQCEntry coverage = (CoverageQCEntry) qcEntry;
assertEquals("should be 18 bases", 18, coverage.getTotalBases());
}
Aggregations