use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class SampleServiceImplTest method testGetTotalBasesForSampleSuccessTwo.
/**
* Tests out successfully getting the total bases from a sample with two
* sequence files.
*
* @throws SequenceFileAnalysisException
* @throws AnalysisAlreadySetException
*/
@Test
public void testGetTotalBasesForSampleSuccessTwo() throws SequenceFileAnalysisException, AnalysisAlreadySetException {
Sample s1 = new Sample();
s1.setId(1L);
SequenceFile sf1 = new SequenceFile();
sf1.setId(2222L);
SequenceFile sf2 = new SequenceFile();
sf1.setId(3333L);
SampleSequencingObjectJoin join1 = new SampleSequencingObjectJoin(s1, new SingleEndSequenceFile(sf1));
SampleSequencingObjectJoin join2 = new SampleSequencingObjectJoin(s1, new SingleEndSequenceFile(sf2));
AnalysisFastQC analysisFastQC1 = AnalysisFastQC.sloppyBuilder().executionManagerAnalysisId("id").totalBases(1000L).build();
sf1.setFastQCAnalysis(analysisFastQC1);
AnalysisFastQC analysisFastQC2 = AnalysisFastQC.sloppyBuilder().executionManagerAnalysisId("id2").totalBases(1000L).build();
sf2.setFastQCAnalysis(analysisFastQC2);
when(ssoRepository.getSequencesForSample(s1)).thenReturn(Arrays.asList(join1, join2));
when(analysisRepository.findFastqcAnalysisForSequenceFile(sf1)).thenReturn(analysisFastQC1);
when(analysisRepository.findFastqcAnalysisForSequenceFile(sf2)).thenReturn(analysisFastQC2);
long actualBases = sampleService.getTotalBasesForSample(s1);
assertEquals(2000, actualBases);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class NcbiExportSubmissionServceTest method testCreate.
@Test
public void testCreate() {
SingleEndSequenceFile sequenceFile = new SingleEndSequenceFile(new SequenceFile());
NcbiBioSampleFiles ncbiBioSampleFiles = new NcbiBioSampleFiles("sample", Lists.newArrayList(sequenceFile), Lists.newArrayList(), null, "library_name", null, null, null, "library_construction_protocol", "namespace");
NcbiExportSubmission submission = new NcbiExportSubmission(null, null, "bioProjectId", "organization", "ncbiNamespace", new Date(), Lists.newArrayList(ncbiBioSampleFiles));
service.create(submission);
verify(repository).save(submission);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class TestDataFactory method constructSingleEndSequenceFile.
/**
* Construct a simple {@link SingleEndSequenceFile}
*
* @return a {@link SingleEndSequenceFile} with a {@link SequenceFile} and
* id
* @throws IOException
* if the temp file couldn't be created
*/
public static SingleEndSequenceFile constructSingleEndSequenceFile() throws IOException {
SequenceFile sf = constructSequenceFile();
SingleEndSequenceFile sesf = new SingleEndSequenceFile(sf);
sesf.setId(2L);
return sesf;
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class TestDataFactory method constructSequenceFile.
/**
* Construct a simple {@link ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile}.
*
* @return a {@link ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile} with identifier.
*/
public static SequenceFile constructSequenceFile() throws IOException {
Path f = Files.createTempFile(null, null);
SequenceFile sf = new SequenceFile();
sf.setId(1L);
sf.setFile(f);
return sf;
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile in project irida by phac-nml.
the class SampleServiceImplTest method testGetTotalBasesForSampleFailNoFastQC.
/**
* Tests out failing to get the total bases from a sample with one sequence
* file due to missing FastQC
*
* @throws SequenceFileAnalysisException
*/
@Test(expected = SequenceFileAnalysisException.class)
public void testGetTotalBasesForSampleFailNoFastQC() throws SequenceFileAnalysisException {
Sample s1 = new Sample();
s1.setId(1L);
SequenceFile sf1 = new SequenceFile();
sf1.setId(2222L);
SampleSequencingObjectJoin join = new SampleSequencingObjectJoin(s1, new SingleEndSequenceFile(sf1));
when(ssoRepository.getSequencesForSample(s1)).thenReturn(Arrays.asList(join));
sampleService.getTotalBasesForSample(s1);
}
Aggregations