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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations