Skip to content

Commit

Permalink
Updated man page and description of -r and -t made consistent across …
Browse files Browse the repository at this point in the history
…all bcftools
  • Loading branch information
pd3 committed Nov 13, 2013
1 parent 61e4275 commit 105c41e
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 33 deletions.
25 changes: 17 additions & 8 deletions bcftools.1
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,24 @@ without arguments.
.IP "\fB-o, --output-type \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR" 4
Output compressed BCF (\fIb\fR), uncompressed BCF (\fIu\fR), compressed VCF (\fIz\fR), uncompressed VCF (\fIv\fR).
.IP "\fB-r, --regions \fIfile\fR|\fIchr\fR|\fIchr:pos\fR|\fIchr:from-to\fR|\fIchr:from-\fR[,...]" 4
Regions can be specified either on command line or in a tab-delimited file.
The columns of the tab-delimited file are: CHROM, POS_FROM, and, optionally, POS_TO.
Multiple regions can be given, one per line when reading from a file or
separated by commas when specified on command line.
All positions are 1-based and inclusive. Note that sequence names must match exactly, "chr20" is not the same as "20".
Regions can be specified either on command line or in a VCF, BED, or tab-delimited file (the default).
The columns of the tab-delimited file are: CHROM, POS, and, optionally, POS_TO, where positions are 1-based and inclusive.
Uncompressed files are stored in memory, while \fBbgzip\fR-compressed and \fBtabix\fR-indexed region files are streamed.
Note that sequence names must match exactly, "chr20" is not the same as "20".
This option requires indexed VCF/BCF files.
.IP "\fB-t, --targets \fIfile\fR|\fIchr\fR|\fIchr:pos\fR|\fIchr:from-to\fR|\fIchr:from-\fR[,...]" 4
Same as \fB-r, --regions\fR, but the next position is accessed by streaming the whole VCF/BCF rather than using
the tbi/csi index. With the \fBcall -C \fIalleles\fR command, third column of the \fItargets\fR file must be comma-separated
list of alleles, starting with the reference allele.
the tbi/csi index. Both \fB-r\fR and \fB-t\fR options can be applied simultaneously: \fB-r\fR
uses the index to jump to a region and \fB-t\fR discards positions which are not in the targets.
Another difference between the two is that \fB-r\fR checks both start and end positions
of indels, whereas \fB-t\fR checks start positions only.
With the \fBcall -C \fIalleles\fR command, third column of the \fItargets\fR file must be comma-separated
list of alleles, starting with the reference allele. Such a file can be easily created from
a VCF by using:
.IP
.Vb 9
\& bcftools query -f'%CHROM\\t%POS\\t%REF,%ALT\\n' file.vcf
.Ve

