Skip to content

Instantly share code, notes, and snippets.

@obenshaindw
Last active August 21, 2023 21:47
Show Gist options
  • Save obenshaindw/99440ac43de07548e453 to your computer and use it in GitHub Desktop.
Save obenshaindw/99440ac43de07548e453 to your computer and use it in GitHub Desktop.
Add dbSNP IDs to a VCF file that doesn't have them.
#GATK Method <- Slower and keeps original ID plut dbSNP rsID
# R=Reference FASTA
# V=VCF file to add IDs to
# --dbsnp = dbsnp VCF -- download from NCBI FTP
java -jar GenomeAnalysisTK.jar -R /reference/Homo_sapiens_assembly19.fasta -T VariantAnnotator -V vcf_to_add_id_to.vcf --dbsnp /reference/dbsnp_137.b37.vcf.gz --out /data/Broad.chr1.annotated.vcf
#bcftools Method <- Faster, replaces existing ID with dbSNP rsID
/usr/bin/htslib/bcftools/bcftools annotate -a /reference/dbsnp_137.b37.vcf.gz -c ID vcf_to_add_id_to.vcf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment