# Tag Info

18

It's not really possible to convert bam to vcf. bam is a mapping file, it does not contain the information about variants, this information needs to be inferred in process called variant calling. I find important to mention that it's not just a different format of the same thing. How to call variants (a vcf file) from mapped reads (a bam file) is very broad ...

17

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 version as recommended fields. INFO field can have one value for each possible allele (code R). For all of the ##INFO, ##FORMAT, ##FILTER, and ##ALT metainformation, extra fields can be included ...

10

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. Each vcf file must be sorted prior to calling concat bcftools concat -o total_chroms.vcf chr1.vcf chr2.vcf chr3.vcf ... chrX.vcf

10

Bcftools has sample/individual filtering as an option for most of the commands. You can subset individuals by using the -s or -S option: -s, --samples [^]LIST Comma-separated list of samples to include or exclude if prefixed with "^". Note that in general tags such as INFO/AC, INFO/AN, etc are not updated to correspond to the subset samples. bcftools ...

10

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 a (public) database. But even when it may not possible to identify the subject itself, using DTC genetic testing sites may enable you to identify (close or ...

9

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, blah blah blah). It was designed to solve this problem (among others). It can import a variety of formats, including VCF, TSV, UCSC BED, JSON and interval files....

8

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 information whereby the stated end seems to be correct, so believe that this may indeed be an error. Since the v4.0 was created, however, new versions of VCF ...

8

According to the bcftools man page, it is able to produce statistics using the command bcftools stats. Running this myself, the statistics look like what you're asking for: # This file was produced by bcftools stats (1.2-187-g1a55e45+htslib-1.2.1-256-ga356746) and can be plotted using plot-vcfstats. # The command line was: bcftools stats ...

8

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 the mode options set to 'a' to append to the end of the file. You will need to order the dataframe columns to match the VCF spec and insert the empty/ default ...

8

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 frequencies are enough) still aren't available for that reference. It is necessary to perform a liftover operation, or just use overlapping rsIDs and hope for the ...

8

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 underestimate. We need ~80 unlinked common SNPs to uniquely identify every individual to a low false positive rate. Here is the derivation based on the approximate ...

7

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 define "common", but the VCF includes a lot of information you can use.

7

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 corresponding callset records." Input The reference, requested intervals, and any number of variant ROD files. Output A FASTA file representing ...

7

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: wget ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/vcf_GRCh38/clinvar.vcf.gz Extract any variants whose VCF line contains the word "cancer": zgrep -iE '^#|CLNDBN=[^;]*cancer' clinvar.vcf.gz > ...

7

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 ExAC is the de facto gold standard catalog for human genetic variation in coding regions. To see the frequency distribution of variants by global subpopulation ...

7

This seems to work for me with bcftools filter and the -r or -R argument. -r, --regions chr|chr:pos|chr:from-to|chr:from-[,...] Comma-separated list of regions, see also -R, --regions-file. Note that -r cannot be used in combination with -R. -R, --regions-file FILE Regions can be specified either on command line or in a VCF, BED, or tab-...

6

The "my own parser" solutions. The information I was searching for in part of column INFO, namely in variables SVLEN and SVTYPE. very fast SV types + counts (by @user172818 in commnent) : zcat var.vcf.gz | perl -ne 'print "1\n" if /[;\t]SVTYPE=([^;\t]+)/' | sort | uniq -c quite slow SV types + counts + sizes : SV_colnames <- c('CHROM', 'POS', 'ID', '... 6 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 the first base in the String. For simple insertions and deletions in which either the REF or one of the ALT alleles would otherwise be null/empty, the REF and ... 6 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. There are caveats associated with the types of variants that Plink will pull in from the VCF files, mostly related to limitations of Plink's own file formats. But if your end-goal is Plink, then that should ... 6 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: bcftools view -i 'TYPE="indel"' dbSNP_GRCh38.p7_b151.vcf.gz 22|bcftools norm -Ou -f GRCh38.fa > /dev/null Lines total/split/realigned/skipped: 901503/...

6

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 same position, but this incidentally allows duplicate variants. This said, you probably don't want duplicate variants, because it will mess with any statistics ...

5

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 get familiar with the dataset). For the whole-genome variants I would look at the data created by 1000 genomes project (the latest release has more than 3k ...

5

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 built on 2504 thousand genome samples. The author has extensive documentation of the tool's features and a link to the preprint. I downloaded the .vcf and .vcf.tbi for the NA12878 sample from ...

5

using vcfilterjs and the following script: function accept(vc) { var i,j; for(i=0;i< vc.getNSamples();++i) { var genotype = vc.getGenotype(i); if(!genotype.hasAD()) continue; var ad = genotype.getAD(); /* loop over AD starting from '1' = first ALT */ for(j=1 ;j< ad.length ;++j) ...

5

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: dataset = hc.import_gen( 'src/test/resources/example.gen', 'src/test/resources/example.sample') Remap the genotype schema and export to VCF: dataset.annotate_genotypes_expr('g = {GT: g.call()...

5

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 Position Column_3 Consensus_Allele Annotation_Signature Reference_Base Alternate_Base Transition/Transversion SNP_Type ...

5

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.broadinstitute.org/gatk/discussion/50/adding-genomic-annotations-using-snpeff-and-variantannotator There are a bunch of pre curated annotation datasets available in ...

5

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 sequence, then output in FASTA format with whatever unique identifier for each sequence you want to use. Edit: The FastaVariant class is new in pyfaidx, I hadn't ...

5

Yes. I haven't found it documented anywhere, but I ran a simple test: $bcftools view -Oz --no-version foo.vcf > bar.vcf.gz$ md5sum bar.vcf.gz 18a2f494710cf170ba79892936015ba8 bar.vcf.gz $gunzip bar.vcf.gz$ bgzip bar.vcf $md5sum bar.vcf.gz 18a2f494710cf170ba79892936015ba8 bar.vcf.gz$ gunzip bar.vcf.gz $gzip bar.vcf$ md5sum bar.vcf.gz ...

5

On the GATK forum they've recommended the population stratified VCF file for this purpose.

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