Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new tool request yml #574

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
64 changes: 64 additions & 0 deletions .ci/parse_issue_to_yml.py
Original file line number Diff line number Diff line change
@@ -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:])
2 changes: 2 additions & 0 deletions .ci/parsing_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyyaml
ephemeris
1 change: 1 addition & 0 deletions .ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pyyaml
bioblend

47 changes: 47 additions & 0 deletions .github/workflows/parse_issue_to_tool_request.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]



55 changes: 55 additions & 0 deletions requests/newtools.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions requests/tool_request_blast2go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tools:
- name: blast2go
owner: peterjc
tool_panel_section_label: Annotation
tool_shed_url: toolshed.g2.bx.psu.edu
revisions:
- e23b621eb7bb"