Skip to content

Commit

Permalink
Commit made by the Bioconductor Git-SVN bridge.
Browse files Browse the repository at this point in the history
Commit id: 53f8c64

    Merge pull request BIMSBbioinfo#114 from katwre/cex_legend_plotTargetAnnotation

    cex.legend to plotTargetAnnotation, faster ScoreMatrixBin, BigWig ext ScoreMatrix(Bin)

Commit id: 7e035c3

    add checking .bigWig, .bigwig extensions in ScoreMatrix(Bin)

    ScoreMatrixBin:
      - check not only for .bw but also .bigWig and .bigwig extenstions of BigWig file
    
    ScoreMatrix:
      - check not only for .bw but also .bigWig and .bigwig extensions of BigWig file
    

Commit id: 9140d4b

    improve example of gffToGranges

    gffToGranges:
       remove split.group arg that doesn't exist anymore in gffToGranges()
    

Commit id: 9a2dbac

    cex.legend arg plotTargetAnnotation;faster ScoreMatrixBin

    plotTargetAnnotation
    - add new argument cex.legend to plotTargetAnnotation() to specify the size of the legend.
    
    ScoreMatrixBin:
      - changed ScoreMatrixBin() to run faster when noCovNA=TRUE
    

Commit id: f5f5256

    Merge remote-tracking branch 'upstream/master'


Commit id: 7f0cb2c

    Merge remote-tracking branch 'upstream/master'


Commit id: 2a7857d

    Merge remote-tracking branch 'upstream/master'



git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/genomation@107654 bc3139a8-67e5-0310-9ffc-ced21a209358
  • Loading branch information
a.akalin committed Aug 21, 2015
1 parent df62377 commit 8c290cf
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: genomation
Type: Package
Title: Summary, annotation and visualization of genomic data
Version: 1.1.12
Version: 1.1.13
Author: Altuna Akalin [aut, cre], Vedran Franke [aut, cre], Katarzyna Wreczycka [aut], Liz Ing-Simmons [ctb]
Maintainer: Altuna Akalin <aakalin@gmail.com>, Vedran Franke <vedran.franke@gmail.com>
Description: A package for summary and annotation of genomic intervals. Users can visualize and
Expand Down
9 changes: 9 additions & 0 deletions NEWS
@@ -1,3 +1,12 @@
genomation 1.1.13
--------------

IMPROVEMENTS AND BUG FIXES

* add new argument cex.legend to plotTargetAnnotation() to specify the size of the legend.
* changed ScoreMatrixBin() to run faster when noCovNA=TRUE
* check not only for .bw but also .bigWig and .bigwig extensions of BigWig file in ScoreMatrix() and ScoreMatrixBin()

genomation 1.1.12
--------------

