Search in sources :

Example 91 with SequenceFile

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);
}
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 92 with SequenceFile

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);
}
Also used : NcbiBioSampleFiles(ca.corefacility.bioinformatics.irida.model.export.NcbiBioSampleFiles) NcbiExportSubmission(ca.corefacility.bioinformatics.irida.model.NcbiExportSubmission) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Date(java.util.Date) Test(org.junit.Test)

Example 93 with SequenceFile

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;
}
Also used : SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)

Example 94 with SequenceFile

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;
}
Also used : Path(java.nio.file.Path) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)

Example 95 with SequenceFile

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);
}
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) Test(org.junit.Test)

Aggregations

SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)111 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)84 Test (org.junit.Test)61 Path (java.nio.file.Path)50 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)39 SampleSequencingObjectJoin (ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin)31 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)25 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)20 Project (ca.corefacility.bioinformatics.irida.model.project.Project)15 AnalysisFastQC (ca.corefacility.bioinformatics.irida.model.workflow.analysis.AnalysisFastQC)15 WithMockUser (org.springframework.security.test.context.support.WithMockUser)13 IOException (java.io.IOException)11 SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)9 ArrayList (java.util.ArrayList)9 ProjectSampleJoin (ca.corefacility.bioinformatics.irida.model.joins.impl.ProjectSampleJoin)8 GZIPOutputStream (java.util.zip.GZIPOutputStream)8 Link (org.springframework.hateoas.Link)8 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)7 OutputStream (java.io.OutputStream)7 Before (org.junit.Before)7