From 310a6097298cb48ac8ac7902debe2785c6f386c7 Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Wed, 15 May 2024 14:41:05 +0100 Subject: [PATCH] Add +setGT documentation --- howtos/FAQ.html | 2 +- howtos/plugin.setGT.html | 157 +++++++++++++++++++++++++++++++++++++++ howtos/plugin.setGT.txt | 60 +++++++++++++++ howtos/plugins.html | 2 +- howtos/plugins.txt | 2 +- 5 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 howtos/plugin.setGT.html create mode 100644 howtos/plugin.setGT.txt diff --git a/howtos/FAQ.html b/howtos/FAQ.html index 6681b606..1237d6d5 100644 --- a/howtos/FAQ.html +++ b/howtos/FAQ.html @@ -4,7 +4,7 @@ - + Frequently Asked Questions diff --git a/howtos/plugin.setGT.html b/howtos/plugin.setGT.html new file mode 100644 index 00000000..3109caf1 --- /dev/null +++ b/howtos/plugin.setGT.html @@ -0,0 +1,157 @@ + + + + + + + +Plugin setGT + + + + +
+ +
+
+

Plugin setGT

+
+
+

The plugin +setGT allows to edit genotypes

+
+
+

The list of plugin-specific options can be obtained by running +bcftools +setGT -h, which will print the following usage page:

+
+
+
+
About: Sets genotypes. The target genotypes can be specified as:
+           ./.     .. completely missing ("." or "./.", depending on ploidy)
+           ./x     .. partially missing (e.g., "./0" or ".|1" but not "./.")
+           .       .. partially or completely missing
+           a       .. all genotypes
+           b       .. heterozygous genotypes failing two-tailed binomial test (example below)
+           q       .. select genotypes using -i/-e options
+           r:FLOAT .. select randomly a proportion of FLOAT genotypes (can be combined with other modes)
+       and the new genotype can be one of:
+           .       .. missing ("." or "./.", keeps ploidy)
+           0       .. reference allele (e.g. 0/0 or 0, keeps ploidy)
+           c:GT    .. custom genotype (e.g. 0/0, 0, 0/1, m/M, 0/X overrides ploidy)
+           m       .. minor (the second most common) allele as determined from INFO/AC or FMT/GT (e.g. 1/1 or 1, keeps ploidy)
+           M       .. major allele as determined from INFO/AC or FMT/GT (e.g. 1/1 or 1, keeps ploidy)
+           X       .. allele with bigger read depth as determined from FMT/AD
+           p       .. phase genotype (0/1 becomes 0|1)
+           u       .. unphase genotype and sort by allele (1|0 becomes 0/1)
+Usage: bcftools +setGT [General Options] -- [Plugin Options]
+Options:
+   run "bcftools plugin" for a list of common options
+
+Plugin options:
+   -e, --exclude EXPR        Exclude a genotype if true (requires -t q)
+   -i, --include EXPR        include a genotype if true (requires -t q)
+   -n, --new-gt TYPE         Genotypes to set, see above
+   -s, --seed INT            Random seed to use with -t r [0]
+   -t, --target-gt TYPE      Genotypes to change, see above
+
+Example:
+   # set missing genotypes ("./.") to phased ref genotypes ("0|0")
+   bcftools +setGT in.vcf -- -t . -n 0p
+
+   # set missing genotypes with DP>0 and GQ>20 to ref genotypes ("0/0")
+   bcftools +setGT in.vcf -- -t q -n 0 -i 'GT="." && FMT/DP>0 && GQ>20'
+
+   # set partially missing genotypes to completely missing
+   bcftools +setGT in.vcf -- -t ./x -n .
+
+   # set heterozygous genotypes to 0/0 if binom.test(nAlt,nRef+nAlt,0.5)<1e-3
+   bcftools +setGT in.vcf -- -t "b:AD<1e-3" -n 0
+
+   # force unphased heterozygous genotype if binom.test(nAlt,nRef+nAlt,0.5)>0.1
+   bcftools +setGT in.vcf -- -t ./x -n c:'m/M'
+
+
+
+

Feedback

+
+

We welcome your feedback, please help us improve this page by +either opening an issue on github or editing it directly and sending +a pull request.

