annotate readmap.xml @ 1:eee9701a7491 draft

Uploaded
author mvdbeek
date Sun, 29 Mar 2015 13:07:57 -0400
parents 9af9983dcd02
children 4895f7c6ae4d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
1 <tool id="Readmap" name="Generate readmap and histograms from alignment files" version="1.0.0">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
2 <description>from sRbowtie aligment</description>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
3 <requirements>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
4 <requirement type="package" version="0.12.7">bowtie</requirement>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
5 <requirement type="package" version="0.1.18">samtools</requirement>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
6 <requirement type="package" version="0.7.7">pysam</requirement>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
7 <requirement type="package" version="2.14">biocbasics</requirement>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
8 <requirement type="package" version="3.0.3">R</requirement>
1
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
9 <requirement type="package" version="1.9">numpy</requirement>
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
10 <requirement type="package" version="0.14">scipy</requirement>
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
11 </requirements>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
12 <command interpreter="python">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
13 readmap.py
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
14 #if $refGenomeSource.genomeSource == "history":
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
15 --reference_fasta ## sys.argv[2]
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
16 $refGenomeSource.ownFile ## index source
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
17 #else:
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
18 #silent reference= filter( lambda x: str( x[0] ) == str( $refGenomeSource.series[0].input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
19 --reference_bowtie_index
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
20 $reference
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
21 #end if
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
22 --rcode
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
23 $plotCode
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
24 --output_readmap
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
25 $readmap_dataframe
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
26 --output_size_distribution
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
27 $size_distribution_dataframe
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
28 --minquery
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
29 $minquery
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
30 --maxquery
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
31 $maxquery
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
32 --input
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
33 #for $i in $refGenomeSource.series
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
34 $i.input
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
35 #end for
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
36 --ext
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
37 #for $i in $refGenomeSource.series
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
38 $i.input.ext
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
39 #end for
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
40 --label
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
41 #for $i in $refGenomeSource.series
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
42 "$i.input.name"
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
43 #end for
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
44 --normalization_factor
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
45 #for $i in $refGenomeSource.series
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
46 $i.norm
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
47 #end for
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
48 #if $gff:
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
49 --gff
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
50 $gff
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
51 #end if
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
52
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
53 </command>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
54 <inputs>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
55 <conditional name="refGenomeSource">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
56 <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
57 <option value="indexed">Use a built-in index</option>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
58 <option value="history">Use one from the history</option>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
59 </param>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
60 <when value="indexed">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
61 <repeat name="series" title="Add alignment files">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
62 <param name="input" type="data" label="Select multiple alignments to parse">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
63 <validator type="dataset_metadata_in_data_table" table_name="bowtie_indexes" metadata_name="dbkey" metadata_column="0" message="database not set for this bowtie output. Select the database(=genome used for matching) manually, or select a reference fasta from your history."/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
64 </param>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
65 <param name="norm" type="float" value="1" label="Indicate a normalization factor to compare multiple aligments"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
66 </repeat>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
67 </when>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
68 <when value="history">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
69 <param name="ownFile" type="data" format="fasta" label="Select a fasta file, that served as the reference index for the alignments" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
70 <repeat name="series" title="Add alignment files">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
71 <param name="input" type="data" label="Select multiple alignments to parse"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
72 <param name="norm" type="float" value="1" label="Indicate a normalization factor to compare multiple aligments"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
73 </repeat>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
74 </when>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
75 </conditional>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
76 <param name="gff" type="data" format="gff3" optional="true" label="Optional: select a GFF to investigate regions of interest" help="GFF must match genome build"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
77 <!-- <validator type="dataset_metadata_in_data_table" table_name="bowtie_indexes" metadata_name="dbkey" metadata_column="0" message="GFF database and alignment file databse do not match!"/> -->
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
78 <param name="minquery" type="integer" size="3" value="18" label="Min size of query small RNAs" help="'18' = 18 nucleotides"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
79 <param name="maxquery" type="integer" size="3" value="28" label="Max size of query small RNAs" help="'28' = 28 nucleotides"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
80 <param name="title" type="text" size="15" value= "Readmaps and size distributions" label="Main Titles"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
81 <param name="xlabel" type="text" size="15" value="Coordinates/read size" label="x axis label"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
82 <param name="ylabel" type="text" size="15" value="Number of reads" label="y axis label"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
83 <param name="rows_per_page" type="text" size="9" value="8" label="How many items to display per page?">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
84 <validator type="in_range" min="6" max="20" message="Select between 6 and 20 rows, as the readability will suffer otherwise."/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
85 </param>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
86 </inputs>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
87 <configfiles>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
88 <configfile name="plotCode">
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
89 ## Setup R error handling to go to stderr
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
90 options( show.error.messages=F,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
91 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
92 library(RColorBrewer)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
93 library(lattice)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
94 library(latticeExtra)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
95 library(grid)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
96 library(gridExtra)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
97
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
98 ## data frames implementation
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
99
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
100 rm=read.delim("${readmap_dataframe}", header=T, row.names=NULL)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
101 n_samples=length(unique(rm\$sample))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
102 genes=unique(levels(rm\$gene))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
103 per_gene_readmap=lapply(genes, function(x) subset(rm, gene==x)) ####### ?
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
104 n_genes=length(per_gene_readmap)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
105
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
106 size=read.delim("${size_distribution_dataframe}", header=T, row.names=NULL)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
107 per_gene_size=lapply(genes, function(x) subset(size, gene==x)) ###### ?
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
108
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
109 ## end of data frames implementation
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
110
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
111 ## functions
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
112
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
113 plot_readmap=function(df, ...) {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
114 combineLimits(xyplot(count~coord|factor(sample, levels=unique(sample))+reorder(gene, count, function(x) -sum(abs(x))),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
115 data=df,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
116 type='h',
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
117 scales= list(relation="free", x=list(rot=0, cex=0.7, axs="i", tck=0.5), y=list(tick.number=4, rot=90, cex=0.7)),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
118 xlab=NULL, main=NULL, ylab=NULL,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
119 as.table=T,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
120 origin = 0,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
121 horizontal=FALSE,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
122 group=polarity,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
123 col=c("red","blue"),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
124 par.strip.text = list(cex=0.7),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
125 ...))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
126 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
127
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
128 plot_size_distribution= function(df, ...) {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
129 smR.prepanel=function(x,y,...){; yscale=c(-max(abs(y)), max(abs(y)));list(ylim=yscale);}
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
130 bc= barchart(count~as.factor(size)|factor(sample, levels=unique(sample))+gene, data = df, origin = 0,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
131 horizontal=FALSE,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
132 group=polarity,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
133 stack=TRUE,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
134 col=c('red', 'blue'),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
135 cex=0.75,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
136 scales=list(y=list(tick.number=4, rot=90, relation="free", cex=0.7), x=list(cex=0.7) ),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
137 prepanel=smR.prepanel,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
138 xlab = NULL,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
139 ylab = NULL,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
140 main = NULL,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
141 as.table=TRUE,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
142 newpage = T,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
143 par.strip.text = list(cex=0.7),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
144 ...)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
145 combineLimits(bc)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
146 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
147
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
148 ## end of functions
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
149
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
150 ## function parameters'
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
151
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
152 par.settings.readmap=list(layout.heights=list(top.padding=0, bottom.padding=-2.5), strip.background = list(col=c("lightblue","lightgreen")) )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
153 par.settings.size=list(layout.heights=list(top.padding=-1, bottom.padding=-2.5), strip.background = list(col=c("lightblue","lightgreen")) )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
154 par.settings.combination.readmap=list(layout.heights=list(top.padding=0, bottom.padding=-3), strip.background=list(col=c("lightblue","lightgreen")) )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
155 par.settings.combination.size=list(layout.heights=list(top.padding=-2, bottom.padding=-0.5), strip.background=list(col=c("lightblue", "lightgreen")) )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
156
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
157 ## end of function parameters'
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
158
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
159 ## GRAPHS
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
160
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
161 if (n_genes > 7) {page_height_simple = 11.69; page_height_combi=11.69; rows_per_page=${rows_per_page}; extrarow=0 } else {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
162 rows_per_page= n_genes; page_height_simple = 11.69/n_genes/4; page_height_combi=11.69/(n_genes*2); extrarow=1 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
163 if (n_samples > 4) {page_width = 8.2677*n_samples/4} else {page_width = 8.2677*n_samples/3} # to test
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
164
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
165 pdf(file="${readmap_PDF}", paper="special", height=page_height_simple, width=page_width)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
166 for (i in seq(1,n_genes,rows_per_page)) {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
167 start=i
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
168 end=i+rows_per_page-1
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
169 if (end>n_genes) {end=n_genes}
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
170 readmap_plot.list=lapply(per_gene_readmap[start:end], function(x) plot_readmap(x, par.settings=par.settings.readmap))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
171 args.list=c(readmap_plot.list, list(nrow=rows_per_page, ncol=1,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
172 main=textGrob("Read Maps (nucleotide coordinates)", gp=gpar(cex=1), just="top"),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
173 left=textGrob("${ylabel}", gp=gpar(cex=1), vjust=1, rot=90)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
174 #sub=textGrob("readmap coordinates", gp=gpar(cex=.75), just="bottom")
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
175 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
176 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
177 do.call(grid.arrange, args.list)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
178 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
179 devname=dev.off()
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
180
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
181
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
182 pdf(file="${size_PDF}", paper="special", height=page_height_simple, width=page_width)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
183 for (i in seq(1,n_genes,rows_per_page)) {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
184 start=i
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
185 end=i+rows_per_page-1
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
186 if (end>n_genes) {end=n_genes}
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
187 plot.list=lapply(per_gene_size[start:end], function(x) plot_size_distribution(x, par.settings=par.settings.size) )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
188 args.list=c(plot.list, list(nrow=rows_per_page, ncol=1,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
189 main=textGrob("Size distributions (in nucleotides)", gp=gpar(cex=1), just="top"),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
190 left=textGrob("${ylabel}", gp=gpar(cex=1), vjust=1, rot=90)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
191 #sub="readsize in nucleotides"
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
192 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
193 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
194 do.call(grid.arrange, args.list)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
195 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
196 devname=dev.off()
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
197
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
198 pdf(file="${combi_PDF}", paper="special", height=page_height_combi, width=page_width)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
199 for (i in seq(1,n_genes,rows_per_page/2)) {
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
200 start=i
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
201 end=i+rows_per_page/2-1
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
202 if (end>n_genes) {end=n_genes}
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
203 read_plot.list=lapply(per_gene_readmap[start:end], function(x) plot_readmap(x, par.settings=par.settings.combination.readmap))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
204 size_plot.list=lapply(per_gene_size[start:end], function(x) plot_size_distribution(x, strip=FALSE, par.settings=par.settings.combination.size))
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
205 plot.list=rbind(read_plot.list, size_plot.list )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
206 args.list=c(plot.list, list(nrow=rows_per_page + extrarow, ncol=1,
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
207 main=textGrob("${title}", gp=gpar(cex=1), just="top"),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
208 left=textGrob("${ylabel}", gp=gpar(cex=1), vjust=1, rot=90),
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
209 sub=textGrob("${xlabel}", gp=gpar(cex=1), just="bottom")
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
210 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
211 )
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
212 do.call(grid.arrange, args.list)
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
213 }
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
214 devname=dev.off()
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
215
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
216
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
217 </configfile>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
218 </configfiles>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
219
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
220 <outputs>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
221 <data format="tabular" name="readmap_dataframe" label="Readmap dataframe"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
222 <data format="tabular" name="size_distribution_dataframe" label="Size distribution dataframe"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
223 <data format="pdf" name="readmap_PDF" label="Readmaps"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
224 <data format="pdf" name="size_PDF" label="Size distribution"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
225 <data format="pdf" name="combi_PDF" label="Size distribution and Readmaps"/>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
226 </outputs>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
227 <help>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
228
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
229 **What it does**
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
230
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
231 Takes one or more alignment files (BAM, SAM or tabular bowtie output) as input and produces a "Readmap",
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
232 where by default for each "chromosome" the position of the read is recorded on the x-axis, and the y-axis indicates
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
233 the number of reads per position. Reads that map in sense are on the top, reads that map antisense are on the bottom.
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
234
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
235
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
236 .. class:: warningmark
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
237
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
238 '''TIP''' The input data can be produced using the sRbowtie tool.
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
239
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
240 ----
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
241
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
242 '''Example'''
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
243
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
244 Query sequence::
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
245 For a SAM file as the following:
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
246
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
247 5 16 2L_79 24393 255 17M * 0 0 CCTTCATCTTTTTTTTT IIIIIIIIIIIIIIIII XA:i:0 MD:Z:17 NM:i:0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
248
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
249 11 0 2R_1 12675 255 21M * 0 0 AAAAAAAACGCGTCCTTGTGC IIIIIIIIIIIIIIIIIIIII XA:i:0 MD:Z:21 NM:i:0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
250
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
251 2 16 2L_5 669 255 23M * 0 0 TGTTGCTGCATTTCTTTTTTTTT IIIIIIIIIIIIIIIIIIIIIII XA:i:0 MD:Z:23 NM:i:0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
252
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
253 produce a plot like this:
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
254
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
255 ----
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
256
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
257 .. image:: static/images/readmap.png
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
258 :height: 800
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
259 :width: 500
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
260
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
261 </help>
1
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
262 <tests>
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
263 <test>
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
264 <param name="genomeSource" value="history" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
265 <param name="ownFile" value ="transposons.fasta" ftype="fasta" />
1
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
266 <param name="series_0|input" value="sample1.srbowtie_out" ftype="tabular"/>
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
267 <param name="series_0|norm" value="1" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
268 <param name="series_1|input" value="sample2.srbowtie_out" ftype="tabular"/>
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
269 <param name="series_1|norm" value="1" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
270 <param name="series_2|input" value="sample3.srbowtie_out" ftype="tabular"/>
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
271 <param name="series_2|norm" value="1" />
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
272 <param name="minquery" value="20" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
273 <param name="maxquery" value="30" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
274 <param name="title" value="Readmaps and size distributions" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
275 <param name="xlabel" value="Coordinates/read size" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
276 <param name="ylabel" value="Number of reads" />
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
277 <param name="rows_per_page" value="8" />
1
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
278 <output name="readmap_dataframe" ftype="tabular" file="Readmap_dataframe.tab" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
279 <output name="size_distribution_dataframe" ftype="tabular" file="Size_distribution_dataframe.tab" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
280 <output name="readmap_PDF" ftype="pdf" file="Readmaps.pdf" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
281 <output name="size_PDF" ftype="pdf" file="Size_distribution.pdf" />
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
282 <output name="combi_PDF" ftype="pdf" file="Size_distribution_and_Readmaps.pdf" />
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
283 </test>
1
eee9701a7491 Uploaded
mvdbeek
parents: 0
diff changeset
284 </tests>
0
9af9983dcd02 Imported from capsule None
drosofff
parents:
diff changeset
285 </tool>