Search in sources :

Example 1 with AnalysisFastQC

use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC in project irida by phac-nml.

the class SequenceFileController method createDefaultPageInfo.

/**
 * Populates the model with the default information for a file.
 *
 * @param sequenceFileId
 *            Id for the sequence file.
 * @param model
 *            {@link Model}
 */
private void createDefaultPageInfo(Long sequencingObjectId, Long sequenceFileId, Model model) {
    SequencingObject seqObject = sequencingObjectService.read(sequencingObjectId);
    SequenceFile file = seqObject.getFileWithId(sequenceFileId);
    AnalysisFastQC fastQC = analysisService.getFastQCAnalysisForSequenceFile(seqObject, file.getId());
    model.addAttribute("sequencingObject", seqObject);
    model.addAttribute("file", file);
    model.addAttribute("created", dateFormatter.print(file.getCreatedDate(), LocaleContextHolder.getLocale()));
    model.addAttribute("fastQC", fastQC);
}
Also used : SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) AnalysisFastQC(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC)

Example 2 with AnalysisFastQC

use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC in project irida by phac-nml.

the class SampleServiceImplTest method testGetCoverageForSampleSuccess.

/**
 * Tests out successfully getting the coverage from a sample with a sequence
 * file.
 *
 * @throws SequenceFileAnalysisException
 * @throws AnalysisAlreadySetException
 */
@Test
public void testGetCoverageForSampleSuccess() throws SequenceFileAnalysisException, AnalysisAlreadySetException {
    Sample s1 = new Sample();
    s1.setId(1L);
    SequenceFile sf1 = new SequenceFile();
    sf1.setId(2222L);
    SampleSequencingObjectJoin join = new SampleSequencingObjectJoin(s1, new SingleEndSequenceFile(sf1));
    AnalysisFastQC analysisFastQC1 = AnalysisFastQC.sloppyBuilder().executionManagerAnalysisId("id").totalBases(1000L).build();
    sf1.setFastQCAnalysis(analysisFastQC1);
    when(ssoRepository.getSequencesForSample(s1)).thenReturn(Arrays.asList(join));
    when(analysisRepository.findFastqcAnalysisForSequenceFile(sf1)).thenReturn(analysisFastQC1);
    double coverage = sampleService.estimateCoverageForSample(s1, 500L);
    assertEquals(2.0, coverage, deltaFloatEquality);
}
Also used : SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) SampleSequencingObjectJoin(ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) AnalysisFastQC(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC) Test(org.junit.Test)

Example 3 with AnalysisFastQC

use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC in project irida by phac-nml.

the class SampleServiceImplTest method testGetTotalBasesForSampleSuccessOne.

/**
 * Tests out successfully getting the total bases from a sample with one
 * sequence file.
 *
 * @throws SequenceFileAnalysisException
 * @throws AnalysisAlreadySetException
 */
@Test
public void testGetTotalBasesForSampleSuccessOne() throws SequenceFileAnalysisException, AnalysisAlreadySetException {
    Sample s1 = new Sample();
    s1.setId(1L);
    SequenceFile sf1 = new SequenceFile();
    sf1.setId(2222L);
    SampleSequencingObjectJoin join = new SampleSequencingObjectJoin(s1, new SingleEndSequenceFile(sf1));
    AnalysisFastQC analysisFastQC1 = AnalysisFastQC.sloppyBuilder().executionManagerAnalysisId("id").totalBases(1000L).build();
    sf1.setFastQCAnalysis(analysisFastQC1);
    when(ssoRepository.getSequencesForSample(s1)).thenReturn(Arrays.asList(join));
    when(analysisRepository.findFastqcAnalysisForSequenceFile(sf1)).thenReturn(analysisFastQC1);
    long actualBases = sampleService.getTotalBasesForSample(s1);
    assertEquals(1000, actualBases);
}
Also used : SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) SampleSequencingObjectJoin(ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) AnalysisFastQC(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC) Test(org.junit.Test)