Expand Down
10 changes: 5 additions & 5 deletions R/readAnnotate.R
Expand Up @@ -957,11 +957,10 @@ setMethod("getAssociationWithTSS",
#' This option is only valid when x is a
#' \code{AnnotationByGeneParts} object
#' @param col a vector of colors for piechart or the bar plot
#' @param cex.legend a numeric value of length 1 to specify the size of the legend. By default 1.
#' @param ... graphical parameters to be passed to \code{pie}
#' or \code{barplot} functions
#'
#' @usage plotTargetAnnotation(x,precedence=TRUE,col,...)
#'
#'
#' @examples
#' data(cage)
Expand All @@ -981,15 +980,16 @@ setMethod("getAssociationWithTSS",
setGeneric("plotTargetAnnotation",
function(x,
precedence=TRUE,
col=getColors(length(x@annotation)),...)
col=getColors(length(x@annotation)),
cex.legend=1,...)
standardGeneric("plotTargetAnnotation"))

#' @rdname plotTargetAnnotation-methods
#' @docType methods
#' @aliases plotTargetAnnotation,AnnotationByFeature-method
setMethod("plotTargetAnnotation",
signature(x = "AnnotationByFeature"),
function(x,precedence,col,...){
function(x,precedence,col,cex.legend,...){

props=getTargetAnnotationStats(x,precedence)

Expand All @@ -999,7 +999,7 @@ setMethod("plotTargetAnnotation",
names(props)=paste( paste(round(props),"%"),sep=" ")

pie(props,cex=0.9,col=col,...)
legend("topright",legend=slice.names,fill=col )
legend("topright",legend=slice.names,fill=col, cex=cex.legend)

}else{

Expand Down
30 changes: 15 additions & 15 deletions R/readData.R
Expand Up @@ -120,7 +120,7 @@ readGeneric<-function(file, chr=1,start=2,end=3,strand=NULL,meta.cols=NULL,
keep.all.metadata=FALSE, zero.based=FALSE,
remove.unusual=FALSE, header=FALSE,
skip=0, sep="\t"){

# reads the bed files
df=readTableFast(file, header=header, skip=skip, sep=sep)

Expand All @@ -144,12 +144,12 @@ readGeneric<-function(file, chr=1,start=2,end=3,strand=NULL,meta.cols=NULL,
# removes nonstandard chromosome names
if(remove.unusual)
df = df[grep("_", as.character(df$chr),invert=TRUE),]

g = makeGRangesFromDataFrame(
df,
keep.extra.columns=FALSE,
starts.in.df.are.0based=zero.based,
ignore.strand=is.null(strand))
df,
keep.extra.columns=FALSE,
starts.in.df.are.0based=zero.based,
ignore.strand=is.null(strand))

# this names can not be column names in meta-data
black.names=c("seqnames", "ranges", "strand", "seqlevels", "seqlengths",
Expand Down Expand Up @@ -269,7 +269,7 @@ readBed<-function(file,track.line=FALSE,remove.unusual=FALSE,zero.based=TRUE)
#' @rdname readBroadPeak
#' @export
readBroadPeak<-function(file, track.line=FALSE){

g = readGeneric(file,
strand=6,
meta.cols=list(name=4,
Expand Down Expand Up @@ -305,15 +305,15 @@ readBroadPeak<-function(file, track.line=FALSE){
#' @rdname readNarrowPeak
#' @export
readNarrowPeak<-function(file, track.line=FALSE){

g = readGeneric(file,
strand=6,
meta.cols=list(name=4,
score=5,
signalValue=7,
pvalue=8,
qvalue=9,
peak=10),
score=5,
signalValue=7,
pvalue=8,
qvalue=9,
peak=10),
header=FALSE,
skip=track.line)
return(g)
Expand Down Expand Up @@ -473,7 +473,7 @@ setMethod("readTranscriptFeatures",
#'
#' @examples
#' # gff.file = system.file('extdata/chr21.refseq.hg19.gtf', package='genomation')
#' # gff = gffToGRanges(gff.file, split.group=TRUE)
#' # gff = gffToGRanges(gff.file)
#'
#'
#' @docType methods
Expand All @@ -492,6 +492,6 @@ gffToGRanges = function(gff.file, filter=NULL, zero.based=FALSE, ensembl=FALSE){
stop(paste(filter, 'category does not exist in the gff file'))
gff = gff[grepl(filter, gff$type)]
}

return(gff)
}
2 changes: 1 addition & 1 deletion R/scoreMatrix.R
Expand Up @@ -376,7 +376,7 @@ setMethod("ScoreMatrix",signature("character","GRanges"),

if(type == 'bam' & !grepl('bam$',target))
warning('you have set type="bam", but the designated file does not have .bam extension')
if(type == 'bigWig' & !(grepl('bw$',target) | grepl('bigWig$',target)))
if(type == 'bigWig' & !grepl('bw$|bigWig$|bigwig$',target))
warning('you have set type="bigWig", but the designated file does not have .bw extension')

if(type == 'bam')
Expand Down
7 changes: 3 additions & 4 deletions R/scoreMatrixBin.R
Expand Up @@ -232,9 +232,8 @@ setMethod("ScoreMatrixBin",signature("GRanges","GRanges"),
# figure out which ones are real 0 score
# which ones has no coverage
# put NAs for no coverage bases
target.rle= endoapply( target.rle,function(x){ x=x-1
x[x<0]=NA
x})
runValue(target.rle)=runValue(target.rle)-1
runValue(target.rle)[runValue(target.rle)<0]=NA

}else{
# get coverage with weights
Expand Down Expand Up @@ -270,7 +269,7 @@ setMethod("ScoreMatrixBin",signature("character","GRanges"),

if(type == 'bam' & !grepl('bam$',target))
warning('you have set type="bam", but the designated file does not have .bam extension')
if(type == 'bigWig' & !grepl('bw$',target))
if(type == 'bigWig' & !grepl('bw$|bigWig$|bigwig$',target))
warning('you have set type="bigWig", but the designated file does not have .bw extension')

if(type == 'bam')
Expand Down
14 changes: 2 additions & 12 deletions man/gffToGRanges.Rd
Expand Up @@ -6,24 +6,14 @@
\title{Converts a gff formated data.frame into a GenomicRanges object.
The GenomicRanges object needs to be properly formated for the function to work.}
\usage{
gffToGRanges(gff.file, track.line = FALSE, split.group = FALSE,
split.char = ";", filter = NULL, zero.based = FALSE, ensembl = FALSE)
gffToGRanges(gff.file, filter = NULL, zero.based = FALSE, ensembl = FALSE)
}
\arguments{
\item{gff.file}{path to a gff formatted file.
The file can end in \code{.gz}, \code{.bz2}, \code{.xz}, or \code{.zip}
and/or start with \code{http://} or \code{ftp://}. If the file is not compressed
it can also start with \code{https://} or \code{ftps://}.}

\item{track.line}{Can be an integer specifying the number of track lines to skip,
"auto" to detect the header lines automatically
or FALSE(default) if the bed file doesn't have track lines.
"auto" detects both UCSC header lines and lines starting with #}
\item{split.group}{boolean, whether to split the 9th column of the file}
\item{split.char}{character that is used as a separator of the 9th column. ';' by default}
\item{filter}{a character designating which elements to retain from the gff file (e.g. exon, CDS, ...)}

\item{zero.based}{\code{boolean} whether the coordinates are 0 or 1 based. 0 is the default}
Expand All @@ -39,6 +29,6 @@ The GenomicRanges object needs to be properly formated for the function to work.
}
\examples{
# gff.file = system.file('extdata/chr21.refseq.hg19.gtf', package='genomation')
# gff = gffToGRanges(gff.file, split.group=TRUE)
# gff = gffToGRanges(gff.file)
}

7 changes: 5 additions & 2 deletions man/plotTargetAnnotation-methods.Rd
Expand Up @@ -6,10 +6,11 @@
\alias{plotTargetAnnotation,AnnotationByFeature-method}
\title{Plot annotation categories from AnnotationByGeneParts or AnnotationByFeature}
\usage{
plotTargetAnnotation(x,precedence=TRUE,col,...)
plotTargetAnnotation(x, precedence = TRUE,
col = getColors(length(x@annotation)), cex.legend = 1, ...)

\S4method{plotTargetAnnotation}{AnnotationByFeature}(x, precedence = TRUE,
col = getColors(length(x@annotation)), ...)
col = getColors(length(x@annotation)), cex.legend = 1, ...)
}
\arguments{
\item{x}{a \code{AnnotationByFeature} or
Expand All @@ -23,6 +24,8 @@ This option is only valid when x is a

\item{col}{a vector of colors for piechart or the bar plot}

\item{cex.legend}{a numeric value of length 1 to specify the size of the legend. By default 1.}

\item{...}{graphical parameters to be passed to \code{pie}
or \code{barplot} functions}
}
Expand Down

0 comments on commit 8c290cf

Please sign in to comment.