INNER CODE UNIT · Python
preprocess
PharmGKB/PharmCAT · preprocessor/pcat/preprocess.py:47
def preprocess(pharmcat_positions_vcf: Path, reference_genome: Path, regions_to_retain, custom_regions: bool,
vcf_files: list[Path], samples: list[str], input_basename: str,
output_dir: Path, output_basename: str = '', split_samples: bool = False,
keep_intermediate_files: bool = False,
absent_to_ref: bool = False, unspecified_to_ref: bool = False,
concurrent_mode: bool = False, max_processes: int = 1, verbose: int = 0) -> list[Path]:
"""
Normalize and prepare the input VCF for PharmCAT.
"""
if len(vcf_files) == 0:
raise ReportableException('Missing VCF input')
# make sure we have samples
if samples is None or len(samples) == 0:
samples = util.read_vcf_samples(vcf_files[0], verbose=verbose)
else:
# make sure samples are in the vcf file
vcf_samples = util.read_vcf_samples(vcf_files[0], verbose=verbose)