You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat file.vcf
##fileformat=VCFv4.2
##contig=<ID=1,length=249250621>
##INFO=<ID=rsID,Number=1,Type=String,Description="dbSNP rsID">
#CHROM POS ID REF ALT QUAL FILTER INFO
1 564621 . C T . . rsID=rs10458597
I can now use --set-id to copy the rsID field in the INFO field:
$ bcftools annotate --no-version --set-id %rsID file.vcf
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=1,length=249250621>
##INFO=<ID=rsID,Number=1,Type=String,Description="dbSNP rsID">
#CHROM POS ID REF ALT QUAL FILTER INFO
1 564621 rs10458597 C T . . rsID=rs10458597
But if I try to combine the --set-id with the --remove option:
static void annotate(args_t *args, bcf1_t *line)
{
int i, j;
for (i=0; i<args->nrm; i++)
args->rm[i].handler(args, line, &args->rm[i]);
...
if ( args->set_ids )
{
args->tmpks.l = 0;
convert_line(args->set_ids, line, &args->tmpks);
if ( args->tmpks.l )
{
int replace = 0;
if ( args->set_ids_replace ) replace = 1;
else if ( !line->d.id || (line->d.id[0]=='.' && !line->d.id[1]) ) replace = 1;
if ( replace )
bcf_update_id(args->hdr_out,line,args->tmpks.s);
}
}
...
}
Where annotations are removed before IDs are set. Would it be enough to swap the order here? Though I believe swapping the order would make --set-id only work on fields present before --annotations/--columns is resolved. It should at a least be clarified that --set-id operates on fields present after --annotations/--columns and --remove are resolved and an error should be generated if the field that --set-id wants to access is not present anymore.
The text was updated successfully, but these errors were encountered:
Generate a simple VCF:
It should look like this:
I can now use
--set-id
to copy the rsID field in the INFO field:But if I try to combine the
--set-id
with the--remove
option:I think the problem originates in
vcfannotate.c
:Where annotations are removed before IDs are set. Would it be enough to swap the order here? Though I believe swapping the order would make
--set-id
only work on fields present before--annotations/--columns
is resolved. It should at a least be clarified that--set-id
operates on fields present after--annotations/--columns
and--remove
are resolved and an error should be generated if the field that--set-id
wants to access is not present anymore.The text was updated successfully, but these errors were encountered: