Commit 00496201 authored by Aurelien Brionne's avatar Aurelien Brionne
Browse files

bioconductor code style update

parent 7b1a3466
......@@ -3,8 +3,9 @@ Version: 1.0
Title: Multiple genomic features annotations
Author: Aurelien Brionne [aut, cre]
Maintainer: Aurelien Brionne <aurelien.brionne@inra.fr>
Depends: R (>= 3.5)
Depends: R (>= 3.6)
Imports:AnnotationDbi,
BiocGenerics,
data.table,
GenomicFeatures,
GenomicRanges,
......@@ -12,6 +13,7 @@ Imports:AnnotationDbi,
methods,
plotly,
rtracklayer,
S4Vectors,
UpSetR
Suggests: htmltools,
org.Mm.eg.db,
......
......@@ -6,7 +6,6 @@ exportMethods(Plot)
exportMethods(Table)
exportMethods(build_genome_features)
exportMethods(genome_features_overlaps)
import(data.table)
importFrom(AnnotationDbi,as.data.frame)
importFrom(AnnotationDbi,keys)
importFrom(AnnotationDbi,metadata)
......@@ -28,17 +27,21 @@ importFrom(IRanges,width)
importFrom(S4Vectors,queryHits)
importFrom(S4Vectors,subjectHits)
importFrom(UpSetR,upset)
importFrom(data.table,":=")
importFrom(data.table,.N)
importFrom(data.table,.SD)
importFrom(data.table,data.table)
importFrom(data.table,dcast)
importFrom(data.table,fread)
importFrom(data.table,like)
importFrom(data.table,melt)
importFrom(data.table,rbindlist)
importFrom(data.table,setorder)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,png)
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,setClass)
importFrom(methods,setGeneric)
importFrom(methods,setMethod)
importFrom(methods,slot)
importFrom(methods,slotNames)
importFrom(plotly,layout)
importFrom(plotly,plot_ly)
importFrom(rtracklayer,import)
......@@ -7,11 +7,13 @@
#' @return a \code{\link[plotly]{plot_ly}} object.
#' @include overlapped_genome_features.R
#' @examples
#' \dontrun{
#' # display bar plot
#' Plot(features_overlaps,"bar")
#'
#' # display bar plot
#' Plot(features_overlaps,"line")
#' }
#' @name Plot
#' @rdname Plot-methods
#' @exportMethod Plot
......
......@@ -6,7 +6,7 @@
#' @importFrom GenomicRanges flank
#' @importFrom rtracklayer import
#' @importFrom BiocGenerics as.data.frame
#' @importFrom data.table data.table := .N
#' @importFrom data.table data.table := .N like
#' @param txdb a txdb database built with \pkg{GenomicFeatures} (see example).
#' @param features a \code{\link[base]{vector}} of features \code{\link[base]{character}} with by
#' default all the availables features ("promoter", "UTR5", "UTR3", "exon", "intron", "cds", and "downstream").
......@@ -28,7 +28,7 @@
#' destfile = "galGal5_gff.gz"
#' )
#'
#' # uncompress the file
#' # uncompress the file
#' R.gunzip("galGal5_gff.gz")
#'
#' # build the database
......
......@@ -109,7 +109,7 @@ setMethod(
# subject_coordinates
feature_coordinates=data.table(
as.data.frame(
base::as.data.frame(
subject[subjectHits(hits)]
)
)
......
......@@ -25,11 +25,11 @@ Plot overlapped_genome_features graphs bar or line.
This method is a simple accessor to the stored \code{\link[plotly]{plot_ly}} bar or line plots from the \code{\link{overlapped_genome_features-class}} object.
}
\examples{
###################
# display bar plot
GenomeFeatures::Plot(features_overlaps,"bar")
\dontrun{
# display bar plot
Plot(features_overlaps,"bar")
###################
# display bar plot
GenomeFeatures::Plot(features_overlaps,"line")
# display bar plot
Plot(features_overlaps,"line")
}
}
......@@ -24,6 +24,6 @@ This method is a simple accessor to the stored genomic coordinates annnotation \
from an \code{\link{overlapped_genome_features-class}} object.
}
\examples{
###################
annot<-GenomeFeatures::Table(features_overlaps)
# extract the annotation table
annot<-Table(features_overlaps)
}
......@@ -6,15 +6,15 @@
\alias{build_genome_features,TxDb-method}
\title{build a convenient genomic features object.}
\usage{
build_genome_features(txdb, features = base::c("promoter", "UTR5",
"UTR3", "exon", "intron", "cds", "downstream"),
parameters = base::list(promoter_ranges = base::list(upstream = 3000,
downstream = 500), downstream_range = 1000))
build_genome_features(txdb, features = c("promoter", "UTR5", "UTR3",
"exon", "intron", "cds", "downstream"),
parameters = list(promoter_ranges = list(upstream = 3000, downstream =
500), downstream_range = 1000))
\S4method{build_genome_features}{TxDb}(txdb,
features = base::c("promoter", "UTR5", "UTR3", "exon", "intron", "cds",
"downstream"), parameters = base::list(promoter_ranges =
base::list(upstream = 3000, downstream = 500), downstream_range = 1000))
\S4method{build_genome_features}{TxDb}(txdb, features = c("promoter",
"UTR5", "UTR3", "exon", "intron", "cds", "downstream"),
parameters = list(promoter_ranges = list(upstream = 3000, downstream =
500), downstream_range = 1000))
}
\arguments{
\item{txdb}{a txdb database built with \pkg{GenomicFeatures} (see example).}
......@@ -41,36 +41,34 @@ This method build a convenient \code{\link{genomic_features-class}} object, in o
all selected features and genomic coordinates with the \code{\link{genome_features_overlaps}} method.
}
\examples{
download.file(
"ftp://ftp.ncbi.nlm.nih.gov/genomes/Gallus_gallus/GFF/ref_Gallus_gallus-5.0_top_level.gff3.gz",
quiet=TRUE,
destfile = "galGal5_gff.gz"
)
###################
utils::download.file("ftp://ftp.ncbi.nlm.nih.gov/genomes/Gallus_gallus/GFF/ref_Gallus_gallus-5.0_top_level.gff3.gz",
quiet=T,destfile = "galGal5_gff.gz")
##################
# uncompress the file
R.utils::gunzip("galGal5_gff.gz")
# uncompress the file
R.gunzip("galGal5_gff.gz")
###################
# build the database
toplevel=GenomicFeatures::makeTxDbFromGFF(
file="galGal5_gff",
format="gff",
organism="Gallus gallus",
taxonomyId=9031,
dbxrefTag="ID"
toplevel=makeTxDbFromGFF(
file="galGal5_gff",
format="gff",
organism="Gallus gallus",
taxonomyId=9031,
dbxrefTag="ID"
)
###################
# build genome_features object from txdb
features<-GenomeFeatures::build_genome_features(
toplevel,
features=base::c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
parameters = base::list(
promoter_ranges=base::list(
upstream=3000,
downstream=500
),
downstream_range=1000
)
toplevel,
features=c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
parameters = list(
promoter_ranges=list(
upstream=3000,
downstream=500
),
downstream_range=1000
)
)
}
......@@ -6,7 +6,6 @@
\title{genome_features class object definition.}
\description{
This class is invoked by \code{\link{build_genome_features}} method in order to store for each features
a \code{\link[base]{list}} with \code{\link[GenomicRanges]{GRanges}} and \code{\link[data.table]{data.table}} elements.
}
\section{Slots}{
......
......@@ -33,11 +33,10 @@ This method build a convenient genomic features object, in order to be used for
all needed features and peaks coordinates with \code{\link{genome_features_overlaps}}.
}
\examples{
###################
features_overlaps<-GenomeFeatures::genome_features_overlaps(
peaks,
features,
figs_path="./data/output/",
ignore.strand = TRUE
peaks,
features,
figs_path="./data/output/",
ignore.strand = TRUE
)
}
......@@ -20,12 +20,11 @@ and to convert it in \code{\link[GenomicRanges]{GRanges}} object.
This function read peaks coordinates file (bed file) and store the results in a \code{\link[GenomicRanges]{GRanges}} object.
}
\examples{
###################
# read peak file (package sample from NCBI)
peaks<-GenomeFeatures::readPeakFile(
base::system.file(
"extdata/data/input/A.bed",
package="GenomeFeatures"
)
system.file(
"extdata/data/input/A.bed",
package="GenomeFeatures"
)
)
}
......@@ -11,16 +11,14 @@ vignette: >
%\VignetteIndexEntry{GenomeFeatures}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
bibliography: "`r base::system.file('extdata/','bibliography.bib',package='GenomeFeatures')`"
csl: "`r base::system.file('extdata/','bmc-genomics.csl',package='GenomeFeatures')`"
bibliography: "`r system.file('extdata/','bibliography.bib',package='GenomeFeatures')`"
csl: "`r system.file('extdata/','bmc-genomics.csl',package='GenomeFeatures')`"
---
```{r setup,include=FALSE}
###################
# load library
library(GenomeFeatures)
###################
# knitr document options
knitr::opts_chunk$set(eval=TRUE,echo=TRUE, message=FALSE,comment=NA,warning=FALSE)
```
......@@ -38,24 +36,23 @@ In this vignette, we use only the chicken (galGal5) chromosome 1 (NC_006088.4) t
## 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`.
At the first step we read peaks files (also known bed files with genomic coordinates chr, start, end, strand) in a `list`, and convert it in GRanges object with `GenomeFeatures::readPeakFile`.
```{r peaks}
###################
# load peak files
peaks=GenomicRanges::GRangesList(
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"
A=GenomeFeatures::readPeakFile(
system.file(
"extdata/data/input/A.bed",
package="GenomeFeatures"
)
),
B=GenomeFeatures::readPeakFile(
system.file(
"extdata/data/input/B.bed",
package="GenomeFeatures"
)
)
)
)
```
......@@ -64,56 +61,54 @@ peaks=GenomicRanges::GRangesList(
For this vignette, we build the transcript database from the chicken gff with `GenomicFeatures::makeTxDbFromGFF` @GenomicFeatures.
```{r gff,eval=FALSE}
###################
# import the GFF (galGal5 chicken GFF in this case)
utils::download.file("ftp://ftp.ncbi.nlm.nih.gov/genomes/Gallus_gallus/GFF/ref_Gallus_gallus-5.0_top_level.gff3.gz",
quiet=T,destfile = "galGal5_gff.gz")
##################
download.file(
"ftp://ftp.ncbi.nlm.nih.gov/genomes/Gallus_gallus/GFF/ref_Gallus_gallus-5.0_top_level.gff3.gz",
quiet=T,
destfile = "galGal5_gff.gz"
)
# uncompress the file
R.utils::gunzip("galGal5_gff.gz")
gunzip("galGal5_gff.gz")
```
<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"
file= system.file(
"/extdata/data/input/galGal5.gff",
package="GenomeFeatures"
),
format="gff",
organism="Gallus gallus",
taxonomyId=9031,
dbxrefTag="ID"
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).
```{r features}
###################
# build genome features
features<-GenomeFeatures::build_genome_features(
toplevel,
features=base::c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
parameters = base::list(
promoter_ranges=base::list(
upstream=3000,
downstream=500
),
downstream_range=1000
)
features<-build_genome_features(
toplevel,
features=c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
parameters = list(
promoter_ranges=list(
upstream=3000,
downstream=500
),
downstream_range=1000
)
)
```
We can display a short summary.
```{r features_display}
###################
# build genome features
# show summary
features
```
......@@ -122,12 +117,11 @@ features
Now we can find all overlaps beetween targets coordinates and the needed genomic features with `GenomeFeatures::genome_features_overlaps`.
```{r overlaps}
###################
# find overlapss
features_overlaps<-GenomeFeatures::genome_features_overlaps(
peaks,
features,
figs_path=base::system.file(
figs_path=system.file(
"/extdata/data/output/",
package="GenomeFeatures"
),
......@@ -185,10 +179,10 @@ We can also display the `UpSetR::upset` plot previously built by`GenomeFeatures:
* A
<img src="`r base::system.file("extdata/data/output/upset_A.png",package="GenomeFeatures")`" alt="Drawing" style="width: 800px;"/>
<img src="`r system.file("extdata/data/output/upset_A.png",package="GenomeFeatures")`" alt="Drawing" style="width: 800px;"/>
* B
<img src="`r base::system.file("extdata/data/output/upset_B.png",package="GenomeFeatures")`" alt="Drawing" style="width: 800px;"/>
<img src="`r system.file("extdata/data/output/upset_B.png",package="GenomeFeatures")`" alt="Drawing" style="width: 800px;"/>
# References
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment