Skip to content
Snippets Groups Projects
Select Git revision
  • be863471fd69055f3d090f18097b352bb81fe5e0
  • main default protected
  • experiment-step-sharing
  • experiment-color-coded-graph
  • experiment-separated-graph
5 results

repo_processing.py

Blame
  • Chiara Liotta's avatar
    Chiara Liotta authored
    be863471
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    repo_processing.py 1.28 KiB
    from neo4j import Driver
    from graph_creation.cwl_parsing import get_cwl_from_repo
    from graph_creation.cwl_processing import process_cwl_expression, process_cwl_inputs, process_cwl_outputs, process_cwl_steps
    from neo4j_queries.edge_queries import simplify_data_and_control_edges
    from neo4j_queries.node_queries import ensure_component_node
    
    def process_repos(repo_list: list[str], driver: Driver) -> None:
        """
        Given a list of paths to local repositories and a Neo4j driver,
        the function parses the CWL files and turns them into a Neo4j dependency graph.
    
        Parameters:
            repo_list (list[str]): a list of paths to local repositories
            driver (Driver): a Neo4j driver
        """
        cwl_entities = {}
        for repo in repo_list:
            # Parse CWL files
            cwl_entities[repo]= get_cwl_from_repo(repo)
            for entity in cwl_entities[repo]:
                component_id = entity['path']
                ensure_component_node(driver, component_id)
                process_cwl_inputs(driver, entity)
                process_cwl_outputs(driver, entity)
                if entity['class'] == 'Workflow':
                    process_cwl_steps(driver, entity)
                # elif entity['class'] == 'ExpressionTool':
                #     process_cwl_expression(driver, entity)
    
        simplify_data_and_control_edges(driver)