public static FastqResult mergeFastq()

in src/main/java/com/epam/fonda/utils/PipelineUtils.java [231:264]


    public static FastqResult mergeFastq(final FastqFileSample sample) {
        String sampleName = sample.getName();
        String sfqOutdir = sample.getFastqOutdir();
        List<String> fastqs1 = sample.getFastq1();
        List<String> fastqs2 = sample.getFastq2();
        String mergedFastq1 = "";
        String mergedFastq2 = "";
        String cmd = "";
        if (fastqs1 != null) {
            Context context = new Context();
            mergedFastq1 = format("%s/%s.merged_R1.fastq.gz", sfqOutdir, sampleName);
            context.setVariable(MERGED_FASTQ_1_NAME, mergedFastq1);
            if (fastqs2 != null) {
                mergedFastq2 = format("%s/%s.merged_R2.fastq.gz", sfqOutdir, sampleName);
                context.setVariable(MERGED_FASTQ_2_NAME, mergedFastq2);
            }
            context.setVariable(FASTQS_1_NAME, fastqs1);
            if (fastqs2 != null) {
                context.setVariable(FASTQS_2_NAME, fastqs2);
            }
            cmd = TEMPLATE_ENGINE.process(MERGE_FASTQ_TEMPLATE_NAME, context);
            TaskContainer.addTasks("Merge fastqs");
        }
        FastqOutput fastqOutput = FastqOutput.builder()
                .mergedFastq1(mergedFastq1)
                .mergedFastq2(mergedFastq2)
                .build();
        AbstractCommand command = BashCommand.withTool(cmd);
        command.setTempDirs(Arrays.asList(mergedFastq1, mergedFastq2));
        return FastqResult.builder()
                .command(command)
                .out(fastqOutput)
                .build();
    }