Skip to content

Commit

Permalink
add strand depth for gatk /issues/52
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyphelan committed Oct 14, 2024
1 parent e44093e commit 104116c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pathogenprofiler/variant_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class GatkCaller(VariantCaller):
def call_variants(self) -> Vcf:
# Call variants using GATK
if self.platform=="illumina":
self.calling_cmd = "samtools view -T %(ref_file)s -h %(bam_file)s {region} %(samclip_cmd)s | samtools view -b > %(temp_file_prefix)s.{region_safe}.tmp.bam && samtools index %(temp_file_prefix)s.{region_safe}.tmp.bam && gatk HaplotypeCaller -R %(ref_file)s -I %(temp_file_prefix)s.{region_safe}.tmp.bam -O /dev/stdout -L {region} %(calling_params)s -OVI false | bcftools norm -f %(ref_file)s -Oz -o %(temp_file_prefix)s.{region_safe}.vcf.gz" % vars(self)
self.calling_cmd = "samtools view -T %(ref_file)s -h %(bam_file)s {region} %(samclip_cmd)s | samtools view -b > %(temp_file_prefix)s.{region_safe}.tmp.bam && samtools index %(temp_file_prefix)s.{region_safe}.tmp.bam && gatk HaplotypeCaller -A StrandBiasBySample -R %(ref_file)s -I %(temp_file_prefix)s.{region_safe}.tmp.bam -O /dev/stdout -L {region} %(calling_params)s -OVI false | bcftools norm -f %(ref_file)s -Oz -o %(temp_file_prefix)s.{region_safe}.vcf.gz" % vars(self)
else:
raise NotImplementedError("%s not implemented for %s platform" % (self.__software__,self.platform))
return self.run_calling(self.calling_cmd)
Expand Down
3 changes: 3 additions & 0 deletions pathogenprofiler/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def get_stand_support(var: pysam.VariantRecord,alt: str) -> Tuple[int,int]:
elif 'ADF' in var.samples[0]:
forward_support = var.samples[0]['ADF'][alt_index+1]
reverse_support = var.samples[0]['ADR'][alt_index+1]
elif 'SB' in var.samples[0]:
forward_support = var.samples[0]['SB'][(alt_index+1)*2]
reverse_support = var.samples[0]['SB'][(alt_index+1)*2+1]
else:
forward_support = None
reverse_support = None
Expand Down

0 comments on commit 104116c

Please sign in to comment.