Mercurial > repos > artbio > ngsplot
annotate ngs.plot.r @ 3:de27d4172d19 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
author | artbio |
---|---|
date | Fri, 08 Dec 2017 17:14:03 -0500 |
parents | 3ca58369469c |
children |
rev | line source |
---|---|
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
2 # |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
3 # Program: ngs.plot.r |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
4 # Purpose: Plot sequencing coverages at different genomic regions. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
5 # Allow overlaying various coverages with gene lists. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
6 # |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
7 # -- by Li Shen, MSSM |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
8 # Created: Nov 2011. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
9 # -- by Christophe Antoniewski |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
10 # recoded for Galaxy: Dec 2017 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
11 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
12 ngsplot.version <- '2.63_artbio' |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
13 # Program environment variable. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
14 progpath <- Sys.getenv('NGSPLOT') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
15 if(progpath == "") { |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
16 stop("Set environment variable NGSPLOT before run the program. See README |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
17 for details.\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
18 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
19 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
20 source(file.path(progpath, 'lib', 'parse.args.r')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
21 source(file.path(progpath, 'lib', 'genedb.r')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
22 source(file.path(progpath, 'lib', 'plotlib.r')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
23 source(file.path(progpath, 'lib', 'coverage.r')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
24 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
25 # Deal with command line arguments. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
26 cmd.help <- function(){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
27 cat("\nVisit https://github.com/shenlab-sinai/ngsplot/wiki/ProgramArguments101 for details\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
28 cat(paste("Version:", ngsplot.version, sep=" ")) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
29 cat("\nUsage: ngs.plot.r -G genome -R region -C [cov|config]file\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
30 cat(" -O name [Options]\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
31 cat("\n## Mandatory parameters:\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
32 cat(" -G Genome name. Use ngsplotdb.py list to show available genomes.\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
33 cat(" -R Genomic regions to plot: tss, tes, genebody, exon, cgi, enhancer, dhs or bed\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
34 cat(" -C Indexed bam file or a configuration file for multiplot\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
35 cat(" -O Name for output: multiple files will be generated\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
36 cat("## Optional parameters related to configuration file:\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
37 cat(" -E Gene list to subset regions OR bed file for custom region\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
38 cat(" -T Image title\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
39 EchoCoverageArgs() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
40 EchoPlotArgs() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
41 cat("\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
42 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
43 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
44 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
45 ########################################################################### |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
46 #################### Deal with program input arguments #################### |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
47 args <- commandArgs(T) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
48 # args <- unlist(strsplit('-G mm10 -R tss -C K27M_no_stim_3_GATCAG_L006_R1_001Aligned.out.srt.rmdup.bam -O test -Debug 1', ' ')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
49 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
50 # Input argument parser. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
51 args.tbl <- parseArgs(args, c('-G', '-C', '-R')) # see lib/parse.args.r |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
52 if(is.null(args.tbl)){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
53 cmd.help() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
54 stop('Error in parsing command line arguments. Stop.\n') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
55 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
56 genome <- args.tbl['-G'] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
57 reg2plot <- args.tbl['-R'] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
58 warning(sprintf("%s", args.tbl)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
59 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
60 cat("Configuring variables...") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
61 # Load tables of database: default.tbl, dbfile.tbl |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
62 default.tbl <- read.delim(file.path(progpath, 'database', 'default.tbl')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
63 dbfile.tbl <- read.delim(file.path(progpath, 'database', 'dbfile.tbl')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
64 CheckRegionAllowed(reg2plot, default.tbl) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
65 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
66 # Setup variables from arguments. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
67 cov.args <- CoverageVars(args.tbl, reg2plot) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
68 attach(cov.args) # |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
69 plot.args <- PlotVars(args.tbl) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
70 attach(plot.args) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
71 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
72 # Configuration: coverage-genelist-title relationships. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
73 ctg.tbl <- ConfigTbl(args.tbl, fraglen) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
74 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
75 # Setup plot-related coordinates and variables. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
76 plotvar.list <- SetupPlotCoord(args.tbl, ctg.tbl, default.tbl, dbfile.tbl, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
77 progpath, genome, reg2plot, inttag, flanksize, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
78 samprate, galaxy) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
79 attach(plotvar.list) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
80 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
81 # Setup data points for plot. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
82 pts.list <- SetPtsSpline(pint, lgint) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
83 pts <- pts.list$pts # data points for avg. profile and standard errors. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
84 m.pts <- pts.list$m.pts # middle data points. For pint, m.pts=1. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
85 f.pts <- pts.list$f.pts # flanking region data points. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
86 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
87 # Setup matrix for avg. profiles. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
88 regcovMat <- CreatePlotMat(pts, ctg.tbl) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
89 # Setup matrix for standard errors. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
90 confiMat <- CreateConfiMat(se, pts, ctg.tbl) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
91 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
92 # Genomic enrichment for all profiles in the config. Use this for heatmaps. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
93 enrichList <- vector('list', nrow(ctg.tbl)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
94 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
95 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
96 # Load required libraries. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
97 cat("Loading R libraries") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
98 if(!suppressMessages(require(ShortRead, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
99 source("http://bioconductor.org/biocLite.R") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
100 biocLite(ShortRead) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
101 if(!suppressMessages(require(ShortRead, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
102 stop('Loading package ShortRead failed!') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
103 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
104 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
105 cat('.') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
106 if(!suppressMessages(require(BSgenome, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
107 source("http://bioconductor.org/biocLite.R") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
108 biocLite(BSgenome) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
109 if(!suppressMessages(require(BSgenome, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
110 stop('Loading package BSgenome failed!') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
111 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
112 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
113 cat('.') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
114 if(!suppressMessages(require(doMC, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
115 install.packages('doMC') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
116 if(!suppressMessages(require(doMC, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
117 stop('Loading package doMC failed!') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
118 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
119 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
120 # Register doMC with CPU number. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
121 if(cores.number == 0){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
122 registerDoMC() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
123 } else { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
124 registerDoMC(cores.number) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
125 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
126 cat('.') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
127 if(!suppressMessages(require(caTools, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
128 install.packages('caTools') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
129 if(!suppressMessages(require(caTools, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
130 stop('Loading package caTools failed!') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
131 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
132 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
133 cat('.') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
134 if(!suppressMessages(require(utils, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
135 install.packages('utils') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
136 if(!suppressMessages(require(utils, warn.conflicts=F))) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
137 stop('Loading package utils failed!') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
138 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
139 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
140 cat('.') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
141 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
142 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
143 ####################################################################### |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
144 # Here start to extract coverages for all genomic regions and calculate |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
145 # data for plotting. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
146 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
147 cat("Analyze bam files and calculate coverage") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
148 # Extract bam file names from configuration and determine if bam-pair is used. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
149 bfl.res <- bamFileList(ctg.tbl) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
150 bam.pair <- bfl.res$bbp # boolean for bam-pair. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
151 bam.list <- bfl.res$bam.list # bam file list. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
152 CheckHMColorConfig(hm.color, bam.pair) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
153 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
154 # Determine if bowtie is used to generate the bam files. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
155 # Index bam files if not done yet. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
156 v.map.bowtie <- headerIndexBam(bam.list) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
157 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
158 # Retrieve chromosome names for each bam file. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
159 sn.list <- seqnamesBam(bam.list) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
160 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
161 # Calculate library size from bam files for normalization. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
162 v.lib.size <- libSizeBam(bam.list) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
163 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
164 v.low.cutoff <- vector("integer", nrow(ctg.tbl)) # low count cutoffs. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
165 # Process the config file row by row. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
166 # browser() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
167 for(r in 1:nrow(ctg.tbl)) { # r: index of plots/profiles. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
168 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
169 reg <- ctg.tbl$glist[r] # retrieve gene list names. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
170 # Create coordinate chunk indices. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
171 chkidx.list <- chunkIndex(nrow(coord.list[[reg]]), gcs) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
172 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
173 # Do coverage for each bam file. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
174 bam.files <- unlist(strsplit(ctg.tbl$cov[r], ':')) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
175 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
176 # Obtain fraglen for each bam file. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
177 fraglens <- as.integer(unlist(strsplit(ctg.tbl$fraglen[r], ':'))) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
178 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
179 # Obtain bam file basic info. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
180 libsize <- v.lib.size[bam.files[1]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
181 v.low.cutoff[r] <- low.count / libsize * 1e6 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
182 result.pseudo.rpm <- 1e6 / libsize |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
183 sn.inbam <- sn.list[[bam.files[1]]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
184 # chr.tag <- chrTag(sn.inbam) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
185 chr.tag <- NA # do NOT modify the chromosome names. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
186 is.bowtie <- v.map.bowtie[bam.files[1]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
187 cat("\nreport reg2plot\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
188 cat(reg2plot) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
189 cat("\n") |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
190 result.matrix <- covMatrix(debug, chkidx.list, coord.list[[reg]], rnaseq.gb, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
191 exonmodel, libsize, TRUE, chr.tag, pint, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
192 reg2plot, flanksize, flankfactor, m.pts, f.pts, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
193 bufsize, cov.algo, bam.files[1], sn.inbam, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
194 fraglens[1], map.qual, is.bowtie, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
195 strand.spec=strand.spec) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
196 # Rprof(NULL) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
197 if(bam.pair) { # calculate background. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
198 fraglen2 <- ifelse(length(fraglens) > 1, fraglens[2], fraglens[1]) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
199 libsize <- v.lib.size[bam.files[2]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
200 bkg.pseudo.rpm <- 1e6 / libsize |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
201 sn.inbam <- sn.list[[bam.files[2]]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
202 # chr.tag <- chrTag(sn.inbam) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
203 chr.tag <- NA |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
204 is.bowtie <- v.map.bowtie[bam.files[2]] |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
205 # if(class(chr.tag) == 'character') { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
206 # stop(sprintf("Read %s error: %s", bam.files[2], chr.tag)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
207 # } |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
208 bkg.matrix <- covMatrix(debug, chkidx.list, coord.list[[reg]], rnaseq.gb, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
209 exonmodel, libsize, TRUE, chr.tag, pint, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
210 reg2plot, flanksize, flankfactor, m.pts, f.pts, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
211 bufsize, cov.algo, bam.files[2], sn.inbam, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
212 fraglen2, map.qual, is.bowtie, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
213 strand.spec=strand.spec) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
214 # browser() |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
215 result.matrix <- log2((result.matrix + result.pseudo.rpm) / |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
216 (bkg.matrix + bkg.pseudo.rpm)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
217 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
218 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
219 # Calculate SEM if needed. Shut off SEM in single gene case. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
220 if(nrow(result.matrix) > 1 && se){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
221 confiMat[, r] <- apply(result.matrix, 2, function(x) CalcSem(x, robust)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
222 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
223 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
224 # Book-keep this matrix for heatmap. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
225 enrichList[[r]] <- result.matrix |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
226 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
227 # Return avg. profile. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
228 regcovMat[, r] <- apply(result.matrix, 2, function(x) mean(x, trim=robust, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
229 na.rm=T)) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
230 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
231 # browser() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
232 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
233 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
234 ######################################## |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
235 # Add row names to heatmap data. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
236 for(i in 1:length(enrichList)) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
237 reg <- ctg.tbl$glist[i] # gene list name. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
238 rownames(enrichList[[i]]) <- paste(coord.list[[reg]]$gname, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
239 coord.list[[reg]]$tid, sep=':') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
240 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
241 # Some basic parameters. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
242 xticks <- genXticks(reg2plot, pint, lgint, pts, flanksize, flankfactor, Labs) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
243 unit.width <- 4 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
244 ng.list <- sapply(enrichList, nrow) # number of genes per heatmap. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
245 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
246 # Create image file and plot data into it. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
247 if(!fi_tag){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
248 cat("Plotting figures...") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
249 #### Average profile plot. #### |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
250 out.plot <- avgname |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
251 pdf(out.plot, width=plot.width, height=plot.height, pointsize=font.size) |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
252 plotmat(regcovMat, ctg.tbl$title, ctg.tbl$color, bam.pair, xticks, pts, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
253 m.pts, f.pts, pint, shade.alp, confiMat, mw, prof.misc) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
254 out.dev <- dev.off() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
255 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
256 #### Heatmap. #### |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
257 # Setup output device. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
258 hd <- SetupHeatmapDevice(reg.list, uniq.reg, ng.list, pts, font.size, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
259 unit.width, rr) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
260 reg.hei <- hd$reg.hei # list of image heights for unique regions. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
261 hm.width <- hd$hm.width # image width. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
262 hm.height <- hd$hm.height # image height. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
263 lay.mat <- hd$lay.mat # matrix for heatmap layout. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
264 heatmap.mar <- hd$heatmap.mar # heatmap margins in inches. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
265 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
266 out.hm <- heatmapname |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
267 pdf(out.hm, width=hm.width, height=hm.height, pointsize=font.size) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
268 par(mai=heatmap.mar) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
269 layout(lay.mat, heights=reg.hei) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
270 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
271 # Do heatmap plotting. |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
272 go.list <- plotheat(reg.list, uniq.reg, enrichList, v.low.cutoff, go.algo, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
273 go.paras, ctg.tbl$title, bam.pair, xticks, flood.frac, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
274 do.plot=T, hm.color=hm.color, color.distr=color.distr, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
275 color.scale=color.scale) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
276 out.dev <- dev.off() |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
277 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
278 } else { |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
279 go.list <- plotheat(reg.list, uniq.reg, enrichList, v.low.cutoff, go.algo, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
280 go.paras, ctg.tbl$title, bam.pair, xticks, flood.frac, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
281 do.plot=F, hm.color=hm.color, color.distr=color.distr, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
282 color.scale=color.scale) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
283 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
284 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
285 # Save plotting data. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
286 oname1="data" |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
287 cat("Saving results...") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
288 dir.create(oname1, showWarnings=F) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
289 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
290 # Average profiles. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
291 out.prof <- file.path(oname1, 'avgprof.txt') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
292 write.table(regcovMat, file=out.prof, row.names=F, sep="\t", quote=F) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
293 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
294 # Standard errors of mean. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
295 if(!is.null(confiMat)){ |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
296 out.confi <- file.path(oname1, 'sem.txt') |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
297 write.table(confiMat, file=out.confi, row.names=F, sep="\t", quote=F) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
298 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
299 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
300 # Heatmap density values. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
301 for(i in 1:length(enrichList)) { |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
302 reg <- ctg.tbl$glist[i] # gene list name. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
303 out.heat <- file.path(oname1, paste('hm', i, '.txt', sep='')) |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
304 write.table(cbind(coord.list[[reg]][, c('gid', 'gname', 'tid', 'strand')], |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
305 enrichList[[i]]), |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
306 file=out.heat, row.names=F, sep="\t", quote=F) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
307 } |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
308 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
309 # Avg. profile R data. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
310 prof.dat <- file.path(oname1, 'avgprof.RData') |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
311 save(plot.width, plot.height, regcovMat, ctg.tbl, bam.pair, xticks, pts, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
312 m.pts, f.pts, pint, shade.alp, confiMat, mw, prof.misc, se, v.lib.size, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
313 font.size, |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
314 file=prof.dat) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
315 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
316 # Heatmap R data. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
317 heat.dat <- file.path(oname1, 'heatmap.RData') |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
318 save(reg.list, uniq.reg, ng.list, pts, enrichList, v.low.cutoff, go.algo, |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
319 ctg.tbl, bam.pair, xticks, flood.frac, hm.color, unit.width, rr, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
320 go.list, color.scale, v.lib.size, font.size, go.paras, low.count, |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
321 color.distr, |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
322 file=heat.dat) |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
323 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
324 |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
325 # Wrap results up. |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
326 cat("Wrapping results up...") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
327 cur.dir <- getwd() |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
328 cat("cur.dir") |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
329 cat(cur.dir) |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
330 out.dir <- dirname(oname1) |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
331 cat("out.dir") |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
332 cat(out.dir) |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
333 out.zip <- basename(oname1) |
3
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
334 cat("out.zip") |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
335 cat(out.zip) |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
336 #setwd(out.dir) |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
337 #cat("Reaching this point without failure") |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
338 #zip(paste(out.zip, '.zip', sep=''), out.zip, extras='-q') |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
339 zip("data.zip", "data", extras='-q') |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
340 #if(!zip(paste(out.zip, '.zip', sep=''), out.zip, extras='-q')) { |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
341 # if(unlink(oname, recursive=T)) { |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
342 # warning(sprintf("Unable to delete intermediate result folder: %s", |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
343 # oname)) |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
344 # } |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
345 #} |
de27d4172d19
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'60a55d19937d9dc976020e1c396948b41967a7f8\n'
artbio
parents:
0
diff
changeset
|
346 #setwd(cur.dir) |
0
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
347 cat("Done\n") |
3ca58369469c
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/ngsplot commit b'e9fcc157a7f2f2fa9d6ac9a58d425ff17c975f5c\n'
artbio
parents:
diff
changeset
|
348 cat("All done. Cheers!\n") |