Search in sources :

Example 6 with Sample

use of com.hartwig.patient.Sample in project pipeline5 by hartwigmedical.

the class SbpSampleReaderTest method getsFlowcellFromFileName.

@Test
public void getsFlowcellFromFileName() {
    returnJson(FASTQ_JSON);
    Sample sample = victim.read(EXISTS);
    assertThat(sample.lanes().get(0).flowCellId()).isEqualTo("HJKLMALXX");
}
Also used : Sample(com.hartwig.patient.Sample) Test(org.junit.Test)

Example 7 with Sample

use of com.hartwig.patient.Sample in project pipeline5 by hartwigmedical.

the class SbpSampleReader method read.

public Sample read(final long sampleId) {
    String rawFastQJson = sbpRestApi.getFastQ(sampleId);
    try {
        List<SbpFastQ> fastqJson = parseFastqJson(rawFastQJson);
        String sampleName = extract(sampleId, fastqJson, name());
        String barcode = parseSampleJson(sbpRestApi.getSample(sampleId)).barcode();
        Sample sample = sample(sampleName, barcode, fastqJson);
        LOGGER.info("Found sample [{}] in SBP", sample);
        if (sample.lanes().isEmpty()) {
            throw new IllegalArgumentException(String.format("No lanes (fastq) were found for sample [%s]. Either no fastq files in the api or none pass qc", sample.name()));
        }
        return sample;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : SbpSample(com.hartwig.pipeline.sbpapi.SbpSample) Sample(com.hartwig.patient.Sample) IOException(java.io.IOException) SbpFastQ(com.hartwig.pipeline.sbpapi.SbpFastQ)

Example 8 with Sample

use of com.hartwig.patient.Sample in project pipeline5 by hartwigmedical.

the class SbpSampleReaderTest method addsAllLanesToSample.

@Test
public void addsAllLanesToSample() {
    returnJson(FASTQ_JSON);
    Sample sample = victim.read(EXISTS);
    assertThat(sample).isNotNull();
    assertThat(sample.lanes()).hasSize(2);
}
Also used : Sample(com.hartwig.patient.Sample) Test(org.junit.Test)

Example 9 with Sample

use of com.hartwig.patient.Sample in project pipeline5 by hartwigmedical.

the class SbpSampleReaderTest method filtersLanesWhichHaveNotPassedQC.

@Test
public void filtersLanesWhichHaveNotPassedQC() {
    returnJson(FASTQ_JSON_SINGLE_QC_FAILED);
    Sample sample = victim.read(EXISTS);
    assertThat(sample.lanes()).hasSize(1);
    assertThat(sample.lanes().get(0).firstOfPairPath()).contains("L001");
}
Also used : Sample(com.hartwig.patient.Sample) Test(org.junit.Test)

Example 10 with Sample

use of com.hartwig.patient.Sample in project pipeline5 by hartwigmedical.

the class SbpSampleReaderTest method getsBarcodeFromAPi.

@Test
public void getsBarcodeFromAPi() {
    returnJson(FASTQ_JSON);
    Sample sample = victim.read(EXISTS);
    assertThat(sample.barcode()).isEqualTo("FR13257296");
}
Also used : Sample(com.hartwig.patient.Sample) Test(org.junit.Test)

Aggregations

Sample (com.hartwig.patient.Sample)12 Test (org.junit.Test)8 Lane (com.hartwig.patient.Lane)4 Blob (com.google.cloud.storage.Blob)1 Bucket (com.google.cloud.storage.Bucket)1 Storage (com.google.cloud.storage.Storage)1 Arguments (com.hartwig.pipeline.Arguments)1 ResultsDirectory (com.hartwig.pipeline.ResultsDirectory)1 Aligner (com.hartwig.pipeline.alignment.Aligner)1 AlignmentOutput (com.hartwig.pipeline.alignment.AlignmentOutput)1 ImmutableAlignmentOutput (com.hartwig.pipeline.alignment.ImmutableAlignmentOutput)1 JsonSampleSource (com.hartwig.pipeline.alignment.sample.JsonSampleSource)1 SampleSource (com.hartwig.pipeline.alignment.sample.SampleSource)1 DataType (com.hartwig.pipeline.datatypes.DataType)1 FileTypes.bai (com.hartwig.pipeline.datatypes.FileTypes.bai)1 FileTypes.bam (com.hartwig.pipeline.datatypes.FileTypes.bam)1 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)1 BashStartupScript (com.hartwig.pipeline.execution.vm.BashStartupScript)1 ComputeEngine (com.hartwig.pipeline.execution.vm.ComputeEngine)1 InputDownload (com.hartwig.pipeline.execution.vm.InputDownload)1