Skip to content

Commit

Permalink
fix filter tools
Browse files Browse the repository at this point in the history
  • Loading branch information
paulzierep committed Jan 30, 2024
1 parent 2d111d9 commit 95fe234
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/extract_galaxy_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ def format_list_column(col: pd.Series) -> pd.Series:
return col.apply(lambda x: ", ".join(str(i) for i in x))


def export_tools(tools: List[Dict], output_fp: str, format_list_col: bool = False) -> None:
def export_tools(
tools: List[Dict], output_fp: str, format_list_col: bool = False, add_usage_stats: bool = False
) -> None:
"""
Export tool metadata to tsv output file
Expand All @@ -512,7 +514,8 @@ def export_tools(tools: List[Dict], output_fp: str, format_list_col: bool = Fals
df["Galaxy tool ids"] = format_list_column(df["Galaxy tool ids"])
df = add_instances_to_table(df)

df = add_usage_stats_for_all_server(df)
if add_usage_stats:
df = add_usage_stats_for_all_server(df)

df.to_csv(output_fp, sep="\t", index=False)

Expand Down Expand Up @@ -618,7 +621,7 @@ def filter_tools(
f"Error while extracting tools from repo {r}: {e}",
file=sys.stderr,
)
export_tools(tools, args.all_tools, format_list_col=True)
export_tools(tools, args.all_tools, format_list_col=True, add_usage_stats=True)

elif args.command == "filtertools":
tools = pd.read_csv(Path(args.tools), sep="\t", keep_default_na=False).to_dict("records")
Expand Down

0 comments on commit 95fe234

Please sign in to comment.