# HG changeset patch # User galaxyp # Date 1760718123 0 # Node ID 012191b79fdaf4e445bf96aca9b60fc843c4ae22 # Parent b4f6df8fa89b98f8969320a7260db3f9ed2c25b5 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/fragpipe commit 6413a461059c4a421a7812a08f244c224cde8ee2 diff -r b4f6df8fa89b -r 012191b79fda fragpipe_manifest_generator.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fragpipe_manifest_generator.xml Fri Oct 17 16:22:03 2025 +0000 @@ -0,0 +1,198 @@ + + + Generate a FragPipe Manifest File (Experimental Design File) + + + + macros.xml + msfragger_macros.xml + (DDA|DDA+|DIA|GPF-DIA|DIA-Quant|DIA-Lib) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ^@SCAN_DATA_TYPE_REGEX@(,@SCAN_DATA_TYPE_REGEX)*$ + + + + + + + + python + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Generates a *manifest file* that may be used as input for the FragPipe Galaxy tool, or headless FragPipe_. +This file is analagous to an experimental design file. + +The tool takes as input a collection of scan files, or multiple collections using the *Insert Additional Scan Groups* parameter, and options for assigning experiment numbers, bioreplicates, +and data types for each file. + +Each scan group will have values from three columns applied to it using different methods. + +- Assign consecutive integers: The scans will be number consecutively starting with 1. +- Enter column values: The column values for each scan file are entered as a comma-delimited list in the same order as the files. +- Assign to all scan files: A value supplied by the user is applied to all files. + +.. _FragPipe: https://fragpipe.nesvilab.org/docs/tutorial_headless.html + + + diff -r b4f6df8fa89b -r 012191b79fda generate_manifest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/generate_manifest.py Fri Oct 17 16:22:03 2025 +0000 @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + +# +# Generates a FragPipe Manifest file. +# + +import argparse +import csv + +# The three columns for each scanfile are "Experiment, Bioreplicate, and Data type +column_types = ('exp', 'bio', 'type') +output_filename = 'fp.manifest' + + +# Add column values to a list of rows for each scan file. +def add_column(column_type, args, rows): + nfiles = len(args.scanfiles) + + # Each scan file is numbered 1 through n in column + if getattr(args, f'{column_type}_consec'): + vals = range(1, nfiles + 1) + + # All scan files have same value in column + elif getattr(args, f'{column_type}_assign_all'): + vals = [getattr(args, f'{column_type}_assign_all')] * nfiles + + # Values are provided for scan files in a comma-delimited list + elif getattr(args, f'{column_type}_col'): + vals = getattr(args, f'{column_type}_col').split(',') + if len(vals) != nfiles: + raise ValueError((f'Incorrect number of values entered for column {column_type}. ' + 'Exactly one value must be entered for each scan file.')) + + # Otherwise, this column remains empty. + else: + vals = [''] * nfiles + + for i, row in enumerate(rows): + row.append(vals[i]) + + +def main(): + parser = argparse.ArgumentParser() + + # Each column has the same methods for populating + for column_type in column_types: + parser.add_argument(f'--{column_type}-consec', action='store_true') + parser.add_argument(f'--{column_type}-assign-all') + parser.add_argument(f'--{column_type}-col') + + # Scanfile names, which should be identical to history identifiers + parser.add_argument('scanfiles', nargs='+') + + args = parser.parse_args() + + # Create and populate data structure for tabular output + rows = [[scanfile] for scanfile in args.scanfiles] + for column_type in column_types: + add_column(column_type, args, rows) + + # Write out manifest file. + # Use mode=a as the script will be called once for each scan group. + with open(output_filename, mode='a') as outf: + manifest_writer = csv.writer(outf, delimiter='\t') + for row in rows: + manifest_writer.writerow(row) + + +if __name__ == "__main__": + main() diff -r b4f6df8fa89b -r 012191b79fda test-data/manifest-generator/test1.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/manifest-generator/test1.manifest Fri Oct 17 16:22:03 2025 +0000 @@ -0,0 +1,2 @@ +test1.mzML 1 3 DIA +test2.mzML 2 4 DIA diff -r b4f6df8fa89b -r 012191b79fda test-data/manifest-generator/test2.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/manifest-generator/test2.manifest Fri Oct 17 16:22:03 2025 +0000 @@ -0,0 +1,2 @@ +test1.mzML 1 1 DIA +test2.mzML 2 2 GPF-DIA