changeset 1:042cab870a39 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ribowaltz commit 416063685092b818a398e00d5027f7fe742230f1
author iuc
date Mon, 23 Oct 2023 12:10:31 +0000
parents 6d4c94373bba
children
files macros.xml ribowaltz.R ribowaltz.xml ribowaltz_plot.R
diffstat 4 files changed, 70 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Thu Sep 22 20:30:54 2022 +0000
+++ b/macros.xml	Mon Oct 23 12:10:31 2023 +0000
@@ -6,6 +6,7 @@
         </requirements>
     </xml>
     <token name="@TOOL_VERSION@">1.2.0</token>
+    <token name="@VERSION_SUFFIX@">0</token>
     <token name="@PROFILE@">21.05</token>
     <xml name="edam_ontology">
         <edam_topics>                                                                                  
--- a/ribowaltz.R	Thu Sep 22 20:30:54 2022 +0000
+++ b/ribowaltz.R	Mon Oct 23 12:10:31 2023 +0000
@@ -21,6 +21,7 @@
   "cds_coverage_info", "Z", 1, "character",
   "psite_info_rdata", "O", 0, "character",
   "refseq_sep", "s", 0, "character",
+  "indel_threshold", "t", 0, "integer",
   "params_duplicate_filterting", "d", 0, "character",
   "params_peridiocity_filterting", "l", 0, "character",
   "params_custom_filterting", "c", 0, "character",
@@ -48,7 +49,7 @@
   sep <- NULL
 }
 # convert alignments in BAM files into list of data tables
-reads_list <- bamtolist(bamfolder = opt$bamdir, annotation = annotation_dt, refseq_sep = sep)
+reads_list <- bamtolist(bamfolder = opt$bamdir, annotation = annotation_dt, refseq_sep = sep, indel_threshold = opt$indel_threshold)
 
 library("jsonlite")
 # remove duplicate reads
@@ -63,21 +64,21 @@
 
 # selection of read lengths - periodicity filtering
 if (!is.null(opt$params_peridiocity_filterting)) {
-    json_peridiocity_filterting <- fromJSON(opt$params_peridiocity_filterting)
-    reads_list <- length_filter(
-      data = reads_list,
-      length_filter_mode = "periodicity",
-      periodicity_threshold = json_peridiocity_filterting$periodicity_threshold
-    )
+  json_peridiocity_filterting <- fromJSON(opt$params_peridiocity_filterting)
+  reads_list <- length_filter(
+    data = reads_list,
+    length_filter_mode = "periodicity",
+    periodicity_threshold = json_peridiocity_filterting$periodicity_threshold
+  )
 }
 # selection of read lengths - length range filtering
 if (!is.null(opt$params_custom_filterting)) {
-    json_custom_filterting <- fromJSON(opt$params_custom_filterting)
-    reads_list <- length_filter(
-      data = reads_list,
-      length_filter_mode = "custom",
-      length_range = json_custom_filterting$length_range
-    )
+  json_custom_filterting <- fromJSON(opt$params_custom_filterting)
+  reads_list <- length_filter(
+    data = reads_list,
+    length_filter_mode = "custom",
+    length_range = json_custom_filterting$length_range
+  )
 }
 
 # compute P-site offset
--- a/ribowaltz.xml	Thu Sep 22 20:30:54 2022 +0000
+++ b/ribowaltz.xml	Mon Oct 23 12:10:31 2023 +0000
@@ -1,16 +1,16 @@
-<tool id="ribowaltz_process" name="riboWaltz" version="@VERSION@" profile="@PROFILE@">
+<tool id="ribowaltz_process" name="riboWaltz" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
     <description>calculation of optimal P-site offsets and diagnostic analysis</description>
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro='requirements'/>
     <expand macro='edam_ontology' />
     <expand macro='xrefs'/>
