gnps-workflow-identifier-retrieval
Summary
Retrieve and validate GNPS molecular networking job archives by task ID, then extract and standardize constituent files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings) for downstream metabolomics data integration. This skill bridges GNPS data repositories (GNPS1 and GNPS2) into NPLinker's local processing pipeline.
When to use
When you have a GNPS molecular networking task ID and need to fetch the job archive, decompose it into standard metabolomics file formats (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings), and prepare them for integration with genomics data. Specifically when the workflow type is one of METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING (GNPS1) or classical_networking_workflow, feature_based_molecular_networking_workflow (GNPS2).
When NOT to use
- GNPS data has already been downloaded and extracted into standardized NPLinker file formats
- You do not have a valid GNPS task ID or the task corresponds to a non-metabolomics GNPS workflow
- The GNPS job was generated by a workflow type not supported by NPLinker (e.g., custom or third-party networking)
Inputs
- GNPS task ID (string)
- local downloads directory path (string)
- target gnps output directory path (string)
Outputs
- spectra.mgf (mass spectrometry spectral data)
- molecular_families.tsv (molecular networking cluster assignments)
- annotations.tsv (chemical annotations)
- file_mappings.tsv or file_mappings.csv (sample-to-spectrum mappings)
How to apply
Initialize a GNPSDownloader with your GNPS task ID and a local downloads directory path, then call download() to fetch the job archive and retrieve its file path. Next, initialize a GNPSExtractor with the downloaded archive path and target gnps directory, then call the extraction method to decompress the archive and identify data files based on the detected GNPS workflow type (METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2). Rename and move extracted files to standardized NPLinker names in the gnps directory. Verify all four required files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) are present, accessible, and correctly named before proceeding to data loading.
Related tools
Examples
from nplinker.gnps import GNPSDownloader, GNPSExtractor; dl = GNPSDownloader('task_001', './downloads'); archive_path = dl.download(); ex = GNPSExtractor(archive_path, './gnps'); ex.extract()
Evaluation signals
- All four required output files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv/.csv) exist in the target gnps directory with correct naming
- spectra.mgf contains valid MGF-format mass spectrometry data with m/z and intensity values
- molecular_families.tsv contains valid TSV entries mapping spectra to GCF (Gene Cluster Family) cluster IDs
- file_mappings.tsv/.csv correctly links sample/file names to spectrum identifiers
- No extraction errors or file corruption detected during decompression and format validation
Limitations
- Only supports GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) data; custom or forked GNPS instances may not be recognized
- Workflow type detection is workflow-name dependent; unsupported workflow types will cause extraction to fail
- Network connectivity required for GNPSDownloader to reach GNPS repository; offline or air-gapped systems cannot retrieve archives
- File naming and structure within GNPS archives may vary across workflow versions, potentially requiring updates to extraction logic
Evidence
- [other] first, GNPSDownloader fetches a GNPS molecular networking job archive and returns its file path; second, GNPSExtractor extracts the archive contents into a designated
gnps directory for subsequent data loading operations: "first, GNPSDownloader fetches a GNPS molecular networking job archive and returns its file path; second, GNPSExtractor extracts the archive contents into a designated gnps directory for subsequent"
- [other] METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2: "METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2"
- [other] Rename and move the extracted files to the standard NPLinker names (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) in the gnps directory: "Rename and move the extracted files to the standard NPLinker names (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) in the gnps directory"
- [other] Verify that all four required files are present and accessible in the gnps directory with correct naming and format: "Verify that all four required files are present and accessible in the gnps directory with correct naming and format"
- [other] currently accepts data from both GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) workflows: "currently accepts data from both GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) workflows"
1---2name: gnps-workflow-identifier-retrieval3description: Use when when you have a GNPS molecular networking task ID and need to fetch the job archive, decompose it into standard metabolomics file formats (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings), and prepare them for integration with genomics data.4license: CC-BY-4.05---67# gnps-workflow-identifier-retrieval89## Summary1011Retrieve and validate GNPS molecular networking job archives by task ID, then extract and standardize constituent files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings) for downstream metabolomics data integration. This skill bridges GNPS data repositories (GNPS1 and GNPS2) into NPLinker's local processing pipeline.1213## When to use1415When you have a GNPS molecular networking task ID and need to fetch the job archive, decompose it into standard metabolomics file formats (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings), and prepare them for integration with genomics data. Specifically when the workflow type is one of METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING (GNPS1) or classical_networking_workflow, feature_based_molecular_networking_workflow (GNPS2).1617## When NOT to use1819- GNPS data has already been downloaded and extracted into standardized NPLinker file formats20- You do not have a valid GNPS task ID or the task corresponds to a non-metabolomics GNPS workflow21- The GNPS job was generated by a workflow type not supported by NPLinker (e.g., custom or third-party networking)2223## Inputs2425- GNPS task ID (string)26- local downloads directory path (string)27- target gnps output directory path (string)2829## Outputs3031- spectra.mgf (mass spectrometry spectral data)32- molecular_families.tsv (molecular networking cluster assignments)33- annotations.tsv (chemical annotations)34- file_mappings.tsv or file_mappings.csv (sample-to-spectrum mappings)3536## How to apply3738Initialize a GNPSDownloader with your GNPS task ID and a local downloads directory path, then call download() to fetch the job archive and retrieve its file path. Next, initialize a GNPSExtractor with the downloaded archive path and target gnps directory, then call the extraction method to decompress the archive and identify data files based on the detected GNPS workflow type (METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2). Rename and move extracted files to standardized NPLinker names in the gnps directory. Verify all four required files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) are present, accessible, and correctly named before proceeding to data loading.3940## Related tools4142- **GNPSDownloader** (Fetches GNPS molecular networking job archive from GNPS repository by task ID and returns local file path) — https://github.com/NPLinker/nplinker43- **GNPSExtractor** (Decompresses GNPS job archive and identifies constituent data files based on workflow type detection) — https://github.com/NPLinker/nplinker44- **nplinker** (Python framework that orchestrates GNPS data retrieval and integration with genomics data) — https://github.com/NPLinker/nplinker4546## Examples4748```49from nplinker.gnps import GNPSDownloader, GNPSExtractor; dl = GNPSDownloader('task_001', './downloads'); archive_path = dl.download(); ex = GNPSExtractor(archive_path, './gnps'); ex.extract()50```5152## Evaluation signals5354- All four required output files (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv/.csv) exist in the target gnps directory with correct naming55- spectra.mgf contains valid MGF-format mass spectrometry data with m/z and intensity values56- molecular_families.tsv contains valid TSV entries mapping spectra to GCF (Gene Cluster Family) cluster IDs57- file_mappings.tsv/.csv correctly links sample/file names to spectrum identifiers58- No extraction errors or file corruption detected during decompression and format validation5960## Limitations6162- Only supports GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) data; custom or forked GNPS instances may not be recognized63- Workflow type detection is workflow-name dependent; unsupported workflow types will cause extraction to fail64- Network connectivity required for GNPSDownloader to reach GNPS repository; offline or air-gapped systems cannot retrieve archives65- File naming and structure within GNPS archives may vary across workflow versions, potentially requiring updates to extraction logic6667## Evidence6869- [other] first, GNPSDownloader fetches a GNPS molecular networking job archive and returns its file path; second, GNPSExtractor extracts the archive contents into a designated `gnps` directory for subsequent data loading operations: "first, GNPSDownloader fetches a GNPS molecular networking job archive and returns its file path; second, GNPSExtractor extracts the archive contents into a designated `gnps` directory for subsequent"70- [other] METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2: "METABOLOMICS-SNETS, METABOLOMICS-SNETS-V2, FEATURE-BASED-MOLECULAR-NETWORKING for GNPS1, or classical_networking_workflow, feature_based_molecular_networking_workflow for GNPS2"71- [other] Rename and move the extracted files to the standard NPLinker names (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) in the gnps directory: "Rename and move the extracted files to the standard NPLinker names (spectra.mgf, molecular_families.tsv, annotations.tsv, file_mappings.tsv or file_mappings.csv) in the gnps directory"72- [other] Verify that all four required files are present and accessible in the gnps directory with correct naming and format: "Verify that all four required files are present and accessible in the gnps directory with correct naming and format"73- [other] currently accepts data from both GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) workflows: "currently accepts data from both GNPS1 (https://gnps.ucsd.edu) and GNPS2 (https://gnps2.org) workflows"