.SS "Command-specific options"
.BR
Expand All @@ -92,8 +100,9 @@ list of alleles, starting with the reference allele.
.IP "\fB-C, --constrain\fR \fIalleles\fR|\fItrio\fR"
\fIalleles\fR, call genotypes given alleles. See also \fB-t, --targets\fR.
.IP ""
\fItrio\fR, ..
\fItrio\fR, call genotypes given the father-mother-child constraint. See also \fB-s, --samples\fR.
.IP "\fB-s, --samples\fR \fIfile\fR|\fIlist\fR"
List of samples to include, given as a comma-separated list, one sample per-line in a file or a PED file. With \fB-C \fItrio\fR, PED file is expected.
.RE
.P
.IP "\fBbcftools query\fR [\fIOPTIONS\fR]"
Expand Down
6 changes: 3 additions & 3 deletions vcfcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ static void usage(args_t *args)
fprintf(stderr, "Usage: bcftools call [options] <in.bcf|in.vcf|in.vcf.gz> [reg]\n");
fprintf(stderr, "File format options:\n");
fprintf(stderr, " -o, --output-type <b|u|z|v> output type: 'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
fprintf(stderr, " -r, --region <reg|file> restrict to comma-separated list of regions or regions listed in tab-delimited indexed file\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -s, --samples <list|file> sample list, PED file or a file with optional second column for ploidy (0, 1 or 2) [all samples]\n");
fprintf(stderr, " -t, --targets <reg|file> same as -r but streams rather than index-jumps to it. Coordinates are 1-based, inclusive\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, "\nInput/output options:\n");
fprintf(stderr, " -A, --keep-alts keep all possible alternate alleles at variant sites\n");
fprintf(stderr, " -N, --skip-Ns skip sites where REF is not A/C/G/T\n");
Expand Down Expand Up @@ -391,7 +391,7 @@ int main_vcfcall(int argc, char *argv[])
{
{"help",0,0,'h'},
{"output-type",1,0,'o'},
{"region",1,0,'r'},
{"regions",1,0,'r'},
{"samples",1,0,'s'},
{"targets",1,0,'t'},
{"keep-alts",0,0,'A'},
Expand Down
4 changes: 2 additions & 2 deletions vcffilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ static void usage(args_t *args)
fprintf(stderr, " -i, --include <expr> include only sites for which the expression is true\n");
fprintf(stderr, " -m, --mode <+|x> \"+\": do not replace but add to existing FILTER; \"x\": reset filters at sites which pass\n");
fprintf(stderr, " -o, --output-type <b|u|z|v> b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
fprintf(stderr, " -r, --regions <reg|file> same as -t but index-jumps rather than streams to a region (requires indexed VCF/BCF)\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -s, --soft-filter <string> annotate FILTER column with <string> or unique filter name (\"Filter%%d\") made up by the program (\"+\")\n");
fprintf(stderr, " -t, --targets <reg|file> restrict to positions in tab-delimited tabix indexed file <chr,pos> or <chr,from,to>, 1-based, inclusive\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, "Expressions may contain:\n");
fprintf(stderr, " - arithmetic perators: +,*,-,/\n");
fprintf(stderr, " - logical operators: && (same as &), || (same as |)\n");
Expand Down
24 changes: 14 additions & 10 deletions vcfgtcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,14 @@ static void usage(void)
fprintf(stderr, " With -s but no -p, likelihoods at all sites are printed.\n");
fprintf(stderr, "Usage: bcftools gtcheck [options] [-g <genotypes.vcf.gz>] <query.vcf.gz>\n");
fprintf(stderr, "Options:\n");
fprintf(stderr, " -a, --average-discordance output average discordance for all sites\n");
fprintf(stderr, " -g, --genotypes <file> genotypes to compare against\n");
fprintf(stderr, " -H, --homs-only homozygous genotypes only (useful for low coverage data)\n");
fprintf(stderr, " -p, --plot <prefix> plot\n");
fprintf(stderr, " -r, --region <chr|chr:from-to> check only the given region\n");
fprintf(stderr, " -s, --target-sample <string> target sample in the -g file (used for plotting only)\n");
fprintf(stderr, " -S, --query-sample <string> query sample (by default the first sample is checked)\n");
fprintf(stderr, " -a, --average-discordance output average discordance for all sites\n");
fprintf(stderr, " -g, --genotypes <file> genotypes to compare against\n");
fprintf(stderr, " -H, --homs-only homozygous genotypes only (useful for low coverage data)\n");
fprintf(stderr, " -p, --plot <prefix> plot\n");
fprintf(stderr, " -r, --regions <file|reg> restrict to list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -s, --target-sample <string> target sample in the -g file (used for plotting only)\n");
fprintf(stderr, " -S, --query-sample <string> query sample (by default the first sample is checked)\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, "\n");
exit(1);
}
Expand All @@ -685,7 +686,7 @@ int main_vcfgtcheck(int argc, char *argv[])
args_t *args = (args_t*) calloc(1,sizeof(args_t));
args->files = bcf_sr_init();
args->argc = argc; args->argv = argv; set_cwd(args);
char *regions = NULL;
char *regions = NULL, *targets = NULL;

static struct option loptions[] =
{
Expand All @@ -696,10 +697,11 @@ int main_vcfgtcheck(int argc, char *argv[])
{"plot",1,0,'p'},
{"target-sample",1,0,'s'},
{"query-sample",1,0,'S'},
{"region",1,0,'r'},
{"regions",1,0,'r'},
{"targets",1,0,'t'},
{0,0,0,0}
};
while ((c = getopt_long(argc, argv, "hg:p:s:S:Hr:a",loptions,NULL)) >= 0) {
while ((c = getopt_long(argc, argv, "hg:p:s:S:Hr:at:",loptions,NULL)) >= 0) {
switch (c) {
case 'a': args->avg_site_discordance = 1; break;
case 'H': args->hom_only = 1; break;
Expand All @@ -708,6 +710,7 @@ int main_vcfgtcheck(int argc, char *argv[])
case 's': args->target_sample = optarg; break;
case 'S': args->query_sample = optarg; break;
case 'r': regions = optarg; break;
case 't': targets = optarg; break;
case 'h':
case '?': usage();
default: error("Unknown argument: %s\n", optarg);
Expand All @@ -717,6 +720,7 @@ int main_vcfgtcheck(int argc, char *argv[])
if ( !args->gt_fname ) args->cross_check = 1; // no genotype file, run in cross-check mode
else args->files->require_index = 1;
if ( regions && bcf_sr_set_regions(args->files, regions)<0 ) error("Failed to read the regions: %s\n", regions);
if ( targets && bcf_sr_set_targets(args->files, targets,0)<0 ) error("Failed to read the targets: %s\n", targets);
if ( !bcf_sr_add_reader(args->files, argv[optind]) ) error("Failed to open or the file not indexed: %s\n", argv[optind]);
if ( args->gt_fname && !bcf_sr_add_reader(args->files, args->gt_fname) ) error("Failed to open or the file not indexed: %s\n", args->gt_fname);
args->files->collapse = COLLAPSE_SNPS|COLLAPSE_INDELS;
Expand Down
4 changes: 2 additions & 2 deletions vcfnorm.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static void usage(void)
fprintf(stderr, " -D, --remove-duplicates remove duplicate lines of the same type. [Todo: merge genotypes, don't just throw away.]\n");
fprintf(stderr, " -f, --fasta-ref <file> reference sequence\n");
fprintf(stderr, " -o, --output-type <type> 'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
fprintf(stderr, " -r, --region <file|reg> comma-separated list of regions or regions listed in tab-delimited indexed file\n");
fprintf(stderr, " -r, --regions <file|reg> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -w, --win <int,int> alignment window and buffer window [50,1000]\n");
fprintf(stderr, "\n");
exit(1);
Expand All @@ -523,7 +523,7 @@ int main_vcfnorm(int argc, char *argv[])
{
{"help",0,0,'h'},
{"fasta-ref",1,0,'f'},
{"region",1,0,'r'},
{"regions",1,0,'r'},
{"win",1,0,'w'},
{"remove-duplicates",0,0,'D'},
{"output-type",1,0,'o'},
Expand Down
4 changes: 2 additions & 2 deletions vcfquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ static void usage(void)
fprintf(stderr, " -f, --format <string> learn by example, see below\n");
fprintf(stderr, " -H, --print-header print header\n");
fprintf(stderr, " -l, --list-columns list columns\n");
fprintf(stderr, " -t, --targets <reg|file> same as -t but index-jumps rather than streams to a region (requires indexed VCF/BCF)\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to positions in tab-delimited tabix indexed file <chr,pos> or <chr,from,to>, 1-based, inclusive\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, " -s, --samples <list|file> samples to include: comma-separated list or one name per line in a file\n");
fprintf(stderr, " -v, --vcf-list <file> process multiple VCFs listed in the file\n");
fprintf(stderr, "Expressions:\n");
Expand Down
4 changes: 2 additions & 2 deletions vcfroh.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ static void usage(args_t *args)
fprintf(stderr, "Usage: bcftools roh [OPTIONS] <in.bcf>|<in.vcf>|<in.vcf.gz>|-\n");
fprintf(stderr, "General Options:\n");
fprintf(stderr, " -c, --counts-only no HMM, simply report counts of HETs and HOMs per win\n");
fprintf(stderr, " -r, --regions <reg|file> same as -t but index-jumps rather than streams to a region (requires indexed VCF/BCF)\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -s, --samples <list|file> list of samples (file or comma separated list) [null]\n");
fprintf(stderr, " -t, --targets <reg|file> restrict to positions in tab-delimited tabix indexed file <chr,pos> or <chr,from,to>, 1-based, inclusive\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, " -w, --win <int> maximum window length [100_000]\n");
fprintf(stderr, "HMM Options:\n");
fprintf(stderr, " -a, --autozygosity <float> P(AZ|HW) transition probability [3.8e-9]\n");
Expand Down
4 changes: 2 additions & 2 deletions vcfstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,9 @@ static void usage(void)
fprintf(stderr, " -f, --apply-filters <list> require at least one of the listed FILTER strings (e.g. \"PASS,.\")\n");
fprintf(stderr, " -F, --fasta-ref <file> faidx indexed reference sequence file to determine INDEL context\n");
fprintf(stderr, " -i, --split-by-ID collect stats for sites with ID separately (known vs novel)\n");
fprintf(stderr, " -r, --region <reg|file> collect stats in the given regions\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -s, --samples <list|file> produce sample stats, \"-\" to include all samples\n");
fprintf(stderr, " -t, --targets <reg|file> restrict to positions in tab-delimited tabix indexed file <chr,pos> or <chr,from,to>, 1-based, inclusive\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, "\n");
exit(1);
}
Expand Down
4 changes: 2 additions & 2 deletions vcfsubset.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ static void usage(args_t *args)
fprintf(stderr, " -H print the header only\n");
fprintf(stderr, " -G, drop individual genotype information (after subsetting if -s option set)\n");
fprintf(stderr, " -o, --output-type <b|u|z|v> b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
fprintf(stderr, " -r, --regions <reg|file> same as -t but index-jumps rather than streams to a region (requires indexed VCF/BCF)\n");
fprintf(stderr, " -t, --targets <reg|file> restrict to positions in tab-delimited tabix indexed file <chr,pos> or <chr,from,to>, 1-based, inclusive\n");
fprintf(stderr, " -r, --regions <reg|file> restrict to comma-separated list of regions or regions listed in a file, see man page for details\n");
fprintf(stderr, " -t, --targets <reg|file> similar to -r but streams rather than index-jumps, see man page for details\n");
fprintf(stderr, "\n");
fprintf(stderr, "Subset options:\n");
fprintf(stderr, " -a, --trim-alt-alleles trim alternate alleles not seen in subset\n");
Expand Down

0 comments on commit 105c41e

Please sign in to comment.