Commit 9c1d3a04 authored by Olesya's avatar Olesya 🐋
Browse files

EdgeR

parent aa3bee1a
......@@ -6,4 +6,5 @@ RUN Rscript install.R
COPY hobotnica hobotnica
RUN cd hobotnica && R CMD INSTALL --no-multiarch --with-keep.source .
COPY run.R .
ENTRYPOINT ["/bin/bash"]
\ No newline at end of file
......@@ -10,7 +10,12 @@ And gives best result based on score
## Install
Build docker:
```
podman build -t diff_exp .
podman build -t hobotnica .
```
## Run
To score tools on count matrix with coldata, run:
```
podman run -it -v /path/to/data/:/shared/:Z hobontica Rscript run.R /shared/matrix.count /shared/coldata /shared/output.txt
```
## Doc for dev
Add required packages in `install.R`
\ No newline at end of file
devtools::install_github("WLOGSolutions/r-logging/pkg")
install.packages(c('doParallel', 'ggplot2'), dependencies = TRUE)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("DESeq2")
BiocManager::install("tximeta")
\ No newline at end of file
BiocManager::install("tximeta")
BiocManager::install("edgeR")
library(logging)
library(edgeR)
library(Hobotnica)
# Logger config
basicConfig()
# Score edgeR module
DEedgeR <- function(cts, annotation) {
loginfo('EdgeR diferential analysis start')
y <- DGEList(counts = cts, group = annotation)
design <- model.matrix(~annotation)
y <- estimateDisp(y, design)
# Differential Expression Analysis
et <- exactTest(y)
# Top genes
top <- topTags(et)
top_subset <- rownames(top)
loginfo(paste0('Leave top ', length(top_subset), ' genes'))
# Leave only top genes
data <- t(cpm(y)[top_subset,])
dist_matrix <- dist(data)
# Score result
res <- Hobotnica(dist_matrix, annotation)
loginfo(paste0('Hobotnica score of edgeR is ', res))
return(res)
}
#@TODO Load data
cm_args <- commandArgs(trailingOnly = TRUE)
count <- cm_args[1]
cols <- cm_args[2]
out <- cm_args[3]
# Remove comments when data loads from file
# if (!file.exists(count)) {
# stop("File ", count, " does not exists!")
# }
# if (!file.exists(cols)) {
# stop("File ", count, " does not exists!")
# }
if (out == "") {
stop("Enter output file as third argument!")
}
loginfo('Run 5 differential analysis tools and score with Hobotnica')
loginfo(paste0('Count matrix is in ', count))
loginfo(paste0('Coldata is in ', cols))
loginfo(paste0('Output will be written in ', out))
# Load coldata
load('/shared/pasilla.coldata')
# Load cts
load('/shared/pasilla.count')
# @TODO Run 5 tools
res_edgeR <- DEedgeR(cts, coldata$condition)
# Output
loginfo('Save results')
fout <- file(out)
writeLines(paste0("edgeR score: ", res_edgeR), fout)
\ No newline at end of file
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