Search in sources :

Example 6 with CoverageQCEntry

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());
}
Also used : Path(java.nio.file.Path) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) GZIPOutputStream(java.util.zip.GZIPOutputStream) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) GZIPOutputStream(java.util.zip.GZIPOutputStream) OutputStream(java.io.OutputStream) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) FileProcessorErrorQCEntry(ca.corefacility.bioinformatics.irida.model.sample.FileProcessorErrorQCEntry) QCEntry(ca.corefacility.bioinformatics.irida.model.sample.QCEntry) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

CoverageQCEntry (ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry)6 Project (ca.corefacility.bioinformatics.irida.model.project.Project)5 QCEntry (ca.corefacility.bioinformatics.irida.model.sample.QCEntry)5 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)5 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)5 Test (org.junit.Test)5 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)4 AnalysisFastQC (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC)4 SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)2 FileProcessorErrorQCEntry (ca.corefacility.bioinformatics.irida.model.sample.FileProcessorErrorQCEntry)2 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)2 OutputStream (java.io.OutputStream)2 Path (java.nio.file.Path)2 GZIPOutputStream (java.util.zip.GZIPOutputStream)2 WithMockUser (org.springframework.security.test.context.support.WithMockUser)2 FileProcessor (ca.corefacility.bioinformatics.irida.processing.FileProcessor)1 AnalysisRepository (ca.corefacility.bioinformatics.irida.repositories.analysis.AnalysisRepository)1 QCEntryRepository (ca.corefacility.bioinformatics.irida.repositories.sample.QCEntryRepository)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1