Example 4 with AnalysisFastQC

use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC in project irida by phac-nml.

the class CoverageFileProcessorTest method testBadCoverage.

@Test
public void testBadCoverage() {
    Project p = new Project();
    p.setGenomeSize(100L);
    p.setMinimumCoverage(5);
    SequenceFile file = new SequenceFile();
    SequencingObject o = new SingleEndSequenceFile(file);
    AnalysisFastQC fqc = mock(AnalysisFastQC.class);
    Long baseCount = 300L;
    when(analysisRepository.findFastqcAnalysisForSequenceFile(file)).thenReturn(fqc);
    when(fqc.getTotalBases()).thenReturn(baseCount);
    processor.process(o);
    ArgumentCaptor<CoverageQCEntry> qcCaptor = ArgumentCaptor.forClass(CoverageQCEntry.class);
    verify(qcEntryRepository, times(0)).delete(any(QCEntry.class));
    verify(qcEntryRepository).save(qcCaptor.capture());
    CoverageQCEntry qc = qcCaptor.getValue();
    qc.addProjectSettings(p);
    assertEquals("should show 3 times coverage", 3, qc.getCoverage());
    assertEquals("should be bad coverage", QCEntryStatus.NEGATIVE, qc.getStatus());
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) QCEntry(ca.corefacility.bioinformatics.irida.model.sample.QCEntry) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) AnalysisFastQC(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC) Test(org.junit.Test)

Example 5 with AnalysisFastQC

use of ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC in project irida by phac-nml.

the class CoverageFileProcessorTest method testRemoveExistingEntry.

@Test
public void testRemoveExistingEntry() {
    Project p = new Project();
    p.setGenomeSize(100L);
    p.setMinimumCoverage(2);
    SequenceFile file = new SequenceFile();
    SequencingObject o = new SingleEndSequenceFile(file);
    AnalysisFastQC fqc = mock(AnalysisFastQC.class);
    Long baseCount = 300L;
    QCEntry existingQc = new CoverageQCEntry();
    o.setQcEntries(Sets.newHashSet(existingQc));
    when(analysisRepository.findFastqcAnalysisForSequenceFile(file)).thenReturn(fqc);
    when(fqc.getTotalBases()).thenReturn(baseCount);
    processor.process(o);
    ArgumentCaptor<CoverageQCEntry> qcCaptor = ArgumentCaptor.forClass(CoverageQCEntry.class);
    verify(qcEntryRepository).delete(existingQc);
    verify(qcEntryRepository).save(qcCaptor.capture());
    CoverageQCEntry qc = qcCaptor.getValue();
    qc.addProjectSettings(p);
    assertEquals("should show 3 times coverage", 3, qc.getCoverage());
    assertEquals("should be positive coverage", QCEntryStatus.POSITIVE, qc.getStatus());
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) CoverageQCEntry(ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry) QCEntry(ca.corefacility.bioinformatics.irida.model.sample.QCEntry) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) AnalysisFastQC(ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC) Test(org.junit.Test)

Aggregations

AnalysisFastQC (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC)18 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)14 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)12 Test (org.junit.Test)12 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)10 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)6 Path (java.nio.file.Path)6 EntityNotFoundException (ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException)4 Project (ca.corefacility.bioinformatics.irida.model.project.Project)4 CoverageQCEntry (ca.corefacility.bioinformatics.irida.model.sample.CoverageQCEntry)4 SampleSequencingObjectJoin (ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin)4 QCEntry (ca.corefacility.bioinformatics.irida.model.sample.QCEntry)3 OverrepresentedSequence (ca.corefacility.bioinformatics.irida.model.sequenceFile.OverrepresentedSequence)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)2 BigDecimal (java.math.BigDecimal)2 ModelMap (org.springframework.ui.ModelMap)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 SequenceFileAnalysisException (ca.corefacility.bioinformatics.irida.exceptions.SequenceFileAnalysisException)1 AnalysisOutputFile (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisOutputFile)1