Skip to content

Instantly share code, notes, and snippets.

@xiaojay
Forked from obenshaindw/Add dbSNP IDs to a VCF file
Created September 15, 2016 06:47
Show Gist options
  • Save xiaojay/e1f7ac1a72143e632648ac6a0c6b3290 to your computer and use it in GitHub Desktop.
Save xiaojay/e1f7ac1a72143e632648ac6a0c6b3290 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