Skip to content

Commit

Permalink
Merge branch 'release-1.0.1' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wleoncio committed Oct 6, 2020
2 parents c7d9929 + 4747615 commit 0c90899
Show file tree
Hide file tree
Showing 46 changed files with 2,278 additions and 6,272 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Expand Up @@ -20,4 +20,5 @@ runtime.txt
.travis.yml
.github
.git
Aux
Aux
binder
34 changes: 12 additions & 22 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -1,38 +1,28 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help us improve DIscBIO
title: ''
labels: bug
assignees: ''

---

# Describe the bug
# Summary
A clear and concise description of what the bug is.

# Steps to Reproduce
# DIscBIO version
Type `package.version("DIscBIO")` and paste the output here.

Try to create a minimally-reproducible example so other people can better understand the problem.
# Expected output
What did you expect to happen?

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. Reproduce the following code:
```
```
# Obtained output
What happened instead?

# Expected behavior
A clear and concise description of what you expected to happen.
# Steps to reproduce issue

# Screenshots
If applicable, add screenshots to help explain your problem.
Paste a script that reproduces the error inside the "```" marks.

# Software metainformation
- Operating System and version: [e.g. Linux, Mac, Windows]
- R version:
- DIscBIO version or commit number:
```r

# Additional context
Add any other context about the problem here.
```
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -4,6 +4,10 @@ cache:
apt: true
packages: true
timeout: 3000
before_install:
- sudo apt-get update
- sudo apt-get -y install openjdk-9-jre-headless openjdk-9-source
- sudo apt-get -y install r-cran-rjava
r:
- release
- devel
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: DIscBIO
Date: 2020-07-30
Date: 2020-10-06
Title: A User-Friendly Pipeline for Biomarker Discovery in Single-Cell Transcriptomics
Version: 1.0.0
Version: 1.0.1
Authors@R:
c(
person(
Expand Down Expand Up @@ -48,7 +48,7 @@ Suggests:
Seurat
LazyData: true
RoxygenNote: 7.1.1
URL: https://github.com/ocbe-uio/DIscBIO#usage
URL: https://github.com/ocbe-uio/DIscBIO
BugReports: https://github.com/ocbe-uio/DIscBIO/issues
Collate:
'DIscBIO-classes.R'
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md → NEWS.md
@@ -1,10 +1,16 @@
This file documents the changes between stable releases of DIscBIO.

The next stable release of DIscBIO will contain several changes from the [original work](https://github.com/SystemsBiologist/PSCAN), the most relevant of which are listed below:
# Version 1.0.1

- Bug fixes
- Updated Binder notebook

# Version 1.0.0

Contains several changes from the [original work](https://github.com/SystemsBiologist/PSCAN), the most relevant of which are listed below:

- Several functions have been enhanced with a `quiet` argument to suppress intermediate output (essential to obtain cleaner output in batch scripts and unit tests)
- Functions have been isolated into their own R files
- Function and package documentation were added
- Test datasets were compressed to occupy less disk space
- The accompanying [Jupyter notebook](https://hub.gke.mybinder.org/user/systemsbiologist-pscan-tza36hyq/notebooks/DIscBIO.ipynb) was integrated as a vignette
- Bugs have been fixed
2 changes: 0 additions & 2 deletions R/DIscBIO-classes.R
Expand Up @@ -151,8 +151,6 @@ setMethod(
}

# Proceed
#tmpFeats <- rownames(expdataAll)
#tmpExpdataAll <- expdataAll
tmpFeats <- rownames(.Object@expdataAll)
tmpExpdataAll <- .Object@expdataAll

Expand Down
7 changes: 2 additions & 5 deletions R/DIscBIO-generic-ClustDiffGenes.R
Expand Up @@ -60,9 +60,6 @@ setMethod(
} else if (pValue < 0 | pValue > 1) {
stop("pValue has to be a number between 0 and 1")
}
if (length(object@kmeans$kpart) == 0) {
stop("run Clustexp before ClustDiffGenes")
}
cdiff <- list()
x <- object@ndata
y <- object@expdata[, names(object@ndata)]
Expand All @@ -71,7 +68,7 @@ setMethod(
} else if (ran_m) {
part <- object@MBclusters$clusterid
} else {
stop("Run Clustexp() before running this function")
stop("Run clustering before running this function")
}
# ======================================================================
# Operating
Expand Down Expand Up @@ -248,4 +245,4 @@ setMethod(
print(paste("There are no DEGs with fdr =", fdr))
}
}
)
)
9 changes: 5 additions & 4 deletions R/DIscBIO-generic-FindOutliers.R
Expand Up @@ -98,8 +98,9 @@ setMethod(
outdistquant = outdistquant
)
### calibrate background model
m <- log2(apply(object@fdata, 1, mean))
v <- log2(apply(object@fdata, 1, var))
EXP<-object@expdata + 0.1
m <- log2(apply(EXP, 1, mean))
v <- log2(apply(EXP, 1, var))
f <- m > -Inf & v > -Inf
m <- m[f]
v <- v[f]
Expand Down Expand Up @@ -259,7 +260,7 @@ setMethod(
y,
ylim = c(0, max(-log10(
x + 2.2e-16
)) * 1.1),
)) * 2.1),
col = fcol[i],
border = fcol[i],
names.arg = FALSE,
Expand Down Expand Up @@ -299,4 +300,4 @@ setMethod(
LL <- which(object@cpart > K)
return(LL)
}
)
)
12 changes: 12 additions & 0 deletions R/DIscBIO-generic-clusteringOrder.R
Expand Up @@ -7,6 +7,9 @@
#' @param export if `TRUE`, exports order table to csv
#' @param filename Name of the exported file (if `export=TRUE`)
#' @importFrom TSCAN TSCANorder
#' @note This function has been replaced by pseudoTimeOrdering(), but it is
#' being kept for legacy purposes. It will, however, be removed from future
#' versions of DIscBIO.
#' @return The DISCBIO-class object input with the kordering slot filled.
setGeneric("KmeanOrder", function(object, quiet = FALSE, export = FALSE,
filename = "Cellular_pseudo-time_ordering_based_on_k-meansc-lusters")
Expand All @@ -19,6 +22,15 @@ setMethod(
"KmeanOrder",
signature = "DISCBIO",
definition = function(object, quiet, export, filename) {
# TODO: update Notebook not to depend on pseudoTimeOrdering instead
warning(
"KmeanOrder() has been replaced with pseudoTimeOrdering(), ",
"which performs pseudo-time ordering for both k-means ",
"and model-based clustering. ",
"This function is being kept for legacy purposes, ",
"but will be removed in future versions of DIscBIO. ",
"Please adapt your scripts accordingly."
)
# Validation
if (length(object@kmeans$kpart) == 0) {
stop("run Clustexp before KmeanOrder")
Expand Down
3 changes: 1 addition & 2 deletions R/DIscBIO-generic-clustheatmap.R
Expand Up @@ -57,7 +57,6 @@ setMethod(
object@distances <- as.matrix(y$di)
part <- object@MBclusters$clusterid
}
part <- object@kmeans$kpart
na <- c()
j <- 0
for (i in 1:max(part)) {
Expand Down Expand Up @@ -172,4 +171,4 @@ setMethod(
}
return(cclmo)
}
)
)
7 changes: 4 additions & 3 deletions R/DIscBIO-generic-plotExptSNE.R
Expand Up @@ -41,7 +41,8 @@ setMethod(
# ======================================================================
# Plotting
# ======================================================================
l <- apply(object@ndata[g, ] - .1, 2, sum) + .1
logObj <- log(object@ndata)
l <- apply(logObj[g, ] - .1, 2, sum) + .1
mi <- min(l, na.rm = TRUE)
ma <- max(l, na.rm = TRUE)
ColorRamp <- colorRampPalette(
Expand All @@ -61,7 +62,7 @@ setMethod(
opar <- par(mar = c(3, 5, 2.5, 2))
on.exit(par(opar))
plot(
object@tsne,
x,
xlab = "Dim 1",
ylab = "Dim 2",
main = n,
Expand Down Expand Up @@ -97,4 +98,4 @@ setMethod(
)
layout(1)
}
)
)
11 changes: 8 additions & 3 deletions R/DIscBIO-generic-plotSilhouette.R
Expand Up @@ -26,11 +26,16 @@ setMethod(
# Validation
# ======================================================================
ran_clustexp <- length(object@kmeans$kpart) > 0
ran_exprmclust <- length(object@MBclusters$clusterid) > 0
ran_exprmclust <- length(object@MBclusters) > 0
if (ran_clustexp) {
kpart <- object@kmeans$kpart
DIS <- object@distances
} else if (ran_exprmclust) {
kpart <- object@MBclusters$clusterid
y <- clustfun(object@fdata, clustnr = 3, bootnr = 50,
metric = "pearson", do.gap = TRUE, SE.method = "Tibs2001SEmax",
SE.factor = .25, B.gap = 50, cln = 0, rseed = NULL, quiet = TRUE )
DIS <- as.matrix(y$di)
} else {
stop("run clustexp or exprmclust before plotSilhouette")
}
Expand All @@ -41,8 +46,8 @@ setMethod(
# Plotting
# ======================================================================
col <- c("black", "blue", "green", "red", "yellow", "gray")
distances <- dist.gen(object@distances)
distances <- DIS
si <- silhouette(kpart, distances)
plot(si, col = col[1:K])
}
)
)
3 changes: 2 additions & 1 deletion R/DIscBIO-generic-plottSNE.R
Expand Up @@ -30,6 +30,7 @@ setMethod(
# Plotting
# ======================================================================
col <- c("black", "blue", "green", "red", "yellow", "gray")
LEN<-length(levels(factor(part)))
plot(
x,
las = 1,
Expand All @@ -39,7 +40,7 @@ setMethod(
cex = 1.5,
col = "lightgrey"
)
for (i in seq_len(part)) {
for (i in seq_len(LEN)) {
if (sum(part == i) > 0) {
text(
x[part == i, 1],
Expand Down
8 changes: 6 additions & 2 deletions R/DIscBIO-generic-pseudoTimeOrdering.R
Expand Up @@ -55,7 +55,11 @@ setMethod(
FinalOrder <- orderTable[match(sampleNames, orderTable$orderID), ]
out_order <- FinalOrder[, 1]
names(out_order) <- names(Names)
object@kordering <- out_order
if (ran_k) {
object@kordering <- out_order
} else if (ran_m) {
object@MBordering <- out_order
}
return(object)
}
)
)
12 changes: 6 additions & 6 deletions R/J48DTeval.R
Expand Up @@ -74,18 +74,18 @@ J48DTeval <- function(
)
colnames(j48.confusion.matrix) <- c(First, Second)
if (!quiet) print(j48.confusion.matrix)
j48.sn <- SN(j48.confusion.matrix)
j48.sp <- SP(j48.confusion.matrix)
j48.acc <- ACC(j48.confusion.matrix)
j48.mcc <- MCC(j48.confusion.matrix)
j48.sn <- round(SN(j48.confusion.matrix),digits=2)
j48.sp <- round(SP(j48.confusion.matrix),digits=2)
j48.acc <- round(ACC(j48.confusion.matrix),digits=2)
j48.mcc <- round(MCC(j48.confusion.matrix),digits=2)

if (!quiet) {
message(
"J48 SN: ", j48.sn, "\n",
"J48 SP: ", j48.sp, "\n",
"J48 ACC: ", j48.acc, "\n",
"J48 MCC: ", j48.mcc, "\n",
"J48 MCC: ", j48.mcc, "\n"
)
}
return(j48.performance)
}
}
5 changes: 1 addition & 4 deletions R/Jaccard.R
Expand Up @@ -26,9 +26,6 @@ Jaccard <- function(
JACCARD <- c()

# Validation
if (length(object@kmeans$kpart) == 0) {
stop("run Clustexp before Jaccard")
}
if (!(Clustering %in% c("K-means", "MB"))) {
stop("Clustering has to be either K-means or MB")
}
Expand Down Expand Up @@ -71,4 +68,4 @@ Jaccard <- function(
box()
}
return(JACCARD)
}
}
6 changes: 3 additions & 3 deletions R/Networking.R
Expand Up @@ -50,7 +50,7 @@ Networking <- function(
"Examine response components =",
status_code(repos),
"\t",
"(200 means successful)",
"(200 means successful)"
)
y <- repos$request$url
if (!is.null(FileName)) {
Expand All @@ -74,11 +74,11 @@ Networking <- function(
rasterImage(Network, 0, 0, 1, 1)
message(
"\n",
"You can see the network with high resolution",
"You can see the network with high resolution ",
"by clicking on the following link:",
"\n",
paste0(y)
)
set_plot_dimensions(8, 8) # resets to default values
}
}
}
5 changes: 3 additions & 2 deletions R/PlotMBpca.R
Expand Up @@ -32,7 +32,8 @@ PlotMBpca <- function(object, type="order", g=NULL, n=NULL) {
if (is.null(n)) {
n <- g[1]
}
l <- apply(object@ndata[g,] - .1, 2, sum) + .1
logObj <- log(object@ndata)
l <- apply(logObj[g,] - .1, 2, sum) + .1
x <- data$pcareduceres
} else if (type == "order") {
MBordertable <- cbind(data$pcareduceres, object@MBordering)
Expand Down Expand Up @@ -97,4 +98,4 @@ PlotMBpca <- function(object, type="order", g=NULL, n=NULL) {
xaxt = "n"
)
layout(1)
}
}

0 comments on commit 0c90899

Please sign in to comment.