INNER CODE UNIT · Python
_preprocess
PharmGKB/PharmCAT · preprocessor/pcat/preprocess.py:130
def _preprocess(pharmcat_positions_vcf: Path, reference_genome: Path, regions_to_retain, custom_regions: bool,
vcf_files: list[Path], samples: list[str],
output_dir: Path, output_basename: str = '',
keep_intermediate_files: bool = False,
absent_to_ref: bool = False, unspecified_to_ref: bool = False,
concurrent_mode=False, max_processes=1, verbose: int = 0) -> Path:
# shrink input VCF down to PGx allele defining regions and selected samples
# standardize chromosome names to <chr##>
pgx_region_vcf: Path = util.extract_pgx_regions(vcf_files, samples,
output_dir, output_basename,
regions_to_retain,
concurrent_mode=concurrent_mode, max_processes=max_processes,
verbose=verbose)
# normalize the input VCF
normalized_vcf = util.normalize_vcf(reference_genome, pgx_region_vcf, output_dir, output_basename, verbose=verbose)
# extract the specific PGx genetic variants in the reference PGx VCF