changeset 11:7995a949189f draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mutational_patterns commit 94919d0f442fe7059afa2e07898c149b126a5460"
author artbio
date Thu, 22 Oct 2020 00:18:38 +0000
parents 59c0e2a7965c
children 7954f0d3517f
files mutational_patterns.R mutational_patterns.xml test-data/sig_contrib_table.tsv
diffstat 3 files changed, 37 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mutational_patterns.R	Mon Oct 19 23:34:58 2020 +0000
+++ b/mutational_patterns.R	Thu Oct 22 00:18:38 2020 +0000
@@ -85,6 +85,12 @@
     help = "path to output dataset"
   ),
   make_option(
+    "--sig_contrib_matrix",
+    default = NA,
+    type = 'character',
+    help = "path to signature contribution matrix"
+  ),
+  make_option(
     c("-r", "--rdata"),
     type="character",
     default=NULL,
@@ -343,6 +349,14 @@
         grid.arrange(p8)
     }
     
+    # export relative contribution matrix
+    if (!is.na(opt$sig_contrib_matrix)) {
+        output_table <- t(fit_res$contribution)/rowSums(t(fit_res$contribution))
+        colnames(output_table) <- paste0("s", colnames(output_table))
+        output_table <- data.frame(sample=rownames(output_table), output_table)
+        write.table(output_table, file = opt$sig_contrib_matrix, sep = "\t", quote = F, row.names = F)
+    }
+
     # calculate all pairwise cosine similarities
     cos_sim_ori_rec <- cos_sim_matrix(pseudo_mut_mat, fit_res$reconstructed)
     # extract cosine similarities per sample between original and reconstructed
--- a/mutational_patterns.xml	Mon Oct 19 23:34:58 2020 +0000
+++ b/mutational_patterns.xml	Thu Oct 22 00:18:38 2020 +0000
@@ -1,4 +1,4 @@
-<tool id="mutational_patterns" name="Analyse Mutational Patterns/Signatures" version="2.0.0+galaxy11">
+<tool id="mutational_patterns" name="Analyse Mutational Patterns/Signatures" version="2.0.0+galaxy12">
     <description>from genomic variations in vcf files</description>
     <requirements>
         <requirement type="package" version="2.0.0=r40_0">bioconductor-mutationalpatterns</requirement>
@@ -47,9 +47,12 @@
     #end if
 
     #if $set_cosmic.choices == 'yes':
-        --cosmic_version $set_cosmic.cosmic_version
+        --cosmic_version '$set_cosmic.cosmic_version'
         --signum '$set_cosmic.signum'
         --output_cosmic $cosmic
+        #if $set_cosmic.contrib_matrix_out
+            --sig_contrib_matrix $sig_contrib_matrix
+        #end if
     #end if
             
     #if $rdata_out
@@ -129,6 +132,8 @@
                     <option value="v2" selected="true">Cosmic v2, March 2015</option>
                     <option value="v3">Cosmic v3, May 2019</option>
                 </param>
+                <param name="contrib_matrix_out" type="boolean" checked="false" label="Output Signature Contribution table ?"
+                       help="Output the normalized signatures contributions for further visualization" />
             </when>
              <when value="no" />
         </conditional>
@@ -147,6 +152,10 @@
         <data name="cosmic" format="pdf" label="Cosmic signatures">
             <filter>set_cosmic['choices'] == "yes"</filter>
         </data>
+        <data name="sig_contrib_matrix" format="tabular" label="${tool.name}: Signature contribution table">
+            <filter>set_cosmic['contrib_matrix_out']</filter>
+        </data>
+
         <data name="rdata" format="rdata" label="${tool.name}: RData file">
             <filter>rdata_out</filter>
         </data>
@@ -175,7 +184,7 @@
             <conditional name="set_cosmic">
                 <param name="choices" value="no"/>
             </conditional>
