<commit_before>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, String coresPerNode) {
        super("PrintReads", extraArgsString);
        setReference(pathToReference);
        setThreads(coresPerNode);
    }

    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;
    }
}<commit_msg>[Genomics]: Make it easier to run BQSR in parallel, as this works when doing it per chromosome.<commit_after>package com.github.sparkcaller.preprocessing;

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

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<File, File> {
    public BQSR(String pathToReference, String bqsrTablePath, String extraArgsString, String coresPerNode) {
        super("PrintReads", extraArgsString);
        setReference(pathToReference);
        addArgument("-BQSR", bqsrTablePath);
        setThreads(coresPerNode);
    }

    @Override
    public File call(File bamFile) throws Exception {
        setInputFile(bamFile.getPath());

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

        setOutputFile(outputBam.getPath());

        executeProgram();
        return outputBam;
    }
}
{'fraction_non_alphanumeric': 0.09722222222222222, 'fraction_numerical': 0.001827485380116959, 'mean_word_length': 3.9763636363636365, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7324367', 'n_tokens_mistral': 878, 'n_tokens_neox': 841, 'n_words': 185}