Skip to main content
11 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. ...
gringer's user avatar
  • 14.3k
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. ...
Bioathlete's user avatar
  • 2,574
8 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 ...
gringer's user avatar
  • 14.3k
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 ...
Migwell's user avatar
  • 375
6 votes

Variant calling without matched normal sample

If you just want to filter out calls present in dbSNP then use: ...
Devon Ryan's user avatar
  • 19.6k
5 votes

extracting last few lines of a growing bgzip compressed .vcf.gz file

27GB is not huge. You can zcat the file and see the last few lines. It will take ~10 minutes. It is theoretically possible to peek a bgzf file, but no such tools ...
user172818's user avatar
  • 6,535
5 votes
Accepted

Sort vcf by contig and position within contig

You could simply use bcftools sort for it: $ bcftools sort input.vcf > output.vcf If you really want to use bash only, you can do this: ...
finswimmer's user avatar
  • 1,342
4 votes
Accepted

Output from vcftools missingness

Humans are diploid, so you can expect to see up to 2*N (2*68=136) alleles, so N_DATA is the number of observances of that allele.
spvensko's user avatar
4 votes

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

You can use grep for this. The problem is the -w flag which means "match entire words", but VCF header lines start with ...
terdon's user avatar
  • 10.2k
3 votes

Converting VCF file to PLINK bed/bim/fam files

Additional tidbit I learned in the last year that I wanted to share with anyone else that's working on this. Plink creates an extremely generic fam file for you, but if you are updating this fam file ...
Sarah's user avatar
  • 516
3 votes

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

You can do this more easily with the GATK tool SelectVariants, which allows you to subset variants based on various criteria. Here's the doc page: https://gatk.broadinstitute.org/hc/en-us/articles/...
Geraldine_VdAuwera's user avatar
2 votes

How to concatenate "by chromosome"-VCFs?

use picard GatherVcf: http://broadinstitute.github.io/picard/command-line-overview.html#GatherVcfs Gathers multiple VCF files from a scatter operation into a single VCF file. Input files must be ...
Pierre's user avatar
  • 1,536
2 votes

How to concatenate "by chromosome"-VCFs?

The best tool for the job is probably bcftools as suggested by Bioathlete, but you can also do this manually. You just need to collect all header lines from all vcf ...
terdon's user avatar
  • 10.2k
2 votes

Sort vcf by contig and position within contig

Use a subshell. First print the header and then the variant lines, sorting by chromosome and position: ...
atongsa's user avatar
  • 131
2 votes

VCF-merge fails due to tabix not producing .tbi files

You should go with the CSI index as it seems like the BAI indexes cannot handle chromosomes longer than 2^29. Your problem is that you're trying to merge the index files using ...
Ram RS's user avatar
  • 2,390
2 votes
Accepted

How to extract all variant alleles that do not match "./." from the GT column of a vcf file?

I checked one of your files, LUD.TH179.PASS.dbsnp_cosmic.vcf.gz, and can confirm that none of the samples listed in the VCF have a genotype for any of the variants. ...
terdon's user avatar
  • 10.2k
2 votes

Masking sites in a vcf file

I've tried many ways to do this with bcftools but don't think it's possible to exclude a bed file. What you want is ...
pgcudahy's user avatar
  • 152
1 vote

How can I filter variants in a VCF file based on size?

Vcftools allows you to filter to include or not include a list of sites. https://vcftools.github.io/man_latest.html#SITE%20FILTERING%20OPTIONS If you can first grab the locations of indels of this ...
Sarah's user avatar
  • 516
1 vote

Masking sites in a vcf file

If you are familiar with Python, check out the pyvcf.VcfFrame.filter_bed() method I wrote: ...
Seung-been Steven Lee's user avatar
1 vote
Accepted

VCF's unknown ('.') values causing problems for GATK's Liftover Vcf

My problem was solved using --ALLOW-MISSING-FIELDS-IN-HEADER.
CelineDion's user avatar
1 vote

vcftools: indel size histogram command returns empty file

It looks like lumpy looks for breakpoints in your reference. Presumably places where the is a haplotype switch detectable with the data on-hand? My only thought is ...
conchoecia's user avatar
  • 3,181

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