Skip to content

Commit bb6d531

Browse files
committed
Fix an error in parsing -i/-e command line options,
the `qry:` and `gt:` prefix was not stripped Resolves #2432
1 parent 8c1deea commit bb6d531

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Changes affecting specific commands:
2323
when the site is monoallelic in both query and genotype file. The new option --keep-refs
2424
allows to always include monoallelic sites.
2525

26+
- Fix an error in parsing -i/-e command line options where the `qry:` and `gt:` prefix was
27+
not stripped (#2432)
28+
2629
* bcftools norm
2730

2831
- Make the -i/-e filtering option work for all options, such as line merging and

vcfgtcheck.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,13 +1324,13 @@ int main_vcfgtcheck(int argc, char *argv[])
13241324
if ( !strncasecmp("gt:",optarg,3) )
13251325
{
13261326
if ( args->gt_filter_str ) error("Error: only one -i or -e expression can be given for gt:, and they cannot be combined\n");
1327-
args->gt_filter_str = optarg;
1327+
args->gt_filter_str = optarg+3;
13281328
args->gt_filter_logic |= FLT_EXCLUDE;
13291329
}
13301330
else if ( !strncasecmp("qry:",optarg,4) )
13311331
{
13321332
if ( args->qry_filter_str ) error("Error: only one -i or -e expression can be given for qry:, and they cannot be combined\n");
1333-
args->qry_filter_str = optarg;
1333+
args->qry_filter_str = optarg+4;
13341334
args->qry_filter_logic |= FLT_EXCLUDE;
13351335
}
13361336
else
@@ -1355,13 +1355,13 @@ int main_vcfgtcheck(int argc, char *argv[])
13551355
if ( !strncasecmp("gt:",optarg,3) )
13561356
{
13571357
if ( args->gt_filter_str ) error("Error: only one -i or -e expression can be given for gt:, and they cannot be combined\n");
1358-
args->gt_filter_str = optarg;
1358+
args->gt_filter_str = optarg+3;
13591359
args->gt_filter_logic |= FLT_INCLUDE;
13601360
}
13611361
else if ( !strncasecmp("qry:",optarg,4) )
13621362
{
13631363
if ( args->qry_filter_str ) error("Error: only one -i or -e expression can be given for qry:, and they cannot be combined\n");
1364-
args->qry_filter_str = optarg;
1364+
args->qry_filter_str = optarg+4;
13651365
args->qry_filter_logic |= FLT_INCLUDE;
13661366
}
13671367
else

0 commit comments

Comments
 (0)