parse and inspect nextflow DSL scripts to pythonic structures and more.
Project description
nf-parser
Parse and inspect Nextflow DSL scripts to extract information from Nextflow workflows, processes, channels, and more.
Features
- DSL Parsing: Parse Nextflow DSL scripts to extract structured information.
- Workflow Analysis: Retrieve details about workflows, processes, channels, and other components.
- Channel Operators: Parse and understand Nextflow channel operators for further analysis.
- DAG Generation: Generate a Directed Acyclic Graph (DAG) of the workflow for visualization and analysis.
- Syntax Validation: Validate Nextflow syntax to catch errors early in the development process.
Installation
pip install nf-parser
Dependecies
- python >=3.9
- lark
Usage
from nf_parser import NextflowParser
# Example usage
script = """
workflow example {
input:
path data
script:
"""
cat ${data} > output.txt
"""
}
"""
# Parse the script
parser = NextflowParser()
parsed_data = parser.parse(script)
# Access parsed information
workflow_name = parsed_data["workflows"][0]["name"]
print(f"Workflow Name: {workflow_name}")
# Generate a DAG
dag = NextflowDAG(parsed_data)
dag.generate_dag()
dag.visualize_dag("workflow_dag.png")
# Validate syntax
is_valid_syntax = parser.validate_syntax(script)
print(f"Is Syntax Valid: {is_valid_syntax}")
Documentation
Detailed documentation, including available methods and data structures, can be found in the documentation.
Testing
pytest
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
Credits
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nf_parser-0.0.1.tar.gz
(8.5 kB
view details)
Built Distribution
File details
Details for the file nf_parser-0.0.1.tar.gz
.
File metadata
- Download URL: nf_parser-0.0.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.0 Linux/6.5.0-15-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bea7879afac47897aee66a9276d3107e032ea5e9c77356cfef33de1d2cc990b |
|
MD5 | 7f9d7bb445eb487b1881f5c1f21f14aa |
|
BLAKE2b-256 | f6be1d1b8acb264b1e84ffbb3b090bee24ba067f549c9dc9e77fedfa251df126 |
File details
Details for the file nf_parser-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: nf_parser-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.0 Linux/6.5.0-15-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc041ae18305531deae32f0ada446f22929dec1349d071556b4d2ee125a2415f |
|
MD5 | 3023cfb47b5ddd71ca881c1372a687d1 |
|
BLAKE2b-256 | ac76313b350a97adddb1d57cc3aa7292412419ab069cea55058fe0ac0954a005 |