use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class SISTRSampleUpdaterTest method testUpdaterNoFile.
@Test(expected = PostProcessingException.class)
public void testUpdaterNoFile() throws PostProcessingException, AnalysisAlreadySetException {
ImmutableMap<String, String> expectedResults = ImmutableMap.of("SISTR serovar", "Enteritidis", "SISTR cgMLST Subspecies", "enterica", "SISTR QC Status", "PASS");
Path outputPath = Paths.get("src/test/resources/files/not_really_a_file.txt");
AnalysisOutputFile outputFile = new AnalysisOutputFile(outputPath, null, null, null);
Analysis analysis = new Analysis(null, ImmutableMap.of("sistr-predictions", outputFile), null, null);
AnalysisSubmission submission = AnalysisSubmission.builder(UUID.randomUUID()).inputFiles(ImmutableSet.of(new SingleEndSequenceFile(null))).build();
submission.setAnalysis(analysis);
Sample sample = new Sample();
sample.setId(1L);
updater.update(Lists.newArrayList(sample), submission);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class SingleEndSequenceFileConcatenatorTest method testConcatenateFiles.
@Test
public void testConcatenateFiles() throws IOException, ConcatenateException {
String newFileName = "newFile";
SequenceFile original1 = createSequenceFile("testFile");
SequenceFile original2 = createSequenceFile("testFile2");
long originalLength = original1.getFile().toFile().length();
SingleEndSequenceFile f1 = new SingleEndSequenceFile(original1);
SingleEndSequenceFile f2 = new SingleEndSequenceFile(original2);
SingleEndSequenceFile concatenateFiles = concat.concatenateFiles(Lists.newArrayList(f1, f2), newFileName);
SequenceFile newSeqFile = concatenateFiles.getSequenceFile();
assertTrue("file exists", Files.exists(newSeqFile.getFile()));
long newFileSize = newSeqFile.getFile().toFile().length();
assertEquals("new file should be 2x size of originals", originalLength * 2, newFileSize);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class ChecksumFileProcessorTest method testChecksumCreated.
@Test
public void testChecksumCreated() throws IOException {
final SequenceFile sf = constructSequenceFile();
SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
fileProcessor.process(so);
ArgumentCaptor<SequenceFile> fileCaptor = ArgumentCaptor.forClass(SequenceFile.class);
verify(sequenceFileRepository).saveMetadata(fileCaptor.capture());
SequenceFile file = fileCaptor.getValue();
assertEquals("checksums should be equal", CHECKSUM, file.getUploadSha256());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class ChecksumFileProcessorTest method testFileNotExists.
@Test(expected = FileProcessorException.class)
public void testFileNotExists() throws IOException {
final SequenceFile sf = new SequenceFile(Paths.get("/reallyfakefile"));
SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
fileProcessor.process(so);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile 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());
}
Aggregations