Search in sources :

Example 1 with SbpFastQ

use of com.hartwig.pipeline.sbpapi.SbpFastQ 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)

Aggregations

Sample (com.hartwig.patient.Sample)1 SbpFastQ (com.hartwig.pipeline.sbpapi.SbpFastQ)1 SbpSample (com.hartwig.pipeline.sbpapi.SbpSample)1 IOException (java.io.IOException)1