Mercurial > repos > iuc > raceid_diffgene
comparison scripts/raceID_diffgenes.R @ 0:ea8215239735 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/raceid commit 39918bfdb08f06862ca395ce58a6f5e4f6dd1a5e
author | iuc |
---|---|
date | Sat, 03 Mar 2018 17:33:56 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ea8215239735 |
---|---|
1 #!/usr/bin/env Rscript | |
2 | |
3 args = commandArgs(trailingOnly=T) | |
4 | |
5 script_dir = args[1] | |
6 config_file = args[2] | |
7 | |
8 # Load libs, common functions, source RaceID, | |
9 # Galaxy Params, and read input data (sc) | |
10 source(paste(script_dir, "common.R", sep="/")) | |
11 | |
12 # Read input data | |
13 message("Count matrix with %.0f cells and %.0f genes", dim(sc@fdata)[1], dim(sc@fdata)[2]) | |
14 | |
15 cdiff <- clustdiffgenes(sc, pvalue=c_pval) | |
16 | |
17 if (generate_extable){ | |
18 # differentially expressed genes in cluster | |
19 | |
20 if (!(dir.exists(outtable_dir))){ | |
21 dir.create(outtable_dir) | |
22 } | |
23 | |
24 for ( n in names(cdiff) ){ | |
25 write.table( | |
26 data.frame( | |
27 GENEID=rownames(cdiff[[n]]), | |
28 cdiff[[n]] | |
29 ), | |
30 paste(outtable_dir, "/gdiff", "_", n, ".tsv", sep=""), # gdiff_cl.n.tsv | |
31 row.names=FALSE, | |
32 col.names=TRUE, | |
33 sep="\t", | |
34 quote=FALSE | |
35 ) | |
36 } | |
37 } | |
38 | |
39 if (compare_clusters){ | |
40 clust1 <- c(unlist(lapply(strsplit(clust1, "\\s*,\\s*"), as.integer))) | |
41 clust2 <- c(unlist(lapply(strsplit(clust2, "\\s*,\\s*"), as.integer))) | |
42 | |
43 if (length(clust1) == 1){ clust1 <- clust1[[1]] } | |
44 if (length(clust2) == 1){ clust2 <- clust2[[1]] } | |
45 | |
46 message("Performing diffgenes with cl1=%s, cl2=%s, mincount=%.0f, gene='%s'", clust1, clust2, mcount, gene_name) | |
47 d <- diffgenes(sc,cl1 = clust1, cl2 = clust2, mincount = mcount) | |
48 | |
49 plotter("plot_diffgenes", plotdiffgenes(d,gene= gene_name)) | |
50 } |