Mercurial > repos > iuc > raceid_main
comparison scripts/raceID_outlierdetect.R @ 0:e01c989c7543 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:34:16 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e01c989c7543 |
---|---|
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 message("Detecting outliers using the following parameters: outminc=%.0f, outlg=%.0f, probthr=%.0f outdistquant=%.0f", c_outminc, c_outlg, c_probthr, c_outdistquant) | |
15 | |
16 sc <- findoutliers( | |
17 sc, outminc=c_outminc, outlg=c_outlg, probthr=c_probthr, | |
18 thr=2**-(1:40), outdistquant=c_outdistquant | |
19 ) | |
20 | |
21 message("Plotting images") | |
22 plotter("plot_background", plotbackground(sc)) | |
23 plotter("plot_sensitivity", plotsensitivity(sc)) | |
24 plotter("plot_outlierprobs", plotoutlierprobs(sc)) | |
25 plotter("plot_finalheat", y <- clustheatmap(sc,final=TRUE,hmethod="single")) | |
26 | |
27 | |
28 message("Finished plots") | |
29 | |
30 message("Generating data tables") | |
31 x <- data.frame( CELLID=names(sc@cpart), cluster=sc@cpart ) | |
32 write.table( | |
33 x[order(x$cluster,decreasing=FALSE),], output_table, | |
34 row.names=FALSE, col.names=TRUE, sep="\t", quote=FALSE | |
35 ) | |
36 | |
37 if (generate_final_rdata){ | |
38 message("Saving SC object") | |
39 saveRDS(sc, output_rdat) | |
40 } | |
41 | |
42 | |
43 | |
44 | |
45 |