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

Update matchms molecular networking tool #436

Merged
merged 3 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions tools/matchms/matchms_networking.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="matchms_networking" name="matchms networking" version="@TOOL_VERSION@+galaxy0" profile="21.09">
<tool id="matchms_networking" name="matchms networking" version="@TOOL_VERSION@+galaxy1" profile="21.09">
<description>create similarity network graph from matchms similarity scores</description>

<macros>
Expand Down Expand Up @@ -28,7 +28,7 @@
<configfiles>
<configfile name="matchms_networking_cli">
python3 ${__tool_directory__}/matchms_networking_wrapper.py \
--score_name '${score_layer_name}_score' \
--score_name '${score_layer_name}' \
--graph_format '$graph_format' \
--identifier '$identifier_key' \
--top_n '$top_n' \
Expand Down Expand Up @@ -191,6 +191,18 @@
</assert_contents>
</output>
</test>
<test>
<param name="scores" value="networking/test9.json" ftype="json"/>
<param name="graph_format" value="graphml"/>
<param name="identifier_key" value="compound_name"/>
<param name="score_cutoff" value="0.4"/>
<param name="keep_unconnected_nodes" value="false"/>
<output name="similarity_network_file" ftype="graphml">
<assert_contents>
<is_valid_xml />
</assert_contents>
</output>
</test>
</tests>

<help>
Expand Down
5 changes: 4 additions & 1 deletion tools/matchms/matchms_networking_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def main(argv):
score_cutoff=args.score_cutoff,
link_method=args.link_method,
keep_unconnected_nodes=args.keep_unconnected_nodes)
score_name = next((s for s in scores.score_names if args.score_name in s and "score" in s), None)
if score_name is None:
raise ValueError(f"Could not find any score name containing '{args.score_name}'.")

network.create_network(scores, args.score_name)
network.create_network(scores, score_name)
network.export_to_file(filename=args.output_filename, graph_format=args.graph_format)

return 0
Expand Down
Loading