Commit 4a4f619b authored by Aurelien Brionne's avatar Aurelien Brionne
Browse files

add excon1 feature

parent ed786dfb
Package: GenomeFeatures
Version: 1.1
Version: 1.2
Title: Multiple genomic features annotations
Author: Aurelien Brionne [aut, cre]
Maintainer: Aurelien Brionne <aurelien.brionne@inrae.fr>
......
......@@ -9,14 +9,14 @@
#' @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","intron1", "cds", and "downstream").
#' default all the availables features (("promoter","UTR5","UTR3","exon1","exons","intron1","introns","cds", and "downstream").
#' @param parameters a \code{\link[base]{list}} of parameters to use in order to define promoter and
#' downstream ranges distance to TSS (Transcript Start Site) or TES (Transcript End Site).
#' \itemize{
#' \item{promoter_ranges: a \code{\link[base]{list}} with upstream and dowstream elements distance (in base) to TSS}.
#' \item{downstream_range: the dowstream distance (in base) to the TES}.
#' }
#' @details This method build a convenient \code{\link{genomic_features-class}} object, in order to be used for finding overlaps beetween
#' @details This method build a convenient \code{\link{genomic_features-class}} object, in order to be used for finding overlaps between
#' all selected features and genomic coordinates with the \code{\link{genome_features_overlaps}} method.
#' @return a \code{\link{genome_features-class}} object.
#' @include genome_features.R
......@@ -43,7 +43,7 @@
#' # build genome_features object from txdb
#' features<-GenomeFeatures::build_genome_features(
#' toplevel,
#' features=c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
#' features=c("promoter","UTR5","UTR3","exons","introns","cds","downstream"),
#' parameters = list(
#' promoter_ranges=list(
#' upstream=3000,
......@@ -58,7 +58,7 @@
setGeneric(
name="build_genome_features",
def=function(
txdb,features=c("promoter","UTR5","UTR3","exon","intron","intron1","cds","downstream"),
txdb,features=c("promoter","UTR5","UTR3","exon1","exons","intron1","introns","cds","downstream"),
parameters=list(promoter_ranges=list(upstream=3000,downstream=500),downstream_range=1000)){
standardGeneric("build_genome_features")
}
......@@ -304,8 +304,9 @@ setMethod(
## Exons
exons=NULL;exons_DT=NULL
exon1=NULL;exon1_DT=NULL
if("exon"%in%features){
if("exons"%in%features | "exon1"%in%features){
# get exons
exons<-exonsBy(txdb,use.names=FALSE)
......@@ -364,6 +365,18 @@ setMethod(
group_name=NULL
)
]
if("exon1"%in%features){
# locate intron 1
pos<-grepl("exon1/",exons_DT[,feature])
# subset intron1
exon1_DT<-exons_DT[pos]
# get intron1 GRanges
exon1<-exons[pos]
}
}
## Introns
......@@ -371,7 +384,7 @@ setMethod(
introns=NULL;introns_DT=NULL
intron1=NULL;intron1_DT=NULL
if("intron"%in%features | "intron1"%in%features){
if("introns"%in%features | "intron1"%in%features){
# get introns
introns<-intronsByTranscript(txdb,use.names=FALSE)
......@@ -443,10 +456,10 @@ setMethod(
# locate intron 1
pos<-grepl("intron1/",introns_DT[,feature])
# substet intron1
# subset intron1
intron1_DT<-introns_DT[pos]
# get intron1 GRan
# get intron1 GRanges
intron1<-introns[pos]
}
......@@ -597,8 +610,9 @@ setMethod(
promoter=list(GRanges=promoters,DT=promoters_DT),
UTR5=list(GRanges=UTR5,DT=UTR5_DT),
UTR3=list(GRanges=UTR3,DT=UTR3_DT),
exon=list(GRanges=exons,DT=exons_DT),
intron=list(GRanges=introns,DT=introns_DT),
exons=list(GRanges=exons,DT=exons_DT),
exon1=list(GRanges=exon1,DT=exon1_DT),
introns=list(GRanges=introns,DT=introns_DT),
intron1=list(GRanges=intron1,DT=intron1_DT),
cds=list(GRanges=cds,DT=cds_DT),
downstream=list(GRanges=downstream,DT=downstream_DT),
......
......@@ -15,8 +15,9 @@ setClass("genome_features",
metadata="list",
promoter="list",
UTR5="list",
exon="list",
intron="list",
exons="list",
exon1="list",
introns="list",
intron1="list",
cds="list",
UTR3="list",
......
......@@ -188,7 +188,7 @@ setMethod(
annot[,
"feature_type":=factor(
annot$feature_type,
levels=unique(annot$feature_type)
levels=c("promoter","UTR5","UTR3","exon1","exons","intron1","introns","cds","downstream","other")
)
]
......@@ -267,15 +267,14 @@ setMethod(
)
# convert feature to factor
Data[,
condition:=factor(
Data$condition,
levels=rev(names(peaks))
)
Data[,condition:=factor(
condition,
levels=rev(names(peaks))
)
]
# ordering Data
setorder(Data,condition)
setorder(Data,condition,feature)
# ChIPseeker color palette
getCols <- function(n){
......
......@@ -7,16 +7,16 @@
\usage{
build_genome_features(
txdb,
features = c("promoter", "UTR5", "UTR3", "exon", "intron", "intron1", "cds",
"downstream"),
features = c("promoter", "UTR5", "UTR3", "exon1", "exons", "intron1", "introns",
"cds", "downstream"),
parameters = list(promoter_ranges = list(upstream = 3000, downstream = 500),
downstream_range = 1000)
)
\S4method{build_genome_features}{TxDb}(
txdb,
features = c("promoter", "UTR5", "UTR3", "exon", "intron", "intron1", "cds",
"downstream"),
features = c("promoter", "UTR5", "UTR3", "exon1", "exons", "intron1", "introns",
"cds", "downstream"),
parameters = list(promoter_ranges = list(upstream = 3000, downstream = 500),
downstream_range = 1000)
)
......@@ -25,7 +25,7 @@ build_genome_features(
\item{txdb}{a txdb database built with \pkg{GenomicFeatures} (see example).}
\item{features}{a \code{\link[base]{vector}} of features \code{\link[base]{character}} with by
default all the availables features ("promoter", "UTR5", "UTR3", "exon", "intron","intron1", "cds", and "downstream").}
default all the availables features (("promoter","UTR5","UTR3","exon1","exons","intron1","introns","cds", and "downstream").}
\item{parameters}{a \code{\link[base]{list}} of parameters to use in order to define promoter and
downstream ranges distance to TSS (Transcript Start Site) or TES (Transcript End Site).
......@@ -42,7 +42,7 @@ build a convenient \code{\link{genome_features-class}} object needed for find ov
selected features and genomic coordinates in a single step.
}
\details{
This method build a convenient \code{\link{genomic_features-class}} object, in order to be used for finding overlaps beetween
This method build a convenient \code{\link{genomic_features-class}} object, in order to be used for finding overlaps between
all selected features and genomic coordinates with the \code{\link{genome_features_overlaps}} method.
}
\examples{
......@@ -67,7 +67,7 @@ toplevel=makeTxDbFromGFF(
# build genome_features object from txdb
features<-GenomeFeatures::build_genome_features(
toplevel,
features=c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
features=c("promoter","UTR5","UTR3","exons","introns","cds","downstream"),
parameters = list(
promoter_ranges=list(
upstream=3000,
......
......@@ -94,7 +94,7 @@ Now, we build a convenient object with `GenomeFeatures::build_genome_features`,
# build genome features
features<-build_genome_features(
toplevel,
features=c("promoter","UTR5","UTR3","exon","intron","cds","downstream"),
features=c("promoter","UTR5","UTR3","exons","exon1","introns","intron1","cds","downstream"),
parameters = list(
promoter_ranges=list(
upstream=3000,
......@@ -114,10 +114,10 @@ features
## Find overlaps beetween genomic coordinates and features
Now we can find all overlaps beetween targets coordinates and the needed genomic features with `GenomeFeatures::genome_features_overlaps`.
Now we can find all overlaps between targets coordinates and the needed genomic features with `GenomeFeatures::genome_features_overlaps`.
```{r overlaps}
# find overlapss
# find overlaps
features_overlaps<-GenomeFeatures::genome_features_overlaps(
peaks,
features,
......@@ -132,7 +132,6 @@ features_overlaps<-GenomeFeatures::genome_features_overlaps(
We can display a short object summary.
```{r overlaps_display}
###################
# find overlaps
features_overlaps
```
......@@ -146,7 +145,6 @@ Bar and lines features plots are available with`GenomeFeatures::Plot`.
* bar
```{r bar,fig.width=6}
###################
# display bar
GenomeFeatures::Plot(features_overlaps,"bar")
```
......@@ -154,7 +152,6 @@ GenomeFeatures::Plot(features_overlaps,"bar")
* line
```{r lines,fig.width=6}
###################
# display lines
GenomeFeatures::Plot(features_overlaps,"line")
```
......@@ -164,11 +161,9 @@ GenomeFeatures::Plot(features_overlaps,"line")
The annotation table could be easily extract from the overlapped features object with `GenomeFeatures::Table`.
```{r table}
###################
# Extract the annotation table
annot<-GenomeFeatures::Table(features_overlaps)
###################
# display header
annot
```
......
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