This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bcftools extracting list of markers by chr and pos

I want to extract a list of markers from the vcf file. However, many of these markers don't have rsID, and I was wondering if is possible to extract the list of markers with bcftools using just their Chr and Pos as input?

bcftools

1 answer

read the manual for the option --regions-file https://samtools.github.io/bcftools/bcftools.html

The columns of the tab-delimited file can contain either positions (two-column format: CHROM, POS) or intervals (three-column format: CHROM, BEG, END), but not both. Positions are 1-based and inclusive.

Figured it out! For anyone who might need it:

bcftools view -R CHR_BP_tab.txt file.vcf.gz > file_extracted.vcf.gz

CHR_BP_tab.txt is tab-delimited file with chromosomal and base positions, without header

Figured what out? Pierre showed you the exact option to use as well as how to provide the input file.

Log in to answer this question.