package com.github.sparkcaller.preprocessing;

import com.github.sparkcaller.BaseGATKProgram;
import com.github.sparkcaller.Utils;
import org.apache.spark.api.java.function.Function;
import scala.Tuple2;

import java.io.File;

/*
 * Use the targets generated by the BQSRTargetGenerator to perform BQSR on the input BAM file.
 * Writes a BAM file with recalibrated bases.
 *
 * See:
 *
 * https://www.broadinstitute.org/gatk/documentation/tooldocs/org_broadinstitute_gatk_tools_walkers_readutils_PrintReads.php
 *
 * For more information.
 *
 */
public class BQSR extends BaseGATKProgram implements Function<Tuple2<File, File>, File> {
    public BQSR(String pathToReference, String extraArgsString) {
        super("PrintReads", extraArgsString);
        setReference(pathToReference);
    }

    public File call(Tuple2<File, File> bqsrTablePair) throws Exception {
        File bamFile = bqsrTablePair._1;
        File bqsrTable = bqsrTablePair._2;

        setInputFile(bamFile.getPath());
        addArgument("-BQSR", bqsrTable.getPath());

        String outputBamFilename = Utils.removeExtenstion(bamFile.getPath(), "bam") + "-bqsr.bam";
        File outputBam = new File(outputBamFilename);

        setOutputFile(outputBam.getPath());

        executeProgram();
        return outputBam;
    }
}

@@ -375,19 +375,16 @@
  * See:%0A
- *%0A
  * https

Remove unnecessary newline.