+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/howtos/plugin.setGT.txt b/howtos/plugin.setGT.txt new file mode 100644 index 00000000..45837110 --- /dev/null +++ b/howtos/plugin.setGT.txt @@ -0,0 +1,60 @@ +include::header.inc[] + + +Plugin setGT +------------ + +The plugin `+setGT` allows to edit genotypes + +The list of plugin-specific options can be obtained by running +`bcftools +setGT -h`, which will print the following usage page: +---- +About: Sets genotypes. The target genotypes can be specified as: + ./. .. completely missing ("." or "./.", depending on ploidy) + ./x .. partially missing (e.g., "./0" or ".|1" but not "./.") + . .. partially or completely missing + a .. all genotypes + b .. heterozygous genotypes failing two-tailed binomial test (example below) + q .. select genotypes using -i/-e options + r:FLOAT .. select randomly a proportion of FLOAT genotypes (can be combined with other modes) + and the new genotype can be one of: + . .. missing ("." or "./.", keeps ploidy) + 0 .. reference allele (e.g. 0/0 or 0, keeps ploidy) + c:GT .. custom genotype (e.g. 0/0, 0, 0/1, m/M, 0/X overrides ploidy) + m .. minor (the second most common) allele as determined from INFO/AC or FMT/GT (e.g. 1/1 or 1, keeps ploidy) + M .. major allele as determined from INFO/AC or FMT/GT (e.g. 1/1 or 1, keeps ploidy) + X .. allele with bigger read depth as determined from FMT/AD + p .. phase genotype (0/1 becomes 0|1) + u .. unphase genotype and sort by allele (1|0 becomes 0/1) +Usage: bcftools +setGT [General Options] -- [Plugin Options] +Options: + run "bcftools plugin" for a list of common options + +Plugin options: + -e, --exclude EXPR Exclude a genotype if true (requires -t q) + -i, --include EXPR include a genotype if true (requires -t q) + -n, --new-gt TYPE Genotypes to set, see above + -s, --seed INT Random seed to use with -t r [0] + -t, --target-gt TYPE Genotypes to change, see above + +Example: + # set missing genotypes ("./.") to phased ref genotypes ("0|0") + bcftools +setGT in.vcf -- -t . -n 0p + + # set missing genotypes with DP>0 and GQ>20 to ref genotypes ("0/0") + bcftools +setGT in.vcf -- -t q -n 0 -i 'GT="." && FMT/DP>0 && GQ>20' + + # set partially missing genotypes to completely missing + bcftools +setGT in.vcf -- -t ./x -n . + + # set heterozygous genotypes to 0/0 if binom.test(nAlt,nRef+nAlt,0.5)<1e-3 + bcftools +setGT in.vcf -- -t "b:AD<1e-3" -n 0 + + # force unphased heterozygous genotype if binom.test(nAlt,nRef+nAlt,0.5)>0.1 + bcftools +setGT in.vcf -- -t ./x -n c:'m/M' +---- + + +include::footer.inc[] + + diff --git a/howtos/plugins.html b/howtos/plugins.html index f9d1d421..fad338ac 100644 --- a/howtos/plugins.html +++ b/howtos/plugins.html @@ -234,7 +234,7 @@

List of plugins

Prune sites by missingness, allele frequency or linkage disequilibrium. Alternatively, annotate sites with r2, Lewontin’s D' (PMID:19433632), Ragsdale’s D (PMID:31697386).

-
setGT
+
setGT

Sets genotypes according to the specified criteria and filtering expressions. For example, missing genotypes can be set to ref, but much more than that.

diff --git a/howtos/plugins.txt b/howtos/plugins.txt index 98d3032c..76e84fbe 100644 --- a/howtos/plugins.txt +++ b/howtos/plugins.txt @@ -76,7 +76,7 @@ parental-origin:: determine parental origin of a CNV region prune:: Prune sites by missingness, allele frequency or linkage disequilibrium. Alternatively, annotate sites with r2, Lewontin's D' (PMID:19433632), Ragsdale's D (PMID:31697386). -setGT:: Sets genotypes according to the specified criteria and filtering expressions. For example, missing genotypes can be set to ref, but much more than that. +link:plugin.setGT.html[setGT]:: Sets genotypes according to the specified criteria and filtering expressions. For example, missing genotypes can be set to ref, but much more than that. smpl-stats:: calculates basic per-sample stats. The usage and format is similar to ``indel-stats`` and ``trio-stats``.