diff --git a/.ci/parse_issue_to_yml.py b/.ci/parse_issue_to_yml.py new file mode 100644 index 000000000..131958df8 --- /dev/null +++ b/.ci/parse_issue_to_yml.py @@ -0,0 +1,64 @@ + + +import sys +import subprocess +import yaml + + +def main(argv): + issue_body = argv[0] + url = extract_url(issue_body) + tool = format_to_tool(url) + tool = annotate_section_label(tool) + write_yml(tool) + cleanup() + + +def extract_url(issue_body): + return issue_body.split('URL to the tool in the Galaxy Toolshed repository: ', 1)[1] + + +def format_to_tool(url): + url = url.split('/') + + tool = {} + tool['name'] = url[5] + tool['owner'] = url[4] + tool['revisions'] = url[6] + tool['tool_shed_url'] = url[2] + tool['tool_panel_section_label'] = '' + + return tool + + +def annotate_section_label(tool): + # get galaxy_eu tools. Would be nice to do with bioblend? + subprocess.run(['get-tool-list', '-g', 'https://usegalaxy.eu', '-o', 'eu_tool_list.yaml']) + + with open('eu_tool_list.yaml', 'r') as fp: + galaxy_eu_tools = yaml.safe_load(fp) + + for eu_tool in galaxy_eu_tools['tools']: + if eu_tool['name'] == tool['name'] and eu_tool['owner'] == tool['owner']: + tool['tool_panel_section_label'] = eu_tool['tool_panel_section_label'] + + return tool + + +def write_yml(tool): + with open(f'requests/tool_request_{tool["name"]}.yml', 'w') as fp: + fp.write('tools:\n') + fp.write(f' - name: {tool["name"]}\n') + fp.write(f' owner: {tool["owner"]}\n') + fp.write(f' tool_panel_section_label: {tool["tool_panel_section_label"]}\n') + fp.write(f' tool_shed_url: {tool["tool_shed_url"]}\n') + fp.write(f' revisions:\n') + fp.write(f' - {tool["revisions"]}\n') + + +def cleanup(): + subprocess.run(['rm', 'eu_tool_list.yaml']) + + +if __name__ == '__main__': + main(sys.argv[1:]) \ No newline at end of file diff --git a/.ci/parsing_requirements.txt b/.ci/parsing_requirements.txt new file mode 100644 index 000000000..5956a55ec --- /dev/null +++ b/.ci/parsing_requirements.txt @@ -0,0 +1,2 @@ +pyyaml +ephemeris \ No newline at end of file diff --git a/.ci/requirements.txt b/.ci/requirements.txt index 5c872226c..5d837058e 100644 --- a/.ci/requirements.txt +++ b/.ci/requirements.txt @@ -1,2 +1,3 @@ pyyaml bioblend + \ No newline at end of file diff --git a/.github/workflows/parse_issue_to_tool_request.yml b/.github/workflows/parse_issue_to_tool_request.yml new file mode 100644 index 000000000..86153f7bb --- /dev/null +++ b/.github/workflows/parse_issue_to_tool_request.yml @@ -0,0 +1,47 @@ + +# reads a + +name: parse tool request to yml + +# workflow triggered on new issue +on: + issues: + types: opened + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + parse: + if: contains(github.event.issue.body, '/toolshed.g2.bx.psu.edu') + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # set up python environment + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.6 + + # Install python dependencies for check_files script + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r .ci/parsing_requirements.txt + + # Parse the issue into yml (autoannotate using eu section label) + - name: parse issue to yml + run: python .ci/parse_issue_to_yml.py "$ISSUE_BODY" + env: + ISSUE_BODY: ${{ toJson(github.event.issue.body) }} + + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3.10.0 + + + diff --git a/requests/newtools.yml b/requests/newtools.yml new file mode 100644 index 000000000..57f5001f1 --- /dev/null +++ b/requests/newtools.yml @@ -0,0 +1,55 @@ +tools: + - name: bionano_scaffold + owner: bgruening + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 96cacb31d571 + - name: merqury + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 9d79beb19ac3 + - name: meryl + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 51c2360aa807 + - name: purge_dups + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 76d4cbefff85 + - name: bellerophon + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - eca6296a091a + - name: salsa + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - ba7b0f11e470 + - name: pretext_map + owner: iuc + tool_panel_section_label: Assembly + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 02831bf9e95f + - name: pretext_snapshot + owner: iuc + tool_panel_section_label: Graph/Display Data + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - 7c9417381ad5 + - name: blast2go + owner: peterjc + tool_panel_section_label: Annotation + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - e23b621eb7bb diff --git a/requests/tool_request_blast2go.yml b/requests/tool_request_blast2go.yml new file mode 100644 index 000000000..af09aa965 --- /dev/null +++ b/requests/tool_request_blast2go.yml @@ -0,0 +1,7 @@ +tools: + - name: blast2go + owner: peterjc + tool_panel_section_label: Annotation + tool_shed_url: toolshed.g2.bx.psu.edu + revisions: + - e23b621eb7bb"