-            <output name="spectrum" file="spectrum_output1.pdf" compare="sim_size" ftype="pdf"/>
+            <output name="spectrum" file="spectrum_output1.pdf" compare="sim_size"/>
         </test>
 
          <!-- de novo signatures -->
@@ -202,8 +211,8 @@
             <param name="rank" value="4" />
             <param name="newsignum" value="4" />
             <param name="rdata_out" value="true" />
-            <output name="denovo" file="denovo_output1.pdf" compare="sim_size" ftype="pdf"/>
-            <output name="sigmatrix" file="sigmatrix.tab" ftype="tabular" compare="sim_size"/>
+            <output name="denovo" file="denovo_output1.pdf" compare="sim_size"/>
+            <output name="sigmatrix" file="sigmatrix.tab" compare="sim_size"/>
             <output name="rdata" file="denovo_1.RData" compare="sim_size" delta="400000"/> <!--  delta="170000" -->
         </test>
 
@@ -227,9 +236,11 @@
             </conditional>
             <conditional name="set_cosmic">
                 <param name="choices" value="yes"/>
+                <param name="contrib_matrix_out"  value="true" />
             </conditional>
             <param name="signum" value="3" />
-            <output name="cosmic" file="cosmic_output1.pdf" compare="sim_size" ftype="pdf"/>
+            <output name="cosmic" file="cosmic_output1.pdf" compare="sim_size"/>
+            <output name="sig_contrib_matrix" file="sig_contrib_table.tsv" compare="sim_size"/>
         </test>
         <!-- cosmic signature on single sample -->
         <test>
@@ -249,7 +260,7 @@
                 <param name="choices" value="yes"/>
             </conditional>
             <param name="signum" value="5" />
-            <output name="cosmic" file="cosmic_output2.pdf" compare="sim_size" delta="50000" ftype="pdf"/>
+            <output name="cosmic" file="cosmic_output2.pdf" compare="sim_size" delta="50000"/>
         </test>
     </tests>
     <help>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sig_contrib_table.tsv	Thu Oct 22 00:18:38 2020 +0000
@@ -0,0 +1,5 @@
+sample	s1	s2	s3	s4	s5	s6	s7	s8	s9	s10	s11	s12	s13	s14	s15	s16	s17	s18	s19	s20	s21	s22	s23	s24	s25	s26	s27	s28	s29	s30
+I.vcf	0.110142906240717	0.0107179228940658	0.250337884546217	0	0.123574305205091	0.00064433123164414	0	0.132427942951795	0.0645286099734586	0	0.0449394465051191	0.0482562813691387	0.0021792135773442	0	0.0208527968750023	0.113202769843279	0	0	0	0	0	0	0	0	0.0534957402074307	0	0	0.0246998485796975	0	0
+H.vcf	0.105077406305297	0.0161426031811577	0.213744671485429	0	0.267847442499011	0	0	0.0744758833337775	0.0589788373729043	0	0.0260566297995198	0.00332317088253305	0.0101947253359771	0	0	0.165596602885273	0	0	0	0	0	0	0	0	0.0157724425494898	0	0.0064649564106814	0.0363246279589487	0	0
+G.vcf	0.211033078587086	0.0166966912787851	0.172186940126079	0	0.286633042356631	0	0	0.00842344130070046	0.11400762247453	0	0.0288922172140213	0.0327352792025852	0	0	0	0.034128625357202	0	0	0.0288565039877324	0	0	0	0	0	0.0631355806535697	0	0.000844012191577089	0.00242696526950036	0	0
+F.vcf	0.275881644071761	0.00660164806875313	0.17426347088712	0	0.102714094410494	0	0	0.0917555941611345	0.0202950075653247	0	0.0296908924905143	0.0090315352239272	0	0	0	0.188940992761965	0	0	0	0	0	0	0	0	0.0273695319074987	0	0.00555599996394483	0.0404508145574958	0	0.0274487739300663