The purpose of the `GenomeFeatures` package is to produce a detailed genomic annotation from chromosome coordinates similar as `ChIPseeker::annotate` @ChIPseeker, but without prioritizing annotations.
The internal functions used in this package for a fast genomic annotation and data manipulations are based on the `AnnotationDbi`@AnnotationDbi,`GenomicRanges`,`IRanges`, `GenomicFeatures`@GenomicFeatures, and `data.table`@data.table R packages.
Plots of features distribution are based on `plotly`@plotly and `UpSetR`@UpSetR R packages.
In this vignette, we use only the chicken (galGal5) chromosome 1 (NC_006088.4) to illustrate `GenomeFeatures` results.
# Annotate
## Load the genomic coordinates targets
At the first step we read peaks files (also known bed files with genomic coordinates chr, start, end, strand) in a `base::list`, and convert it in GRanges object with `GenomeFeatures::readPeakFile`.
```{r peaks}
###################
# load peak files
peaks=base::list(
A=GenomeFeatures::readPeakFile(
base::system.file(
"extdata/data/input/A.bed",
package="GenomeFeatures"
)
),
B=GenomeFeatures::readPeakFile(
base::system.file(
"extdata/data/input/B.bed",
package="GenomeFeatures"
)
)
)
```
## Build a transcript database from a genome annotation file (GFF in this case)
For this vignette, we build the transcript database from the chicken gff with `GenomicFeatures::makeTxDbFromGFF` @GenomicFeatures.
```{r gff,eval=F}
###################
# create folders to store input and output results
base::dir.create("./data/input/",recursive = T)
base::dir.create("./data/output/")
###################
# import the GFF (galGal5 chicken GFF in this case)
<u>Important note:</u> In this vignette, we use only a part of the chicken (galGal5) chromosome 1 (NC_006088.4) gff to illustrate `GenomeFeatures` results.
```{r TxDb_build}
###################
# build the database
toplevel=GenomicFeatures::makeTxDbFromGFF(
file= base::system.file(
"/extdata/data/input/galGal5.gff",
package="GenomeFeatures"
),
format="gff",
organism="Gallus gallus",
taxonomyId=9031,
dbxrefTag="ID"
)
```
Now, we build a convenient object with `GenomeFeatures::build_genome_features`, needed for find overlaps beetween all selected features and genomic coordinates targets into a single step (see below).