Hot answers tagged

19 votes
Accepted

Converting a BAM file into VCF

It's not really possible to convert bam to vcf. bam is a mapping file, it does not contain ...
user avatar
  • 5,287
16 votes
Accepted

What's the difference between VCF spec versions 4.1 and 4.2?

This is easy to check, you can download both specs in .tex format and do diff. Changes to the v4.2 compared to v4.1: Information field format: adding source and ...
user avatar
11 votes
Accepted

How to concatenate "by chromosome"-VCFs?

I would recommend bcftools concat. You can't just cat them together because each file has a header section. The bcftools command will handle all that for you. ...
user avatar
  • 2,556
10 votes

How to subset samples from a VCF file?

Bcftools has sample/individual filtering as an option for most of the commands. You can subset individuals by using the -s or -S ...
user avatar
  • 11.7k
9 votes

Tools to create annotated table of variants from VCF

Hail might be an option for you. It is actively developed by a growing team at the Broad. It is rigorously tested (continuous integration, continuous deployment, bug reports get regression tests, ...
user avatar
9 votes
Accepted

Are variant calling files personally identifiable information?

TLDR: yes! be careful with someone's genomic data! There are two aspects to this question: can I find a match for a random VCF in a database of genomes (YES) or can I identify a subject who is not in ...
user avatar
8 votes
Accepted

GRCh38 vcf file with common cancer mutations

Your question doesn't give enough information for a specific answer but this should do for a start. Get the VCF file describing all variants in Clinvar from NCBI: ...
user avatar
  • 8,111
8 votes
Accepted

How to read structural variant VCF?

I just received a reply from 1000Genomes regarding this. I'll post it in its entirety below: Looking at the example you mention, I find it difficult to come up with an interpretation of the ...
user avatar
  • 19.2k
8 votes

Is there an easy way to create a summary of a VCF file (v4.1) with structural variations?

According to the bcftools man page, it is able to produce statistics using the command bcftools stats. Running this myself, the ...
user avatar
  • 11.7k
8 votes

GRCh38 vcf file with common cancer mutations

If you are looking for cancer mutations, the primary resource is COSMIC and they provide GRCh38 VCFs. The download page is here: http://cancer.sanger.ac.uk/cosmic/download It'll be up to you how you ...
user avatar
  • 2,099
8 votes
Accepted

Using Python, how to convert a pandas DataFrame into a VCF?

You will have to define the header either from an existing VCF file or hardcoded into you python script. Then write the header the the output VCF file then write the dataframe to the same file with ...
user avatar
  • 2,556
8 votes

ethnicity check either from bam or vcf files

The main difficulty here is the use of GRCh38. Unfortunately, despite the fact that it's more than four years old, the major ethnicity-labeled public datasets (1000 Genomes, gnomAD when allele ...
user avatar
8 votes
Accepted

How to subset a VCF by chromosome and keep the header?

This seems to work for me with bcftools filter and the -r or -R argument. ...
user avatar
  • 11.7k
8 votes

Are variant calling files personally identifiable information?

Yes, definitely identifiable. The combination of ~80 unlinked common SNPs can be fairly unique in the entire human population, let alone the whole VCF file. EDIT: 30 in the original answer is an ...
user avatar
  • 5,735
7 votes

How to manipulate a reference FASTA or bam to include variants from a VCF?

GATK has a solution that might work for you: FastaAlternateReferenceMaker, which : "Given a variant callset, this tool replaces the reference bases at variation sites with the bases supplied in the ...
user avatar
  • 841
7 votes
Accepted

Given a VCF of a human genome, how do I assess the quality against known SNVs?

To achieve (at least some of) your goals, I would recommend the Variant Effect Predictor (VEP). It is a flexible tool that provides several types of annotations on an input .vcf file. I agree that ...
user avatar
  • 366
7 votes
Accepted

Converting VCF file to PLINK bed/bim/fam files

Given that Plink reads in VCF files natively, and Plink is your desired output format, I expect that plink --vcf <file> would be the best option. As mentioned ...
user avatar
  • 11.7k
7 votes
Accepted

Are duplicate variants against the VCF standard?

No. The only point the specification makes is that: It is permitted to have multiple records with the same POS I suspect this is intended to let the file list different variants occurring at the ...
user avatar
  • 350
6 votes
Accepted

Is there an easy way to create a summary of a VCF file (v4.1) with structural variations?

The "my own parser" solutions. The information I was searching for in part of column INFO, namely in variables SVLEN and ...
user avatar
  • 5,287
6 votes
Accepted

How to represent a deletion at position 1 in a VCF file?

From the latest VCF specs (page 8): REF - reference base(s): Each base must be one of A,C,G,T,N (case insensitive). Multiple bases are permitted. The value in the POS field refers to the position of ...
user avatar
6 votes

How to check if indels in VCF files are left or right aligned?

One possibility is to run bcftools norm on the file. At the end it will print out a statistic about how many variants were realigned. I did this for dbSNPv151 (GRCh38) only for chromosome 22 like this:...
user avatar
  • 1,332
6 votes
Accepted

Fix dash/empty ALT alleles for deletions in VCF

According to the specs the ALT is not allowed to contain -. Here is a little python (>=3.6) script that is able to fix it. It makes use of the pysam module. You ...
user avatar
  • 1,332
5 votes

Given a VCF of a human genome, how do I assess the quality against known SNVs?

The greatest protein coding variant catalogue is definitely ExAC (>65k individuals). They also published a blogpost where they describe how to reproduce figures in the paper (it is a good start how to ...
user avatar
  • 5,287
5 votes
Accepted

How do I carry out an ancestry/admixture test on a single VCF file?

A modified implementation of Vivek's answer. peddy is a Python package that samples an input .vcf at ~25000 sites and projects onto a principal component space ...
user avatar
  • 366
5 votes

How to convert the .vcf (imputed) file with GT:GP format to GT:DS?

You can do this in Hail. Here's the rough code to do it (0.1 versions). Setup: from hail import * hc = HailContext() Import the .gen file. VCF works too: <...
user avatar
  • 151
5 votes

How can I extract only insertions from a VCF file?

Just to highlight that all the steps can be done within bcftools capabilities, and since I can't just comment on @blmoore 's answer: ...
user avatar
  • 353
5 votes

Selecting sites from VCF which have an alt AD > 10

using vcfilterjs and the following script: ...
user avatar
  • 1,473
5 votes
Accepted

Tools to create annotated table of variants from VCF

I have used FEATnotator and I think it can provide all of the columns you would like to see. There are many output files generated, but the consolidated output has the following columns: Chromosome ...
user avatar
  • 128
5 votes

Tools to create annotated table of variants from VCF

snpEff is a great tool for annotating VCF files and you can add custom reference sequences. http://snpeff.sourceforge.net/ Guide to add custom annotation files in snpEff https://gatkforums....
user avatar
  • 584
5 votes
Accepted

Converting a VCF into a FASTA given a reference with Python, R

You can whip up something quite easily in Python using pyfaidx, which allows you to access a FASTA file by genomic coordinates. So you'd just have to pull the coordinates from the VCF to get the ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible