tgen / vcfMerger2

Dynamic vcfMerger for 2 to N somatic variants vcf files
Other
5 stars 1 forks source link

lancet issue when vcf NOT filtered by PASS #15

Closed ChristopheLegendre closed 4 years ago

ChristopheLegendre commented 4 years ago

When VCF is not Filtered by PASS, the genotype for variants contains dots and not zeros or one such as: GT:AD:SR:SA:DP .:0,0:0,0:0,0:0 1/1:0,5:0,0:4,1:5

Having a dot will raise an error while running script addFieldsForVcfMerger2:

Traceback (most recent call last):
  File "${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py", line 391, in <module>
    v = process_records(tot_number_samples, v, col_tumor, col_normal)
  File "${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py", line 366, in process_records
    return process_GTs(tot_number_samples, v, col_tumor, col_normal)
  File "${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py", line 300, in process_GTs
    GTs[idxN] = get_GT_value_from_GT_value(GTOs[idxN])  ## we do not modify the GT field for the Normal sample
  File "${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py", line 265, in get_GT_value_from_GT_value
    x = GenotypeInv(list(GT_value))
  File "${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py", line 65, in __init__
    self.phased = bool(0) if li[1] == "/" else bool(1)
IndexError: list index out of range
ERROR: ${HOME}/gits/vm2_0.7.7/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py  FAILED ;
exit_value:1 ; Aborting!

The Genotype ./. or only . is not taken into account by the Genotype Class.

ChristopheLegendre commented 4 years ago

Fix: https://github.com/tgen/vcfMerger2/blob/8300dac94b13c85540cf56c476aa542e239fa888/prep_vcfs_somatic/lancet/lancet.somatic.addFieldsForVcfMerger.py#L64-L71

Added a check if genotype is only a dot.