annotate mytools/genomeView.xml @ 7:f0dc65e7f6c0

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:59:07 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
1 <tool id="genomeview" name="whole genome">
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
2 <description>plot and correlation</description>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
3 <command>cat $script_file | R --vanilla --slave 2> err.log </command>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
4 <inputs>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
5 <param name="genome" type="select" label="Select genome">
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
6 <option value="/Users/xuebing/galaxy-dist/tool-data/genome/chrsize/mouse.mm9.genome" selected="true">mm9</option>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
7 <option value="/Users/xuebing/galaxy-dist/tool-data/genome/chrsize/mouse.mm8.genome">mm8</option>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
8 <option value="/Users/xuebing/galaxy-dist/tool-data/genome/chrsize/human.hg18.genome">hg18</option>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
9 <option value="/Users/xuebing/galaxy-dist/tool-data/genome/chrsize/human.hg19.genome">hg19</option>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
10 </param>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
11 <param name="resolution" type="integer" label="resolution" value="5000" help="resolution in bps. It must be between 200 and 10,000,000">
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
12 <validator type="in_range" max="1000000000" min="200" message="Resolution is out of range, Resolution has to be between 200 to 100000000" />
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
13 </param>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
14 <param name="log" label="plot the log" type="boolean" truevalue="log" falsevalue="none" checked="False"/>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
15 <param name="union" label="compute correlation in union regions" help="ignore regions covered by neither interval sets. Recommended for sparse data under high resolution when most regions are empty" type="boolean" truevalue="union" falsevalue="none" checked="False"/>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
16 <repeat name="series" title="input file">
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
17 <param name="label" type="text" value="" size="30" label="Data Label"/>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
18 <param name="input" type="data" format="interval" label="Dataset"/>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
19 </repeat>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
20 </inputs>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
21
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
22 <configfiles>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
23 <configfile name="script_file">
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
24 ## Setup R error handling to go to stderr
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
25 options(warn=-1)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
26 source("/Users/xuebing/galaxy-dist/tools/mytools/genomeview.r")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
27 genome = read.table( "${genome}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
28 uselog = as.character("${log}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
29 union = as.character("${union}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
30 resolution = as.integer("${resolution}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
31 cat('resolution=',resolution,'\n')
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
32 offset = caloffset(genome)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
33 mcov = matrix(ncol=1,nrow=as.integer(offset[length(offset)] / resolution))
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
34 ## Open output PDF file
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
35 pdf( "${out_file1}" ,height=4,width=20)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
36 labels = character(0)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
37 ## Determine range of all series in the plot
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
38 #for $i, $s in enumerate( $series )
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
39 x = read.table( "${s.input.file_name}" )
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
40 res = coverage(x,genome,offset,resolution)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
41 plotcov(res,genome,offset,"${s.label.value}",uselog)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
42 labels = c(labels,"${s.label.value}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
43 attach(res)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
44 mcov = cbind(mcov,cov)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
45 detach(res)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
46 #end for
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
47 dev.off()
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
48 pdf("${out_file2}")
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
49 mcov = mcov[,-1]
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
50 nSample = length(labels)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
51 if (nSample > 1) {
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
52 if (union == 'union') {
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
53 cm = matrix(0,nrow=nSample,ncol=nSample)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
54 for (i in 1:(nSample-1)) {
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
55 cm[i,i] = 1
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
56 for (j in (i+1):nSample){
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
57 cm[i,j] = union_correlation(mcov[,i],mcov[,j])
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
58 cm[j,i] = cm[i,j]
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
59 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
60 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
61 cm[nSample,nSample] = 1
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
62 } else {
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
63 cm = cor(mcov)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
64 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
65 rm(mcov)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
66 ##heatmap(-cm,margins=c(8,8),sym=T,scale='none',labRow=labels,labCol=labels)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
67 ##heatmap2(cm,'none',TRUE,c(8,8),labels,labels)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
68 x = cm
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
69 h = heatmap(-x,scale='none',sym=T,margins=c(8,8),labRow=labels,labRol=labels)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
70 attach(h)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
71 x = x[rowInd,colInd]
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
72 tx = numeric(0)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
73 ty = numeric(0)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
74 txt = character(0)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
75 for (i in 1:nrow(x)){
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
76 for (j in 1:ncol(x)){
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
77 tx = c(tx,i)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
78 ty = c(ty,ncol(x)-j+1)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
79 txt = c(txt,round(x[i,j]*100)/100)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
80 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
81 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
82 heatmap(-x,scale='none',sym=T,margins=c(8,8),labRow=labels[rowInd],labCol=labels[colInd],add.expr=text(tx,ty,txt,col='black'))
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
83 library(gplots)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
84 heatmap.2(cm,margins=c(8,8),scale='none',key=TRUE,trace='none', symkey=T,symbreaks=T,col=bluered,labRow=labels,labCol=labels,symm=T)
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
85 }
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
86 dev.off()
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
87 </configfile>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
88 </configfiles>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
89
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
90 <outputs>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
91 <data format="pdf" name="out_file1" label="${tool.name} on ${on_string}: (plot)" />
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
92 <data format="pdf" name="out_file2" label="${tool.name} on ${on_string}: (correlation)" />
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
93 </outputs>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
94
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
95 <help>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
96 .. class:: infomark
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
97
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
98 This tool allows you to plot multiple intervals across all chromosomes at different resolution, and it also plots the correlation matrix if multiple intervals are provided.
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
99
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
100 -----
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
101
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
102 **Example**
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
103
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
104 .. image:: ./static/images/correlationmatrix.png
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
105 .. image:: ./static/images/wholegenome.png
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
106
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
107 </help>
f0dc65e7f6c0 Uploaded
xuebing
parents:
diff changeset
108 </tool>