PharmGKB / PharmCAT

The Pharmacogenomic Clinical Annotation Tool
Mozilla Public License 2.0
120 stars 39 forks source link

TypeError in vcf preprocess utilities script #88

Closed jcalendo closed 2 years ago

jcalendo commented 2 years ago

Hello,

I ran into a small error when attempting to run the preprocessing script using the input list option for multiple VCF files. The following line results in a TypeError when running PharmCAT_VCF_Preprocess.py with the --input_list option.

https://github.com/PharmGKB/PharmCAT/blob/12f409d64c554b27bd7ba4d6c49081d5395830a3/src/scripts/preprocessor/vcf_preprocess_utilities.py#L313

Casting i to a string allowed the script to complete:

temp_output_prefix = output_prefix + '_' + str(i)

Command used and error message

>python ~/data/gen4r/PharmCAT/src/scripts/preprocessor/PharmCAT_VCF_Preprocess.py --input_list input-list.txt --output_folder .
Saving output to .
Using default FASTA reference at  ./reference.fasta.bgz

Processing /home/gcalendo/data/gen4r/data/vcf/shapeit2-duohmm-phased/chr1.vcf.gz
Traceback (most recent call last):
  File "/home/gcalendo/data/gen4r/PharmCAT/src/scripts/preprocessor/PharmCAT_VCF_Preprocess.py", line 217, in <module>
    run(args)
  File "/home/gcalendo/data/gen4r/PharmCAT/src/scripts/preprocessor/PharmCAT_VCF_Preprocess.py", line 136, in run
    vcf_pgx_regions = util.extract_regions_from_multiple_files(bcftools_path, tabix_path, bgzip_path, input_list,
  File "/mnt/data/data_gc/gen4r/PharmCAT/src/scripts/preprocessor/vcf_preprocess_utilities.py", line 313, in extract_regions_from_m
ultiple_files
    temp_output_prefix = output_prefix + '_' + i
TypeError: can only concatenate str (not "int") to str

Where input-list.txt contains:

/home/gcalendo/data/gen4r/data/vcf/shapeit2-duohmm-phased/chr1.vcf.gz
/home/gcalendo/data/gen4r/data/vcf/shapeit2-duohmm-phased/chr2.vcf.gz
/home/gcalendo/data/gen4r/data/vcf/shapeit2-duohmm-phased/chr3.vcf.gz
/home/gcalendo/data/gen4r/data/vcf/shapeit2-duohmm-phased/chr4.vcf.gz
...

Version Info

BinglanLi commented 2 years ago

Thank you for reporting this error. This has been fixed in the development branch and will be included in the next PharmCAT release.