Skip to content

Commit ac44b7a

Browse files
committed
Add label
1 parent 27f119f commit ac44b7a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

biotools_cleaner/cleaner_batch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
parser.add_argument('rse_repo', type=str, help="Research-software-ecosystem data folder")
1515
parser.add_argument('--dry-run', action='store_true', help="Dry run")
1616
parser.add_argument('--cleanup', action='store_true', help="Remove old layout files from repository")
17+
parser.add_argument('--add-label', action='store_true', help="Make sure all tools in a specific file have the same biotool label")
18+
1719
args = parser.parse_args()
1820

1921
for path in pathlib.Path(args.rse_repo).rglob("biocontainers.yaml"):
2022
tool = Tool(str(path.resolve()))
21-
tool.write_yaml(args.rse_repo, dry_run=args.dry_run, remove_input=args.cleanup)
23+
tool.write_yaml(args.rse_repo, dry_run=args.dry_run, remove_input=args.cleanup, add_biotool=args.add_label)

biotools_cleaner/tool.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, tool_yaml):
1616

1717
logging.info('Processing ' + tool_yaml)
1818

19-
def write_yaml(self, output_dir, dry_run=False, remove_input=False):
19+
def write_yaml(self, output_dir, dry_run=False, remove_input=False, add_biotool=False):
2020
to_merge = {}
2121
if not self.yaml_data.get('softwares'):
2222
logging.error('"softwares" key not found or empty')
@@ -48,6 +48,9 @@ def write_yaml(self, output_dir, dry_run=False, remove_input=False):
4848
if tool_name in to_merge:
4949
biotool_id = to_merge[tool_name]
5050
logging.warn("Assuming {} biotool id is {}".format(tool_name, biotool_id))
51+
if add_biotool:
52+
logging.warn("Adding biotool label")
53+
values['labels']['extra.identifiers.biotools'] = biotool_id
5154

5255
data[biotool_id].append({"tool": tool_name, "value": values})
5356

0 commit comments

Comments
 (0)