Mercurial > repos > goeckslab > bagging_tool
comparison mil_bag.xml @ 0:e6e9ea0703ef draft default tip
planemo upload for repository https://github.com/goeckslab/gleam.git commit 783551569c645073698fce50f1ed9c4605b3e65a
| author | goeckslab |
|---|---|
| date | Thu, 19 Jun 2025 23:31:55 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:e6e9ea0703ef |
|---|---|
| 1 <tool id="bagging_tool" name="Bagging Embeddings Processor" version="1.0.0+0"> | |
| 2 <description>Process CSV files to create bags of embeddings for machine learning</description> | |
| 3 <requirements> | |
| 4 <container type="docker">quay.io/goeckslab/milbag:1.0.0</container> | |
| 5 </requirements> | |
| 6 <stdio> | |
| 7 <exit_code range="137" level="fatal_oom" description="Out of Memory" /> | |
| 8 <exit_code range="1:" level="fatal" description="Error occurred. Please check Tool Standard Error" /> | |
| 9 </stdio> | |
| 10 <command> | |
| 11 python "$__tool_directory__/mil_bag.py" | |
| 12 --embeddings_csv "$embeddings_csv" | |
| 13 --metadata_csv "$metadata_csv" | |
| 14 --split_proportions "$split_proportions" | |
| 15 --bag_size "$bag_size" | |
| 16 --pooling_method "$pooling_method" | |
| 17 --repeats "$repeats" | |
| 18 --output_csv "$output_csv" | |
| 19 #if $dataleak | |
| 20 --dataleak | |
| 21 #end if | |
| 22 #if $balance_enforced | |
| 23 --balance_enforced | |
| 24 #end if | |
| 25 #if $ludwig_format | |
| 26 --ludwig_format | |
| 27 #end if | |
| 28 #if $random_seed != "" | |
| 29 --random_seed "$random_seed" | |
| 30 #end if | |
| 31 #if $imbalance_cap != "" | |
| 32 --imbalance_cap "$imbalance_cap" | |
| 33 #end if | |
| 34 #if $truncate_bags | |
| 35 --truncate_bags | |
| 36 #end if | |
| 37 #if $use_gpu | |
| 38 --use_gpu | |
| 39 #end if | |
| 40 #if $by_sample != "" | |
| 41 --by_sample "$by_sample" | |
| 42 #end if | |
| 43 </command> | |
| 44 <inputs> | |
| 45 <param name="embeddings_csv" type="data" format="csv" label="Embeddings CSV File" help="CSV file containing embeddings with a 'sample_name' column."/> | |
| 46 <param name="metadata_csv" type="data" format="csv" label="Metadata CSV File" help="CSV file with metadata containing 'sample_name' and 'label' columns."/> | |
| 47 <param name="split_proportions" type="text" value="0.7,0.1,0.2" label="Split Proportions (train,val,test)" help="Comma-separated proportions (e.g., '0.7,0.1,0.2') for train, validation, and test splits."/> | |
| 48 <param name="bag_size" type="text" value="3-5" label="Bag Size" help="Single number (e.g., '4') or range (e.g., '3-5') for bag sizes."/> | |
| 49 <param name="pooling_method" type="select" label="Pooling Method" help="Method to aggregate embeddings into bags."> | |
| 50 <option value="max_pooling">Max Pooling</option> | |
| 51 <option value="mean_pooling">Mean Pooling</option> | |
| 52 <option value="sum_pooling">Sum Pooling</option> | |
| 53 <option value="min_pooling">Min Pooling</option> | |
| 54 <option value="median_pooling">Median Pooling</option> | |
| 55 <option value="l2_norm_pooling">L2 Norm Pooling</option> | |
| 56 <option value="geometric_mean_pooling">Geometric Mean Pooling</option> | |
| 57 <option value="first_embedding">First Embedding</option> | |
| 58 <option value="last_embedding">Last Embedding</option> | |
| 59 <option value="attention_pooling">Attention Pooling</option> | |
| 60 </param> | |
| 61 <param name="repeats" type="integer" value="1" min="1" label="Number of Repeats" help="Number of times to repeat the bagging process."/> | |
| 62 <param name="dataleak" type="boolean" truevalue="--dataleak" falsevalue="" checked="false" label="Prevent Data Leakage?" help="If checked, prevents data leakage by splitting on unique sample names."/> | |
| 63 <param name="balance_enforced" type="boolean" truevalue="--balance_enforced" falsevalue="" checked="false" label="Enforce Balanced Bags?" help="If checked, alternates between classes to create balanced bags."/> | |
| 64 <param name="ludwig_format" type="boolean" truevalue="--ludwig_format" falsevalue="" checked="false" label="Ludwig Format?" help="If checked, outputs embeddings as a single string column for Ludwig compatibility."/> | |
| 65 <param name="by_sample" type="text" value="" optional="true" label="Splits for Within-Sample Bagging" help="Optional comma-separated list of splits (0=train, 1=val, 2=test) to bag within samples (e.g., '0,1'). Defaults to random or balanced bagging if empty."/> | |
| 66 <param name="random_seed" type="integer" value="" optional="true" label="Random Seed" help="Optional integer seed for reproducibility (e.g., 42). Leave blank for random behavior."/> | |
| 67 <param name="imbalance_cap" type="integer" value="" optional="true" label="Maximum Imbalance Percentage" help="Optional maximum allowable imbalance percentage between classes (e.g., 50). If set, balances bags to this threshold."/> | |
| 68 <param name="truncate_bags" type="boolean" truevalue="--truncate_bags" falsevalue="" checked="false" label="Truncate Bags for Balance?" help="If checked, truncates bags to ensure equal counts of positive and negative bags."/> | |
| 69 <param name="use_gpu" type="boolean" truevalue="--use_gpu" falsevalue="" checked="false" label="Use GPU?" help="If checked, uses GPU for pooling operations (requires compatible hardware and libraries)."/> | |
| 70 </inputs> | |
| 71 <outputs> | |
| 72 <data name="output_csv" format="csv" label="processed_bags.csv"/> | |
| 73 </outputs> | |
| 74 <tests> | |
| 75 <test> | |
| 76 <param name="embeddings_csv" value="100_digits_embeddings.csv" /> | |
| 77 <param name="metadata_csv" value="100_digits_metadata.csv" /> | |
| 78 <param name="split_proportions" value="0.7,0.2,0.1" /> | |
| 79 <param name="bag_size" value="2" /> | |
| 80 <param name="pooling_method" value="mean_pooling" /> | |
| 81 <param name="repeats" value="1" /> | |
| 82 <param name="dataleak" value="true" /> | |
| 83 <param name="balance_enforced" value="false" /> | |
| 84 <param name="ludwig_format" value="true" /> | |
| 85 <param name="by_sample" value="" /> | |
| 86 <param name="random_seed" value="42" /> | |
| 87 <param name="imbalance_cap" value="" /> | |
| 88 <param name="truncate_bags" value="false" /> | |
| 89 <param name="use_gpu" value="false" /> | |
| 90 <output name="output_csv"> | |
| 91 <assert_contents> | |
| 92 <has_text text="bag_size" /> | |
| 93 <has_n_columns min="1" /> | |
| 94 </assert_contents> | |
| 95 </output> | |
| 96 </test> | |
| 97 <test> | |
| 98 <param name="embeddings_csv" value="100_digits_embeddings.csv" /> | |
| 99 <param name="metadata_csv" value="100_digits_metadata.csv" /> | |
| 100 <param name="split_proportions" value="0.7,0.2,0.1" /> | |
| 101 <param name="bag_size" value="2" /> | |
| 102 <param name="pooling_method" value="mean_pooling" /> | |
| 103 <param name="repeats" value="1" /> | |
| 104 <param name="dataleak" value="true" /> | |
| 105 <param name="balance_enforced" value="false" /> | |
| 106 <param name="ludwig_format" value="true" /> | |
| 107 <param name="by_sample" value="2" /> | |
| 108 <param name="random_seed" value="123" /> | |
| 109 <param name="imbalance_cap" value="50" /> | |
| 110 <param name="truncate_bags" value="true" /> | |
| 111 <param name="use_gpu" value="true" /> | |
| 112 <output name="output_csv"> | |
| 113 <assert_contents> | |
| 114 <has_text text="bag_size" /> | |
| 115 <has_n_columns min="1" /> | |
| 116 </assert_contents> | |
| 117 </output> | |
| 118 </test> | |
| 119 </tests> | |
| 120 <help> | |
| 121 <![CDATA[ | |
| 122 **What it does** | |
| 123 This tool processes embedding and metadata CSV files to create bags of samples with specified sizes and pooling methods, suitable for machine learning tasks. | |
| 124 | |
| 125 **Inputs** | |
| 126 - **Embeddings CSV File**: A CSV file containing embeddings with a `sample_name` column. | |
| 127 - **Metadata CSV File**: A CSV file with metadata containing `sample_name` and `label` columns. | |
| 128 - **Split Proportions**: Define train, validation, and test split ratios (e.g., '0.7,0.1,0.2'). | |
| 129 - **Bag Size**: Set a fixed number (e.g., '4') or range (e.g., '3-5') for bag sizes. | |
| 130 - **Pooling Method**: Choose how embeddings are aggregated into bags (e.g., mean, max). | |
| 131 - **Number of Repeats**: Specify how many times to repeat bagging (useful for augmentation). | |
| 132 - **Prevent Data Leakage**: Avoid leakage by splitting on unique sample names. | |
| 133 - **Enforce Balanced Bags**: Alternate classes for balanced bagging. | |
| 134 - **Ludwig Format**: Convert embeddings to a single string column for Ludwig compatibility. | |
| 135 - **Splits for Within-Sample Bagging**: Optional splits (0, 1, 2) to bag within samples (e.g., '0,1'). | |
| 136 - **Random Seed**: Optional seed for reproducible results. | |
| 137 - **Maximum Imbalance Percentage**: Optional cap (e.g., 50) to balance class distribution. | |
| 138 - **Truncate Bags for Balance**: Truncate bags to equalize positive and negative counts. | |
| 139 - **Use GPU**: Enable GPU acceleration for pooling operations (if available). | |
| 140 | |
| 141 **Outputs** | |
| 142 - A CSV file with bags of embeddings, including labels, split information, and processed embedding vectors. | |
| 143 ]]> | |
| 144 </help> | |
| 145 </tool> |
