【bedtools教程】-annotate功能
annotate
bedtools annotate, well, annotates one BED/VCF/GFF file with the coverage and number of overlaps observed from multiple other BED/VCF/GFF files. In this way, it allows one to ask to what degree one feature coincides with multiple other feature types with a single command.
Usage and option summary
Usage:
bedtoolsannotate[OPTIONS]-i-filesFILE1FILE2FILE3...FILEn
(or):
annotateBed[OPTIONS]-i-filesFILE1FILE2FILE3...FILEn
OptionDescription
-namesA list of names (one per file) to describe each file in -i. These names will be printed as a header line.
-countsReport the count of features in each file that overlap -i. Default behavior is to report the fraction of -i covered by each file.
-bothReport the count of features followed by the % coverage for each annotation file. Default is to report solely the fraction of -i covered by each file.
-sForce strandedness. That is, only include hits in A that overlap B on the same strand. By default, hits are included without respect to strand.
-SRequire different strandedness. That is, only report hits in B that overlap A on the _opposite_ strand. By default, overlaps are reported without respect to strand.
Default behavior - annotate one file with coverage from others.
By default, the fraction of each feature covered by each annotation file is reported after the complete feature in the file to be annotated.
$ cat variants.bedchr1100200nasty1-chr25001000ugly2+chr310005000big3-$ cat genes.bedchr1150200geneA1+chr1175250geneB2+chr3010000geneC3-$ cat conserve.bedchr1010000cons11+chr270010000cons22-chr3400010000cons33+$ cat known_var.bedchr10120known1 -chr1150160known2 -chr2010000known3 +$ bedtools annotate -i variants.bed -files genes.bed conserve.bed known_var.bedchr1100200nasty1-0.5000001.0000000.300000chr25001000ugly2+0.0000000.6000001.000000chr310005000big3-1.0000000.2500000.000000
-count Report the count of hits from the annotation files
$ bedtools annotate -counts -i variants.bed -files genes.bed conserve.bed known_var.bedchr1100200nasty1-212chr25001000ugly2+011chr310005000big3-110
-both Report both the count of hits and the fraction covered from the annotation files
$ bedtools annotate -both -i variants.bed -files genes.bed conserve.bed known_var.bed#chr start end name score +/- cnt1 pct1 cnt2 pct2 cnt3 pct3chr1100200nasty1-20.50000011.00000020.300000chr25001000ugly2+00.00000010.60000011.000000chr310005000big3-11.00000010.25000000.000000
-s Restrict the reporting to overlaps on the same strand.
$ bedtools annotate -s -i variants.bed -files genes.bed conserve.bed known_var.bedchr1100200nasty1-0.0000000.0000000.000000chr25001000ugly2+0.0000000.0000000.000000chr310005000big3-1.0000000.0000000.000000
-S Restrict the reporting to overlaps on the opposite strand.
$ bedtools annotate -S -i variants.bed -files genes.bed conserve.bed known_var.bedchr1100200nasty1-0.5000001.0000000.300000chr25001000ugly2+0.0000000.6000001.000000chr310005000big3-0.0000000.2500000.000000