<commit_before>"""Provide support for MuTect and other paired analysis tools."""

import os
import collections
import copy
import itertools

from bcbio import broad
from bcbio.log import logger
from bcbio.utils import file_exists, safe_makedir
from bcbio.distributed.transaction import file_transaction
from bcbio.distributed.split import grouped_parallel_split_combine
from bcbio.variation.realign import has_aligned_reads
from bcbio.variation.genotype import write_empty_vcf
from bcbio.pipeline.shared import subset_variant_regions
from bcbio.variation import bamprep


def _mutect_call_prep(align_bams, items, ref_file, assoc_files,
                       region=None, out_file=None):
    """
    Preparation work for MuTect.
    """

    #FIXME: We assume all other bits in the config are shared

    base_config = items[0]["config"]
    dbsnp = assoc_files.dbsnp
    cosmic = None

    if hasattr(assoc_files, "cosmic"):
        cosmic = assoc_files.cosmic

    broad_runner = broad.runner_from_config(base_config)

    broad_runner.run_fn("picard_index_ref", ref_file)
    for x in align_bams:
        broad_runner.run_fn("picard_index", x)

    variant_regions = base_config["algorithm"].get("variant_regions", None)
    region = subset_variant_regions(variant_regions, region, out_file)

    #FIXME: Add more parameters like fraction contamination etc
<commit_msg>Explicitly ask for the MuTect jar<commit_after>"""Provide support for MuTect and other paired analysis tools."""

import os
import collections
import copy
import itertools

from bcbio import broad
from bcbio.log import logger
from bcbio.utils import file_exists, safe_makedir
from bcbio.distributed.transaction import file_transaction
from bcbio.distributed.split import grouped_parallel_split_combine
from bcbio.variation.realign import has_aligned_reads
from bcbio.variation.genotype import write_empty_vcf
from bcbio.pipeline.shared import subset_variant_regions
from bcbio.variation import bamprep


def _mutect_call_prep(align_bams, items, ref_file, assoc_files,
                       region=None, out_file=None):
    """
    Preparation work for MuTect.
    """

    #FIXME: We assume all other bits in the config are shared

    base_config = items[0]["config"]
    dbsnp = assoc_files.dbsnp
    cosmic = None

    if hasattr(assoc_files, "cosmic"):
        cosmic = assoc_files.cosmic

    broad_runner = broad.runner_from_config(base_config, "mutect")

    broad_runner.run_fn("picard_index_ref", ref_file)
    for x in align_bams:
        broad_runner.run_fn("picard_index", x)

    variant_regions = base_config["algorithm"].get("variant_regions", None)
    region = subset_variant_regions(variant_regions, region, out_file)

    #FIXME: Add more parameters like fraction contamination etc

{'fraction_non_alphanumeric': 0.07029560201874549, 'fraction_numerical': 0.0007209805335255948, 'mean_word_length': 4.5168986083499005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5492031', 'n_tokens_mistral': 886, 'n_tokens_neox': 847, 'n_words': 230}