Skip to content

Commit

Permalink
feat(preprocessor): an option to not perform a gVCF check
Browse files Browse the repository at this point in the history
Bypass the issue when INFO/END is used in cases other than a gVCF or structural variations.

Fix-for: #174
  • Loading branch information
BinglanLi committed Mar 5, 2024
1 parent b86639e commit 209f68f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 11 additions & 5 deletions preprocessor/pharmcat_vcf_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
help="(Optional) a path to the bcftools program. Defaults to bcftools in PATH.")
advanced_group.add_argument("-bgzip", "--path-to-bgzip", type=str, metavar='</path/to/bgzip>',
help="(Optional) a path to the bgzip program. Defaults to bgzip in PATH.")
advanced_group.add_argument("-G", "--no-gvcf-check", action="store_true",
help="(Optional) do not check whether input is a gVCF, false by default.")

parser.add_argument("-v", "--verbose", action="count", default=0,
help="(Optional) print more verbose messages")
Expand Down Expand Up @@ -146,11 +148,15 @@
print("Error: no VCF input")
sys.exit(1)

for file in m_vcf_files:
if preprocessor.is_gvcf_file(file):
print('%s is a gVCF file, which is not currently supported.\n'
'The PharmCAT VCF Preprocessor will support block gVCF in the future.' % str(file))
sys.exit(1)
# check whether input is a gVCF, which currently does not support yet
if args.no_gvcf_check:
print('\nBypass the gVCF check.\n')
else:
for file in m_vcf_files:
if preprocessor.is_gvcf_file(file):
print('%s is a gVCF file, which is not currently supported.\n'
'The PharmCAT VCF Preprocessor will support block gVCF in the future.' % str(file))

This comment has been minimized.

Copy link
@markwoon

markwoon Mar 7, 2024

Contributor

Suggest instead:

print('%s is a gVCF file, which is not currently supported.\n'
      'See https://github.com/PharmGKB/PharmCAT/issues/79 for details.\n'
      'If this is not a gVCF file, use -G to bypass.' % str(file))
sys.exit(1)

m_samples: List[str] = []
if args.sample_file:
Expand Down
5 changes: 0 additions & 5 deletions preprocessor/preprocessor/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,6 @@ def extract_pgx_variants(pharmcat_positions: Path, reference_fasta: Path, vcf_fi
fields = line.split('\t')
input_chr_pos = (fields[0], fields[1])

# check whether input is a block gVCF
# this is a backup check - it should already have been checked earlier
if re.search('END', fields[7]):
raise ReportableException('gVCF is not supported')

# match chromosome positions
if input_chr_pos in ref_pos_static:
'''
Expand Down

0 comments on commit 209f68f

Please sign in to comment.