Mercurial > repos > iuc > scater_plot_pca
comparison scater-plot-exprs-freq.R @ 0:bea3359ba852 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scater commit 5fdcafccb6c645d301db040dfeed693d7b6b4278
| author | iuc |
|---|---|
| date | Thu, 18 Jul 2019 11:11:45 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:bea3359ba852 |
|---|---|
| 1 #!/usr/bin/env Rscript | |
| 2 | |
| 3 #Plots mean expression vs % of expressing cells and provides information as to the number of genes expressed in 50% and 25% of cells. | |
| 4 # Load optparse we need to check inputs | |
| 5 | |
| 6 library(optparse) | |
| 7 library(workflowscriptscommon) | |
| 8 library(LoomExperiment) | |
| 9 library(scater) | |
| 10 | |
| 11 # parse options | |
| 12 | |
| 13 option_list = list( | |
| 14 make_option( | |
| 15 c("-i", "--input-loom"), | |
| 16 action = "store", | |
| 17 default = NA, | |
| 18 type = 'character', | |
| 19 help = "A SingleCellExperiment object file in Loom format." | |
| 20 ), | |
| 21 make_option( | |
| 22 c("-o", "--output-plot-file"), | |
| 23 action = "store", | |
| 24 default = NA, | |
| 25 type = 'character', | |
| 26 help = "Path of the PDF output file to save plot to." | |
| 27 ) | |
| 28 ) | |
| 29 | |
| 30 opt <- wsc_parse_args(option_list, mandatory = c('input_loom', 'output_plot_file')) | |
| 31 | |
| 32 # Check parameter values | |
| 33 | |
| 34 if ( ! file.exists(opt$input_loom)){ | |
| 35 stop((paste('File', opt$input_loom, 'does not exist'))) | |
| 36 } | |
| 37 | |
| 38 | |
| 39 # Input from Loom format | |
| 40 | |
| 41 scle <- import(opt$input_loom, format='loom', type='SingleCellLoomExperiment') | |
| 42 | |
| 43 #produce and save the scatter plot of reads vs genes | |
| 44 plot <- plotExprsFreqVsMean(scle, controls = "is_feature_control_MT") | |
| 45 ggsave(opt$output_plot_file, plot, device="pdf") |
