From 5859d2bd3108daf3dd0ac0904c6972d807a31abb Mon Sep 17 00:00:00 2001 From: Thorfinn Date: Wed, 24 Feb 2021 20:26:19 +0100 Subject: [PATCH] Added some INFO tags to bcf that would be used if input is bcf --- abcWriteBcf.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/abcWriteBcf.cpp b/abcWriteBcf.cpp index 9794e131..33544f37 100644 --- a/abcWriteBcf.cpp +++ b/abcWriteBcf.cpp @@ -39,7 +39,6 @@ void abcWriteBcf::run(funkyPars *pars){ //last is from abc.h void print_bcf_header(htsFile *fp,bcf_hdr_t *hdr,argStruct *args,kstring_t &buf,const bam_hdr_t *bhdr){ - if(args->ref){ buf.l = 0; ksprintf(&buf, "##reference=file://%s\n", args->ref); @@ -133,7 +132,6 @@ void abcWriteBcf::print(funkyPars *pars){ for(int s=0;snumSites;s++){ if(pars->keepSites[s]==0) continue; - rec->rid = bcf_hdr_name2id(hdr,header->target_name[pars->refId]); rec->pos = pars->posi[s];//<- maybe one index? // bcf_update_id(hdr, rec, "rs6054257"); @@ -146,19 +144,18 @@ void abcWriteBcf::print(funkyPars *pars){ // .. INFO tmpi = pars->keepSites[s]; - bcf_update_info_int32(hdr, rec, "NS", &tmpi, 1); + assert(bcf_update_info_int32(hdr, rec, "NS", &tmpi, 1)==0); if(pars->counts){ int depth = 0; for(int i=0; i<4*pars->nInd; i++) depth += pars->counts[s][i]; tmpi = depth; - bcf_update_info_int32(hdr, rec, "DP", &tmpi, 1); - + assert(bcf_update_info_int32(hdr, rec, "DP", &tmpi, 1)==0); } if(freq){ float tmpf = freq->freq_EM[s]; - bcf_update_info_float(hdr, rec, "AF", &tmpf, 1); + assert(bcf_update_info_float(hdr, rec, "AF", &tmpf, 1)==0); } // .. FORMAT @@ -325,6 +322,9 @@ abcWriteBcf::abcWriteBcf(const char *outfiles_a,argStruct *arguments,int inputty bcf_hdr_append(hdr,"##FORMAT="); bcf_hdr_append(hdr,"##FORMAT="); bcf_hdr_append(hdr,"##FORMAT="); + bcf_hdr_append(hdr,"##INFO="); + if(doMaf) + bcf_hdr_append(hdr,"##INFO="); ksprintf(&buf, "##angsdVersion=%s",args->version); bcf_hdr_append(hdr, buf.s); buf.l = 0;