annotate genomeView.xml @ 12:2f4ea569f048

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