Question: bcftools reheader -h
1
gravatar for marta.rusmini
15 months ago by
marta.rusmini10 wrote:

Hi sorry for the very basic question! I would like to change the tags of the INFO fields of my vcf. I saw the bcftools -reader option but I cannot understand the format of the newheader.vcf that I need. Can anyone help me? I will appreciate help in order to a)create the new file needed for the script b)write the script (is it correct

bcftools reheader -h newheader.vcf filetochange.vcf

?

here an example of part of a header that I want to modify (i would like to change the ID=xxx)

##INFO=<ID=dbNSFP_ExAC_NFE_AF,Number=A,Type=Float,Description="Field 'ExAC_NFE_AF' from dbNSFP">
##INFO=<ID=dbNSFP_ExAC_SAS_AF,Number=A,Type=Float,Description="Field 'ExAC_SAS_AF' from dbNSFP">
##INFO=<ID=dbNSFP_GERP___RS,Number=A,Type=Float,Description="Field 'GERP++_RS' from dbNSFP">
##INFO=<ID=dbNSFP_GERP___NR,Number=A,Type=Float,Description="Field 'GERP++_NR' from dbNSFP">
##INFO=<ID=dbNSFP_ExAC_Adj_AC,Number=A,Type=Integer,Description="Field 'ExAC_Adj_AC' from dbNSFP">
##INFO=<ID=dbNSFP_ExAC_Adj_AF,Number=A,Type=Float,Description="Field 'ExAC_Adj_AF' from dbNSFP">
##INFO=<ID=dbNSFP_ExAC_SAS_AC,Number=A,Type=Integer,Description="Field 'ExAC_SAS_AC' from dbNSFP">
##INFO=<ID=dbNSFP_1000Gp3_AMR_AF,Number=A,Type=Float,Description="Field '1000Gp3_AMR_AF' from dbNSFP">
##INFO=<ID=dbNSFP_1000Gp3_AMR_AC,Number=A,Type=Integer,Description="Field '1000Gp3_AMR_AC' from dbNSFP">
##INFO=<ID=dbNSFP_MetaSVM_pred,Number=A,Type=Character,Description="Field 'MetaSVM_pred' from dbNSFP">
##INFO=<ID=dbNSFP_1000Gp3_EAS_AC,Number=A,Type=Integer,Description="Field '1000Gp3_EAS_AC' from dbNSFP">

thank you!

bcftools format header • 1.6k views
ADD COMMENTlink modified 7 months ago by whitneyt0 • written 15 months ago by marta.rusmini10

Hello!

I have come across this thread and am wondering if I open my VCF file as a text file, can I edit the header manually?

I need to remove the

##contig=<ID=0,length=2147483645>

and change :

##contig=<ID=24,length=28817459>
##contig=<ID=25,length=155234708>
##contig=<ID=26,length=16391>

to

##contig=<ID=X,length=28817459>
##contig=<ID=Y,length=155234708>
##contig=<ID=MT,length=16391>

Can I do this in the text editor window and then resave file as a new .vcf? Instead of using bcftools?

thank you!!

ADD REPLYlink written 7 months ago by whitneyt0

try bcftools reheader -f option .fai file option to change contig names and lengths

$ bcftools reheader -f XXX.fasta.fai old.vcf -o new.vcf
ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by hiruna720
2
gravatar for finswimmer
15 months ago by
finswimmer13k
Germany
finswimmer13k wrote:

bcftools reheader is for replacing the complete header of your vcf file. If this ist what you want to do, create a text file with the new header as the content, e.g. header.hr:

##fileformat=VCFv4.1
##INFO=<ID=CSQ,Number=.,Type=String,Description="some text">
##INFO=<ID=NEW,Number=.,Type=String,Description="some text">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO

As you can see you also need to define the columns!

Than you can replace the old header with the new one with:

$ bcftools reheader -h header.hr input.vcf > output.vcf
ADD COMMENTlink written 15 months ago by finswimmer13k
0
gravatar for Pierre Lindenbaum
15 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum128k wrote:

bcftools annotate https://samtools.github.io/bcftools/bcftools.html

-c, --columns list

The imported VCF annotations can be renamed as "DST_TAG:=SRC_TAG" or "FMT/DST_TAG:=FMT/SRC_TAG".

ADD COMMENTlink written 15 months ago by Pierre Lindenbaum128k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1013 users visited in the last hour