You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Weighting method for network edges (default: freq)
164
+
Weighting method for network edge (default: freq)
164
165
--pmid_weight PMID_WEIGHT
165
-
CSV file for the edge weight from a PMID (default: 1)
166
+
CSV file for the weight of the edge from a PMID (default: 1)
166
167
--debug Print debug information
167
-
--community Divide nodes into communities using the Louvain method
168
+
--community Divide nodes into distinct communities by the Louvain method
168
169
--max_edges MAX_EDGES
169
170
Maximum number of edges to display (default: 0, no limit)
170
171
```
171
172
173
+
## Package API
174
+
175
+
In addition to the web interface and CLI, NetMedEx can be used programmatically as a Python library. This allows for more flexible integration into custom pipelines and analysis workflows.
176
+
177
+
Example usage is available in`notebooks/netmedex_usage.ipynb`.
NetMedEx supports Python **3.11** and above. This page demonstrates how to use the library programmatically. The `PubTatorAPI` class retrieves articles from PubTator3, and `PubTatorGraphBuilder` constructs the co-occurrence network.
4
+
5
+
## Retrieve Articles
6
+
7
+
```python
8
+
from netmedex.pubtator import PubTatorAPI
9
+
10
+
collection = PubTatorAPI(
11
+
query='"covid-19" AND "PON1"',
12
+
sort="score",
13
+
max_articles=100,
14
+
).run()
15
+
```
16
+
17
+
## Save and Load Collections
18
+
19
+
```python
20
+
import json
21
+
22
+
# Save to JSON
23
+
withopen("collection.json", "w") as f:
24
+
json.dump(collection.to_json(), f)
25
+
26
+
# Load from JSON
27
+
from netmedex.pubtator_data import PubTatorCollection
0 commit comments