+    <expand macro='requirements'/>
     <command detect_errors="exit_code"><![CDATA[
         #for $i, $sample in enumerate($rep_samples):
             ln -s $sample.bam_file $sample.sample_name'.bam' &&
         #end for
-        Rscript '${__tool_directory__}/ribowaltz.R' -b . -g '$gtf' --refseq_sep '$refseq_sep'
+        Rscript '${__tool_directory__}/ribowaltz.R' -b . -g '$gtf' --refseq_sep '$refseq_sep' --indel_threshold $indel_threshold
         #import json
         #if $filtering.duplicates.filter == 'yes':
             #set params_duplicate_filterting = []
@@ -59,6 +59,8 @@
         <param name="gtf" type="data" format="gtf,gff" label="Annotation in GTF format"/>
         <param name="refseq_sep" type="text" optional="true" label="Separator between reference sequences' name and additional information to discard"
             help=" All characters before the first occurrence of the specified separator are kept"/>
+        <param name="indel_threshold" type="integer" value="5" min="0"
+                label="Positive integer value specifying the maximum number of indels allowed for each read."/>
         <param name="save_rdata" type="boolean" truevalue="1" falsevalue="0" checked="true"
             label="Save p-site info RDATA file?"
             help="Useful for advanced plotting using riboWaltz-plot tool"/>
@@ -198,6 +200,46 @@
                 </assert_contents>
             </output>
         </test>
+        <test expect_num_outputs="5">
+            <param name="gtf" value="rep1_annot.gtf.gz"/>
+            <param name="refseq_sep" value="."/>
+            <param name="indel_threshold" value="3"/>
+            <param name="save_rdata" value="true"/>
+            <repeat name="rep_samples">
+                <param name="sample_name" value="Replicate1"/>
+                <param name="bam_file" value="rep1.bam"/>
+            </repeat>
+            <section name="filtering"/>
+            <section name="psite_additional">
+                <param name="flanking" value="3"/>
+                <param name="use_start" value="true"/>
+                <param name="psite_extrimity" value="auto"/>
+                <param name="cl" value="99"/>
+            </section>
+            <section name="coverage_additional">
+                <param name="psites_per_region" value="true"/>
+                <param name="min_overlap" value="1"/>
+                <param name="start_nts" value="0"/>
+                <param name="stop_nts" value="0"/>
+            </section>
+            <output name="codon_coverage_out">
+                <assert_contents>
+                    <has_text_matching expression="transcript\tstart\tend\tfrom_cds_start\tfrom_cds_stop\tregion\tReplicate1"/>
+                    <has_text_matching expression="ENSMUST00000000137\t2656\t2659\t865\t471\t3utr\t0"/>
+                </assert_contents>
+            </output>
+            <output name="cds_coverage_out">
+                <assert_contents>
+                    <has_text_matching expression="transcript\tlength_cds\tReplicate1"/>
+                    <has_text_matching expression="ENSMUST00000019109\t741\t5"/>
+                </assert_contents>
+            </output>
+            <output name="psite_rdata_out">
+                <assert_contents>
+                    <has_size value="169141" delta="1000"/>
+                </assert_contents>
+            </output>
+        </test>        
     </tests>
     <help><![CDATA[
 riboWaltz is an R package for calculation of optimal P-site offsets, diagnostic analysis and visual inspection of ribosome profiling data. Taking advantage of a two-step algorithm where offset information is passed through populations of reads with different length in order to maximize offset coherence, riboWaltz computes with high precision the P-site offset. riboWaltz also provides a variety of graphical representations, laying the foundations for further accurate RiboSeq analyses and improved interpretation of positional information. More information can be found here: https://github.com/LabTranslationalArchitectomics/riboWaltz
--- a/ribowaltz_plot.R	Thu Sep 22 20:30:54 2022 +0000
+++ b/ribowaltz_plot.R	Mon Oct 23 12:10:31 2023 +0000
@@ -118,7 +118,7 @@
   print(metaprofile)
   sample_list <- list()
   for (sample_name in names(reads_psite_list)) {
-  sample_list[[sample_name]] <- c(sample_name)
+    sample_list[[sample_name]] <- c(sample_name)
   }
   metaheatmap <- metaheatmap_psite(
     reads_psite_list,
@@ -138,15 +138,15 @@
   pdf("codon_usage.pdf", height = 6, width = 16)
   json_codon_usage_psite <- fromJSON(opt$params_codon_usage_psite)
   for (sample_name in names(reads_psite_list)) {
-  cu_barplot <- codon_usage_psite(
-    reads_psite_list,
-    annotation_dt,
-    sample = sample_name,
-    fastapath = json_codon_usage_psite$fastapath,
-    fasta_genome = FALSE,
-    frequency_normalization = json_codon_usage_psite$frequency
-  )
-  print(cu_barplot[["plot"]])
+    cu_barplot <- codon_usage_psite(
+      reads_psite_list,
+      annotation_dt,
+      sample = sample_name,
+      fastapath = json_codon_usage_psite$fastapath,
+      fasta_genome = FALSE,
+      frequency_normalization = json_codon_usage_psite$frequency
+    )
+    print(cu_barplot[["plot"]])
   }
   dev.off()
 }