Mercurial > repos > iuc > raceid_main
comparison scripts/raceID_tsne.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 | |
15 sc <- comptsne(sc,rseed = c_rseed) | |
16 | |
17 message("Plotting initial and final tSNEs") | |
18 | |
19 plotter("plot_initial", plottsne(sc,final = F)) | |
20 plotter("plot_final", plottsne(sc,final = T)) | |
21 | |
22 if (gene_sets != "" ){ | |
23 ####all_sets <- strsplit(gene_sets, "+?\\s*__split__\\s*,?") | |
24 all_sets <- strsplit(gene_sets, '\\s*\\+?\\s*_split_\\s*,?') | |
25 print(all_sets) | |
26 | |
27 for (given in all_sets){ | |
28 given <- trimws(given) | |
29 message("Plotting %s", given) | |
30 g <- c(unlist(strsplit(given,'\\s*\\+\\s*'))) | |
31 plotter(paste("plot", given, sep="_"), plotexptsne(sc,g, n=given, logsc=T)) | |
32 } | |
33 } | |
34 | |
35 | |
36 if (regex_val != ""){ | |
37 message("using subcell groups") | |
38 plotter("plot_labels", plotlabelstsne(sc, labels = sub(regex_val, "", names(sc@ndata)))) | |
39 plotter("plot_symbols", plotsymbolstsne(sc, types = sub(regex_val, "", names(sc@ndata)))) | |
40 } else { | |
41 message("using all cell ids") | |
42 plotter("plot_labels", plotlabelstsne(sc, labels = names(sc@ndata))) | |
43 plotter("plot_symbols", plotsymbolstsne(sc, types = names(sc@ndata))) | |
44 } | |
45 | |
46 message("Saving SC object") | |
47 saveRDS(sc, output_rdat) |