Skip to content

Commit 6474809

Browse files
authored
Merge pull request #2 from kevinrue/master
VioFun supports ylim argument
2 parents 8ad4538 + f44c83f commit 6474809

File tree

15 files changed

+94
-82
lines changed

15 files changed

+94
-82
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata
5+
*.tar.gz
6+
*.Rd

SCPattern.Rproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 4
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
AutoAppendNewline: Yes
16+
StripTrailingWhitespace: Yes
17+
18+
BuildType: Package
19+
PackageUseDevtools: Yes
20+
PackagePath: package/SCPattern
21+
PackageInstallArgs: --no-multiarch --with-keep.source
22+
PackageRoxygenize: rd,collate,namespace

package/SCPattern/DESCRIPTION

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
Package: SCPattern
22
Type: Package
33
Title: SCPattern : single cell RNA-seq multiple condition analysis
4-
Version: 0.0.4
5-
Date: 2015-12-15
6-
Author: Ning Leng
7-
Maintainer: Ning Leng <lengning1@gmail.com>
4+
Version: 0.0.5
5+
Date: 2017-03-19
6+
Authors@R: c(
7+
person("Ning", "Leng", role = c("aut", "cre"),
8+
email = "lengning1@gmail.com"),
9+
person(given="Kevin", family="Rue-Albrecht", role = c("ctb"))
10+
)
811
Depends: EBSeq, testthat, vioplot, gtools, DirichletReg
912
Suggests: VGAM
1013
Description: SCPattern is a statistical method that classify genes into expression patterns in a multiple condition single cell RNA-seq experiment.
1114
License: Artistic-2.0
1215
LazyLoad: yes
13-
Collate:'BetaempH0.R'
16+
Collate: 'BetaempH0.R'
1417
'DirichletempH0.R'
1518
'KSDir.R'
1619
'KSNoDir.R'
@@ -22,3 +25,4 @@ Collate:'BetaempH0.R'
2225
'DirichletOptim.R'
2326
BuildVignettes: no
2427
biocViews: StatisticalMethod, RNASeq, Sequencing, GeneExpression
28+
RoxygenNote: 6.0.1

package/SCPattern/R/VioFun.R

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
#' @title Plot violinplot
2-
#' @usage VioFun(gene, Data, Conditions, Col, main_pre=NULL, Dropout.remove=FALSE, Dropout.upper=0, namecex=1, ylab="Expression", Log="")
2+
#' @usage VioFun(
3+
#' gene, Data, Conditions, Col, main_pre=NULL, Dropout.remove=FALSE,
4+
#' Dropout.upper=0, namecex=1, ylab="Expression", Log="", ...)
35
#' @param gene gene name of interest (character)
46
#' @param Data input data, gene-by-sample matrix. Normalized expression is expected
57
#' @param Conditions a vector of characters that indicates which condition the cells belong to
68
#' @param Col colors
79
#' @param main_pre prefix for main
8-
#' @param namecex cex for x axis names
10+
#' @param namecex cex for x axis names
911
#' @param ylab y axis label
1012
#' @param Log whether plot in log scale
11-
#' @param Droupout.remove,Dropout.upper For a given gene, whether cells with dropout will be
13+
#' @param Droupout.remove,Dropout.upper For a given gene, whether cells with dropout will be
1214
#' ignored in the test. Defaulte is FALSE. If it is set to TRUE, values that are less or equal to
1315
#' Dropout.upper will be ignored during the test.
14-
#' @return violin plot
16+
#' @param ... additional arguments passed on to methods (e.g., ylim for vioplot).
17+
#' @return violin plot
1518
#' @examples Data<- abs(matrix(rnorm(20,100,2), nrow=2))
1619
#' rownames(Data) <- paste0("gene",1:2)
1720
#' cond <- factor(rep(c("a","b"),each=5))
1821
#' VioFun("gene1",Data, cond)
1922
#' @author Ning Leng
2023

21-
VioFun=function(gene, Data, Conditions, Col=NULL, main_pre=NULL,
24+
VioFun=function(gene, Data, Conditions, Col=NULL, main_pre=NULL,
2225
Dropout.remove=FALSE, Dropout.upper=0, namecex=1,
23-
ylab="Expression", Log=""){
26+
ylab="Expression", Log="", ...){
27+
dots <- list(...)
2428
SCMat <- Data
2529
SCCond <- Conditions
2630
if(!is.factor(SCCond))SCCond <- factor(SCCond, levels=unique(SCCond))
@@ -39,15 +43,27 @@ VioFun=function(gene, Data, Conditions, Col=NULL, main_pre=NULL,
3943
names(SCDataVio) <- paste0(levels(SCCond)," (",sapply(SCDataVio,length),")")
4044

4145
tmpmin <- 0
42-
if(Log=="y")tmpmin <- 1
43-
plot(1,1,col="white",xlim=c(0,length(SCDataVio)+1),
44-
ylim=c(tmpmin,(max(SCMat[gene,])+.1)*1.2),
45-
xaxt="none",ylab=ylab, xlab="",main=paste(gene, mainpaste),
46-
log=Log)
46+
if (Log=="y"){
47+
tmpmin <- 1
48+
}
49+
if ("ylim" %in% names(dots)){
50+
ylim <- dots[["ylim"]]
51+
} else {
52+
ylim=c(tmpmin,(max(SCMat[gene,])+.1)*1.2)
53+
}
54+
plot(
55+
1,1,col="white",xlim=c(0,length(SCDataVio)+1),
56+
ylim = ylim,
57+
xaxt="none",ylab=ylab, xlab="",main=paste(gene, mainpaste),
58+
log=Log
59+
)
4760
mtext(side=1,at=1:length(SCDataVio),paste0(names(SCDataVio)," "),
4861
las=3,cex=namecex)
49-
for(j in 1:length(SCDataVio))
50-
if(max(SCDataVio[[j]])>0)vioplot(SCDataVio[[j]],at=j, add=T,col=Col[j],colMed=NULL)
62+
for(j in 1:length(SCDataVio)){
63+
if(max(SCDataVio[[j]])>0){
64+
vioplot(SCDataVio[[j]],at=j, add=T,col=Col[j],colMed=NULL)
65+
}
66+
}
5167
}
5268

5369

package/SCPattern/man/BetaempH0.Rd

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/SCPattern/man/DirichletOptim.Rd

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/SCPattern/man/DirichletempH0.Rd

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/SCPattern/man/KSDir.Rd

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/SCPattern/man/KSNoDir.Rd

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/SCPattern/man/SCPTest.Rd

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)