<commit_before>#!/usr/bin/env python3

import sys, argparse, math, gzip, os

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-tsv',   '--tsv-in',                    type=str,   help='TSV in', required=True)
parser.add_argument('-vcf',   '--vcf-out',                   type=str,   help='VCF iut', required=True)
parser.add_argument('-pass',  '--pass-threshold',            type=float, help='Above which is automatically PASS', required=False, default=0.7)
parser.add_argument('-low',   '--lowqual-threshold',         type=float, help='Low quality subject to lenient filter', required=False, default=0.1)
parser.add_argument('-hom',   '--hom-threshold',             type=float, help='Above which is automatically PASS', required=False, default=0.85)
parser.add_argument('-het',   '--het-threshold',             type=float, help='Low quality subject to lenient filter', required=False, default=0.05)
parser.add_argument('-N',     '--normal-sample-name',        type=str,   help='Normal Sample Name', required=False, default='NORMAL')
parser.add_argument('-T',     '--tumor-sample-name',         type=str,   help='Tumor Sample Name', required=False, default='TUMOR')
parser.add_argument('-tools', '--individual-mutation-tools', type=str,   help='A list of all tools: have to match the annotated tool name in the input vcf files', nargs='*', required=False, default=('CGA', 'VarScan2', 'JointSNVMix2', 'SomaticSniper', 'VarDict', 'MuSE', 'LoFreq', 'Scalpel') )

parser.add_argument('-all',   '--emit-all',    action='store_true', help='Flag it to print out everything', required=False)
parser.add_argument('-phred', '--phred-scale', action='store_true', help='Flag it to print out Phred scale QUAL (proper VCF format but more annoying to filter)', required=False)

mode = parser.add_mutually_exclusive_group()
mode.add_argument('-single',  '--single-sample',   action="store_true", help='Tumor-only mode')
mode.add_argument('-paired',  '--paired-samples',  action="store_true", help='Paired tumor-normal samples', required=False, default=True)

args = parser.parse_args()

# Rename input:
tsv_fn = args.tsv_in
vcf_fn = args.vcf_out
tools = args.individual_mutation_tools
pass_score = args.pass_threshold
lowqual_score = args.lowqual_threshold
hom_threshold = args.hom_threshold
het_threshold = args.het_threshold

single_mode = args.single_sample
paired_mode = args.paired_samples

print_reject = args.emit_all
phred_scaled = args.phred_scale


MY_DIR = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(MY_DIR, "VERSION")) as version_info_file:
    version_line = version_info_file.readline()
<commit_msg>just in case VERSION file missing<commit_after>#!/usr/bin/env python3

import sys, argparse, math, gzip, os

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-tsv',   '--tsv-in',                    type=str,   help='TSV in', required=True)
parser.add_argument('-vcf',   '--vcf-out',                   type=str,   help='VCF iut', required=True)
parser.add_argument('-pass',  '--pass-threshold',            type=float, help='Above which is automatically PASS', required=False, default=0.7)
parser.add_argument('-low',   '--lowqual-threshold',         type=float, help='Low quality subject to lenient filter', required=False, default=0.1)
parser.add_argument('-hom',   '--hom-threshold',             type=float, help='Above which is automatically PASS', required=False, default=0.85)
parser.add_argument('-het',   '--het-threshold',             type=float, help='Low quality subject to lenient filter', required=False, default=0.05)
parser.add_argument('-N',     '--normal-sample-name',        type=str,   help='Normal Sample Name', required=False, default='NORMAL')
parser.add_argument('-T',     '--tumor-sample-name',         type=str,   help='Tumor Sample Name', required=False, default='TUMOR')
parser.add_argument('-tools', '--individual-mutation-tools', type=str,   help='A list of all tools: have to match the annotated tool name in the input vcf files', nargs='*', required=False, default=('CGA', 'VarScan2', 'JointSNVMix2', 'SomaticSniper', 'VarDict', 'MuSE', 'LoFreq', 'Scalpel') )

parser.add_argument('-all',   '--emit-all',    action='store_true', help='Flag it to print out everything', required=False)
parser.add_argument('-phred', '--phred-scale', action='store_true', help='Flag it to print out Phred scale QUAL (proper VCF format but more annoying to filter)', required=False)

mode = parser.add_mutually_exclusive_group()
mode.add_argument('-single',  '--single-sample',   action="store_true", help='Tumor-only mode')
mode.add_argument('-paired',  '--paired-samples',  action="store_true", help='Paired tumor-normal samples', required=False, default=True)

args = parser.parse_args()

# Rename input:
tsv_fn = args.tsv_in
vcf_fn = args.vcf_out
tools = args.individual_mutation_tools
pass_score = args.pass_threshold
lowqual_score = args.lowqual_threshold
hom_threshold = args.hom_threshold
het_threshold = args.het_threshold

single_mode = args.single_sample
paired_mode = args.paired_samples

print_reject = args.emit_all
phred_scaled = args.phred_scale


MY_DIR = os.path.dirname(os.path.realpath(__file__))
try:
    with open(os.path.join(MY_DIR, "VERSION")) as version_info_file:
        version_line = version_info_file.readline()
except FileNotFoundError:
    version_line = '##SomaticSeq\n'

{'fraction_non_alphanumeric': 0.14848762603116408, 'fraction_numerical': 0.004766269477543538, 'mean_word_length': 4.8352941176470585, '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': '3658097', 'n_tokens_mistral': 1783, 'n_tokens_neox': 1731, 'n_words': 390}