use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class SequenceFilePairConcatenatorTest method testConcatenateFiles.
@Test
public void testConcatenateFiles() throws IOException, ConcatenateException {
String newFileName = "newFile";
SequenceFile original1 = createSequenceFile("testFile_F");
SequenceFile original2 = createSequenceFile("testFile_R");
SequenceFile original3 = createSequenceFile("testFile2_F");
SequenceFile original4 = createSequenceFile("testFile2_R");
long originalLength = original1.getFile().toFile().length();
SequenceFilePair f1 = new SequenceFilePair(original1, original2);
SequenceFilePair f2 = new SequenceFilePair(original3, original4);
SequenceFilePair concatenateFiles = concat.concatenateFiles(Lists.newArrayList(f1, f2), newFileName);
SequenceFile forward = concatenateFiles.getForwardSequenceFile();
SequenceFile reverse = concatenateFiles.getReverseSequenceFile();
assertTrue("file exists", Files.exists(forward.getFile()));
assertTrue("file exists", Files.exists(reverse.getFile()));
long newFileSize = forward.getFile().toFile().length();
assertEquals("new file should be 2x size of originals", originalLength * 2, newFileSize);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile 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.SequenceFile in project irida by phac-nml.
the class AssemblyFileProcessorTest method testAssembleFile.
@Test
public void testAssembleFile() {
Long sequenceFileId = 1L;
SequenceFilePair pair = new SequenceFilePair(new SequenceFile(Paths.get("file_R1_1.fastq.gz")), new SequenceFile(Paths.get("file_R2_1.fastq.gz")));
Sample sample = new Sample();
Project project = new Project();
project.setAssembleUploads(true);
when(objectRepository.findOne(sequenceFileId)).thenReturn(pair);
when(ssoRepository.getSampleForSequencingObject(pair)).thenReturn(new SampleSequencingObjectJoin(sample, pair));
when(psjRepository.getProjectForSample(sample)).thenReturn(ImmutableList.of(new ProjectSampleJoin(project, sample, true)));
assertTrue("should want to assemble file", processor.shouldProcessFile(sequenceFileId));
processor.process(pair);
verify(submissionRepository).save(any(AnalysisSubmission.class));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class AssemblyFileProcessorTest method testOneProjectEnabled.
@Test
public void testOneProjectEnabled() {
SequenceFilePair pair = new SequenceFilePair(new SequenceFile(Paths.get("file_R1_1.fastq.gz")), new SequenceFile(Paths.get("file_R2_1.fastq.gz")));
Sample sample = new Sample();
Project project = new Project();
project.setAssembleUploads(true);
Project disabledProject = new Project();
disabledProject.setAssembleUploads(false);
when(ssoRepository.getSampleForSequencingObject(pair)).thenReturn(new SampleSequencingObjectJoin(sample, pair));
when(psjRepository.getProjectForSample(sample)).thenReturn(ImmutableList.of(new ProjectSampleJoin(disabledProject, sample, true), new ProjectSampleJoin(project, sample, true)));
processor.process(pair);
verify(submissionRepository).save(any(AnalysisSubmission.class));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile 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());
}
Aggregations