Mercurial > repos > iuc > upsetplot
comparison rcx_upsetplot.xml @ 0:ec6141f6e5cb draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/upsetr commit 4454c30bfe5d6ed95871729c68938880a14aa9f2
author | iuc |
---|---|
date | Thu, 15 May 2025 13:34:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ec6141f6e5cb |
---|---|
1 <tool id="rcx_upsetplot" name="upset plot" version="@TOOL_VERSION@+galaxy0" profile="23.0"> | |
2 <description>Upset plot visualization tool using UpSetR</description> | |
3 <macros> | |
4 <token name="@TOOL_VERSION@">1.4.0</token> | |
5 </macros> | |
6 | |
7 <requirements> | |
8 <requirement type="package" version="@TOOL_VERSION@">r-upsetr</requirement> | |
9 <requirement type="package" version="19.0.0">r-arrow</requirement> | |
10 </requirements> | |
11 <required_files> | |
12 <include path="utils.r" /> | |
13 </required_files> | |
14 | |
15 <creator> | |
16 <person | |
17 givenName="Kristina" | |
18 familyName="Gomoryova" | |
19 url="https://github.com/KristinaGomoryova" | |
20 identifier="0000-0003-4407-3917" /> | |
21 <person | |
22 givenName="Helge" | |
23 familyName="Hecht" | |
24 url="https://github.com/hechth" | |
25 identifier="0000-0001-6744-996X" /> | |
26 <organization | |
27 url="https://www.recetox.muni.cz/" | |
28 email="GalaxyToolsDevelopmentandDeployment@space.muni.cz" | |
29 name="RECETOX MUNI" /> | |
30 </creator> | |
31 | |
32 <command detect_errors="exit_code"><![CDATA[ | |
33 Rscript '${run_script}' | |
34 #if $export_R_script | |
35 && cat ${run_script} >> $script | |
36 #end if | |
37 ]]></command> | |
38 | |
39 <configfiles> | |
40 <configfile name="run_script"><![CDATA[ | |
41 | |
42 load_data <- function(file_name, file_extension) { | |
43 if (file_extension == "csv") { | |
44 data_input <- read.csv(file_name, check.names = "false") | |
45 } else if (file_extension %in% c("tsv", "tabular")) { | |
46 data_input <- read.delim(file_name, sep = "\t", check.names = "false") | |
47 } else if (file_extension == "parquet") { | |
48 data_input <- arrow::read_parquet(file_name) | |
49 } else { | |
50 stop("Unsupported file format.") | |
51 } | |
52 return(data_input) | |
53 } | |
54 | |
55 file_name <- "$input_data" | |
56 file_extension <- "$input_data.ext" | |
57 data_input <- load_data(file_name, file_extension) | |
58 | |
59 data_input[data_input != 0] <- 1 | |
60 | |
61 png("upsetplot.png", width = 12, height = 12, units = 'in', res = 600) | |
62 p <- UpSetR::upset( | |
63 data_input, | |
64 #if $order_by == "both" | |
65 order.by = c('freq', 'degree'), | |
66 #else | |
67 order.by = "$order_by", | |
68 #end if | |
69 nsets = $nsets, | |
70 #if $nintersects == 0 | |
71 nintersects = NA, | |
72 #else | |
73 nintersects = $nintersects, | |
74 #end if | |
75 group.by = '$group_by', | |
76 #if $cutoff | |
77 cutoff = $cutoff, | |
78 #end if | |
79 empty.intersections = $empty_intersections | |
80 ) | |
81 print(p) | |
82 dev.off() | |
83 ]]></configfile> | |
84 </configfiles> | |
85 | |
86 <inputs> | |
87 <param name="input_data" type="data" format="csv,tsv,tabular,parquet" label="Input Data Table" help="Input file in a tabular/tsv/csv/parquet format containing the data for the UpSet plot."/> | |
88 <param type="select" name="order_by" label="Sort Bars By" help="Choose how to sort the bars in the UpSet plot: by frequency (largest frequency first), degree (largest overlap first), or both."> | |
89 <option value="freq" selected="true">Frequency</option> | |
90 <option value="degree">Degree</option> | |
91 <option value="both">Both</option> | |
92 </param> | |
93 <param name="nsets" type="integer" min="0" max="100" value="5" label="Number of Sets to Include" | |
94 help="Specify the number of sets to include in the plot. The largest sets will be visualized first. Default is 5." /> | |
95 <param label="Number of Intersections to Plot" optional="true" name="nintersects" type="integer" value="0" help="Specify the number of intersections to display in the plot. If set to 0, all intersections will be plotted."/> | |
96 <param name="group_by" type="boolean" checked="false" truevalue="sets" falsevalue="degree" label="Group Bars by Sets" help="Enable this option to group bars for each set based on their set size. Otherwise, bars will be grouped by degree."/> | |
97 <param name="empty_intersections" type="boolean" checked="false" truevalue="TRUE" falsevalue="NULL" label="Include Empty Intersections" help="Enable this option to include empty intersections in the plot, up to the limit of the number of intersections. By default, empty intersections are omitted."/> | |
98 <param name="cutoff" type="integer" min="0" label="Intersection Size Cutoff" optional="true" | |
99 help="Specify a threshold for filtering intersections. Only intersections with a size greater than or equal to this value will be included in the plot. Leave empty to include all intersections." /> | |
100 <param name="export_R_script" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Export R Script for Reproducibility" help="Enable this option to export the R script used to generate the plot. This allows you to reproduce the analysis offline. Note that file paths and dependencies must be managed manually."/> | |
101 </inputs> | |
102 | |
103 <outputs> | |
104 <data name="upsetplot" format="png" label="Upset plot on ${on_string}" from_work_dir="upsetplot.png"/> | |
105 <data name="script" format="txt" label="R script"> | |
106 <filter>export_R_script</filter> | |
107 </data> | |
108 </outputs> | |
109 | |
110 <tests> | |
111 <test expect_num_outputs="1"> | |
112 <param name="input_data" value="upsetplot_test_data.txt" ftype="tabular"/> | |
113 <param name="order_by" value="freq"/> | |
114 <!-- <output name="upsetplot" ftype="png" file="upsetplot.png"/> --> | |
115 <output name="upsetplot" ftype="png"> | |
116 <assert_contents> | |
117 <has_image_channels channels="1"/> | |
118 <has_image_height height="7200"/> | |
119 <has_image_width width="7200" /> | |
120 <has_image_center_of_mass center_of_mass="3642.53, 3525.80" eps="0.1"/> | |
121 </assert_contents> | |
122 </output> | |
123 </test> | |
124 </tests> | |
125 | |
126 <help><. | |
141 | |
142 Input | |
143 ----- | |
144 | |
145 The tool expects a **dataframe** in one of the following formats: | |
146 - **CSV** | |
147 - **Tabular** | |
148 - **Parquet** | |
149 | |
150 Each column in the input corresponds to a set, and intersections are calculated based on the columns. If the input is not a binary matrix (i.e., values are not 0 or 1), all non-zero values will automatically be converted to 1. | |
151 | |
152 ### Example Input | |
153 | Set1 | Set2 | Set3 | | |
154 | 1 | 0 | 1 | | |
155 | 0 | 1 | 1 | | |
156 | 1 | 1 | 0 | | |
157 | |
158 ### Example Output | |
159 The tool will generate an UpSet plot visualizing the intersections between `Set1`, `Set2`, and `Set3`. | |
160 | |
161 Parameters | |
162 ---------- | |
163 | |
164 The following options allow you to customize the plot: | |
165 | |
166 - **Sort Bars By** (`sort_by`): Determines how the intersection bars are sorted. Options: | |
167 - `freq`: Sort by intersection size (default). | |
168 - `degree`: Sort by the number of sets involved in the intersection. | |
169 | |
170 - **Empty Intersections** (`empty_intersections`): Whether to include intersections with zero elements in the plot. Default is to hide them. | |
171 | |
172 - **Number of Intersections** (`nintersects`): Limits the number of intersections displayed. Default is `0`, which shows all intersections. | |
173 | |
174 - **Group by Sets** (`group_by_sets`): If enabled, intersections are grouped by the original sets. By default, intersections are grouped by the number of sets involved. | |
175 | |
176 Output | |
177 ------ | |
178 | |
179 The tool generates the following outputs: | |
180 1. **UpSet Plot (PNG)**: A high-resolution PNG image of the UpSet plot. | |
181 2. **R Script (Optional)**: The R script used to generate the plot, if the `Export R Script` option is enabled. | |
182 | |
183 Links | |
184 ----- | |
185 | |
186 - **UpSetR Documentation**: [https://github.com/hms-dbmi/UpSetR](https://github.com/hms-dbmi/UpSetR) | |
187 - **Galaxy Tool Repository**: [https://github.com/galaxyproject/tools-iuc](https://github.com/galaxyproject/tools-iuc) | |
188 | |
189 ]]></help> | |
190 <citations> | |
191 <citation type="doi">https://doi.org/10.1093/bioinformatics/btx364</citation> | |
192 </citations> | |
193 </tool> |