Skip to content
Merged
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
7bfa850
Script for query
rdurnik Jan 27, 2026
ca87cb4
Script for abstracts download
rdurnik Jan 27, 2026
1bed026
Query clean up
rdurnik Jan 27, 2026
50f8ced
Script for chemical identification
rdurnik Jan 27, 2026
36ed78e
Script for matching of chemical names to database of relevant chemicals
rdurnik Jan 27, 2026
e5fcdc9
Lint
rdurnik Jan 27, 2026
95044b4
Script to normalize chemical
rdurnik Jan 27, 2026
5759105
Updated matching to take list of chemical names (Excel file)
rdurnik Jan 27, 2026
409c8c9
Script to generate MeSH terms dataframe
rdurnik Jan 27, 2026
f3258e2
Script for find relationships
rdurnik Jan 27, 2026
dffc889
IDs are saved as txt file
rdurnik Jan 27, 2026
4aa629b
Clean up
rdurnik Jan 27, 2026
9204380
Added output dir
rdurnik Jan 28, 2026
12849a8
Abstracts are saved as tsv file
rdurnik Jan 28, 2026
9803780
Script for PDF download
rdurnik Jan 28, 2026
0f55a39
MeSH terms df saved as tsv
rdurnik Jan 28, 2026
2c5ff4a
Lint
rdurnik Jan 28, 2026
e691d6f
Chemical identification saved as file
rdurnik Jan 28, 2026
95c1524
Normalize chemical takes saved output and outputs a file
rdurnik Jan 28, 2026
2e91525
Chemical matching takes file and returns a file
rdurnik Jan 28, 2026
36239be
Find chemicals keeps text
rdurnik Jan 28, 2026
0c93372
Script to parse PDFs
rdurnik Jan 29, 2026
fd189fe
Renamed file
rdurnik Jan 29, 2026
56c0604
Abstract download fixed for Europe PMC
rdurnik Jan 29, 2026
19d6d32
Renamed column names
rdurnik Jan 29, 2026
ace2fe8
Script to find relationships
rdurnik Jan 29, 2026
7e331f2
Initial version chemical identification wrappers
rdurnik Feb 10, 2026
0bfc9c7
Made find chemicals into xml file
rdurnik Feb 25, 2026
b6f33b5
Updated version
rdurnik Feb 25, 2026
75acb8f
Replaced tsv test file with txt
rdurnik Feb 25, 2026
b401fd7
Changed extension
rdurnik Feb 25, 2026
c893ba7
Changed download abstracts into xml
rdurnik Feb 25, 2026
1adeee5
Fixed download abstracts name
rdurnik Mar 5, 2026
2ea1ee4
Fixed description
rdurnik Mar 5, 2026
d72834d
Download abstracts fixes
rdurnik Mar 5, 2026
12f21a3
Download PDF as XML
rdurnik Mar 5, 2026
a63a4a8
Removed print
rdurnik Mar 5, 2026
219fa0c
Updated text data set
rdurnik Mar 5, 2026
722fead
IDs test data set
rdurnik Mar 5, 2026
6e58b46
Find relationships XML
rdurnik Mar 5, 2026
5e09fd9
Removed MeSH term generation
rdurnik Mar 5, 2026
972f9b0
PDF parsing XML
rdurnik Mar 5, 2026
589c8ad
Query literature XML
rdurnik Mar 5, 2026
96c7a70
Changed chemical identification to output one chemical per line
rdurnik Mar 5, 2026
fb0df48
Chemical normalization
rdurnik Mar 5, 2026
67cebd2
Matching chemicals
rdurnik Mar 5, 2026
9d05d10
Description fix
rdurnik Mar 6, 2026
9320772
Needs to be defined before the other imports
rdurnik Mar 6, 2026
d1c3642
Fixed macros
rdurnik Mar 6, 2026
6961497
Renamed normalization to normalization PubChem
rdurnik Mar 6, 2026
43447bd
Changed description
rdurnik Mar 6, 2026
8a8114d
Merge branch 'master' into new_wrappers
hechth Mar 24, 2026
832eb76
removed imports
rdurnik Mar 25, 2026
89d1f73
added pmc
rdurnik Mar 25, 2026
2d2c0df
updated database selection
rdurnik Apr 9, 2026
13a7ee9
updated to get pdf
rdurnik Apr 9, 2026
20c5436
updated database selection
rdurnik Apr 9, 2026
42482c7
added openai key macro
rdurnik Apr 9, 2026
57d83a5
updated to openai_api_key_credentials
rdurnik Apr 9, 2026
fd700d2
updated name
rdurnik Apr 9, 2026
0f37098
wrapper to get full text
rdurnik Apr 9, 2026
01190f0
Name update
rdurnik Apr 10, 2026
8322fcb
added potential llm api key to pdf parsing
rdurnik Apr 10, 2026
ec59595
updated macros for llms
rdurnik Apr 10, 2026
f8c5550
find relationships with llms
rdurnik Apr 10, 2026
50156b6
updated pdf desc
rdurnik Apr 10, 2026
6891035
changed desc to text
rdurnik Apr 20, 2026
0deaeba
llm find chemicals
rdurnik Apr 20, 2026
87aefb8
new test file
rdurnik Apr 20, 2026
54b7e5c
normalization using llms
rdurnik Apr 20, 2026
30c8ba6
clean up, tests fix
rdurnik Apr 20, 2026
8d8e4c0
name change
rdurnik Apr 20, 2026
71e57a8
pdf test data
rdurnik Apr 21, 2026
e89e76f
requirement not supposed to be in inputs
rdurnik Apr 21, 2026
9cde057
pdf input file name change
rdurnik Apr 21, 2026
86dfc8f
file name rename
rdurnik Apr 21, 2026
4b7a32a
test fixes
rdurnik Apr 21, 2026
f07680a
added mesh terms normalization
rdurnik Apr 21, 2026
655f4dc
macros fix
rdurnik Apr 21, 2026
2f91e15
added database selection
rdurnik Apr 21, 2026
9b34f33
reformated tsvs
rdurnik Apr 21, 2026
5dbaf14
fixed the chemical list
rdurnik Apr 21, 2026
49c006f
mesh terms take xml
rdurnik Apr 22, 2026
1660cf9
final output modification
rdurnik Apr 22, 2026
677b1a8
improved descs
rdurnik Apr 22, 2026
cb7bd40
rename
rdurnik Apr 22, 2026
fb3e109
removed leftover inputs
rdurnik Apr 22, 2026
90e2e60
file rename
rdurnik Apr 23, 2026
b7da804
normalization combined into one tool
rdurnik Apr 23, 2026
ed62ee1
combined find chemicals tools
rdurnik Apr 23, 2026
980494e
fixed desc
rdurnik Apr 23, 2026
592230b
renamed
rdurnik Apr 23, 2026
6a6c914
rename
rdurnik Apr 23, 2026
b94902d
combined download
rdurnik Apr 23, 2026
7731496
improved desc
rdurnik Apr 23, 2026
bbf11e8
improved desc
rdurnik Apr 23, 2026
bfc05e4
combined relationships
rdurnik Apr 23, 2026
811ee99
find chemical should store the id of the publication
rdurnik Apr 23, 2026
6ca1750
added effect as macro
rdurnik Apr 23, 2026
910497b
reorder of inputs
rdurnik Apr 23, 2026
fa06fcc
added relationship type and macros modification
rdurnik Apr 23, 2026
f67f704
hardcoded model for scans of pdfs
rdurnik Apr 23, 2026
222e33f
added optional ncbi api key
rdurnik Apr 23, 2026
8aa9ef9
corrected collection output
rdurnik Apr 23, 2026
5c2460f
prompt optional
rdurnik Apr 23, 2026
3450f03
config fix
rdurnik Apr 24, 2026
a46aa1e
config
rdurnik Apr 24, 2026
b595082
reorder
rdurnik Apr 24, 2026
89f6b3a
config issues
rdurnik Apr 24, 2026
4ffa439
llm key put earlier for pdf parsing
rdurnik Apr 27, 2026
278eccf
hardcoded the aoptk version
rdurnik Apr 27, 2026
165597a
specified the version for publication-tracker and chemical-identifier
rdurnik May 4, 2026
4fbcd43
query import fix
rdurnik May 4, 2026
8876eea
new aoptk version in macros
rdurnik May 4, 2026
ff27898
removed macros for databases
rdurnik May 4, 2026
c9560ce
publication-tracker, chemical-identifier removed macros, version spec…
rdurnik May 4, 2026
8e80399
query literature update
rdurnik May 4, 2026
fe5f358
initial version of find chemicals and relationships in one
rdurnik May 5, 2026
f7b7946
reorder
rdurnik May 5, 2026
0637607
deleted find chemicals and find relationships as individual files, co…
rdurnik May 5, 2026
4e3b5bc
pdf needs api key
rdurnik May 5, 2026
13356c2
fixed combined find relationships and find chemicals
rdurnik May 5, 2026
74a818b
fixed download to first select database and then data type
rdurnik May 5, 2026
7259572
removed images for analysis
rdurnik May 5, 2026
49c2c79
updated aoptk version
rdurnik May 5, 2026
96f74d4
added yaml import
rdurnik May 5, 2026
e584370
pmc ids need asyncio
rdurnik May 5, 2026
5ef1cca
pmc does not like empty strings
rdurnik May 5, 2026
e69fc2d
fixed europe pmc name
rdurnik May 5, 2026
5d8d300
fixed config and mesh terms errors
rdurnik May 5, 2026
4d614e3
removed figures from download
rdurnik May 5, 2026
1a01f8d
fixed find relationships for relationships only
rdurnik May 5, 2026
d72d776
added openyxl
rdurnik May 5, 2026
b794208
better output names download
rdurnik May 5, 2026
d182cd4
lint, citation
rdurnik May 5, 2026
74596c0
specified version
rdurnik May 6, 2026
ec8effb
small bugfixes in wrappers
hechth May 7, 2026
b8bff3a
reorder
rdurnik May 7, 2026
bbfd56b
removed dot
rdurnik May 7, 2026
e0f11c9
removed model
rdurnik May 7, 2026
b9cbfca
typo
rdurnik May 7, 2026
6de9050
Fixing test paths
mbodova May 12, 2026
a1f0ea5
query name change
rdurnik May 14, 2026
c857b47
changes to match the latest aoptk version
rdurnik May 14, 2026
329fb94
modified descs
rdurnik May 14, 2026
5214698
modified descs
rdurnik May 14, 2026
a877629
finalize output should work also without having to normalize the outp…
rdurnik May 18, 2026
6b5d774
updated download to match automatic write to file
rdurnik Jun 11, 2026
3612c55
version update
rdurnik Jun 11, 2026
23e00e3
changed to relationship types
rdurnik Jun 11, 2026
e1900b0
changed to multiple effects
rdurnik Jun 11, 2026
a34636e
added new options for pmc and europepmc download
rdurnik Jun 11, 2026
bb4d149
outputs test file update
rdurnik Jun 12, 2026
7f5a8ca
find chemical relationships fix
rdurnik Jun 12, 2026
719a8c7
config error fixes
rdurnik Jun 12, 2026
537c828
updated test output tsv
rdurnik Jun 12, 2026
906256a
finalize output modified for multiple effects
rdurnik Jun 12, 2026
9f7c748
lint
rdurnik Jun 12, 2026
fd5a798
test fixes
rdurnik Jun 15, 2026
f5694c0
linter
rdurnik Jun 15, 2026
bde45d2
fixed forgot to add different databases
rdurnik Jun 15, 2026
3961f58
fixed links not working on CI
rdurnik Jun 15, 2026
cd8e76e
fixed chemical identifier and publication tracker tests
rdurnik Jun 15, 2026
65b2f70
fixed multiple relationship types
rdurnik Jun 16, 2026
8a66ee8
updated test text
rdurnik Jun 16, 2026
b6dd379
updated wrappers and minor fixes
hechth Jun 16, 2026
b34eff4
deleted match chemical lists
rdurnik Jun 16, 2026
b9582e2
find chemicals stores ids
rdurnik Jun 16, 2026
7bac7e6
option to add api keys as credentials
rdurnik Jun 16, 2026
bcb9951
lint: changed variable to secret for endpoint url
rdurnik Jun 16, 2026
4a7161e
Merge branch 'master' into new_wrappers
hechth Jun 17, 2026
d09cafa
Merge branch 'master' into new_wrappers
hechth Jun 17, 2026
0e7f80f
fixed parse pdf test
hechth Jun 18, 2026
03b60cd
fixed tests
hechth Jun 18, 2026
565159c
made it compatible with usegalaxy litellm config
hechth Jun 18, 2026
6da73ff
fixed tests
hechth Jun 18, 2026
192da7c
Merge branch 'master' into new_wrappers
hechth Jun 18, 2026
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
6 changes: 3 additions & 3 deletions tools/aoptk/.shed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ remote_repository_url: "https://github.com/rdurnik/aoptk"
homepage_url: "https://github.com/rdurnik/aoptk"
categories:
- Machine Learning
description: "AOP-toolkit (aoptk) is a Python package designed to support the development of Adverse Outcome Pathways (AOPs) that require extensive data mining."
description: "AOP-toolkit (aoptk) is a Python package designed to support data mining and analysis of toxicological outcomes."
long_description: |
"AOP-toolkit (aoptk) is a Python package developed to support the construction of Adverse Outcome Pathways (AOPs) that require extensive mining and integration of toxicological data from heterogeneous sources. It enables researchers to collect literature from databases such as PubMed and Europe PMC, extract relevant information from full-text publications, and analyze complex, unstructured data using large language models. The toolkit also provides functionality for normalizing chemical names across publications, helping ensure consistency and interoperability."
"AOP-toolkit (aoptk) is a Python package for mining and analyzing toxicological and biomedical literature. Originally developed to support the construction of Adverse Outcome Pathways (AOPs), it provides general-purpose tools for retrieving, processing, and analyzing scientific publications."
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: "{{ tool_name }} tool from the aoptk package"
suite:
name: suite_aoptk
description: AOP-toolkit (aoptk) is a Python package developed to support the construction of Adverse Outcome Pathways (AOPs) that require extensive mining and integration of toxicological data from heterogeneous sources.
description: AOP-toolkit (aoptk) is a Python package for mining and analyzing toxicological and biomedical literature. Originally developed to support the construction of Adverse Outcome Pathways (AOPs), it provides general-purpose tools for retrieving, processing, and analyzing scientific publications.
type: repository_suite_definition
12 changes: 9 additions & 3 deletions tools/aoptk/aoptk_chemical_identifier.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<tool id="aoptk_chemical_identifier" name="aoptk chemical identifier" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="25.1" license="MIT">
<tool id="aoptk_chemical_identifier" name="aoptk chemical identifier" version="0.2.0+galaxy0" profile="25.1" license="MIT">
<description>Detect chemicals in scientific literature and filter based on a screening list.</description>
<macros>
<import>macros.xml</import>
</macros>

<requirements>
<expand macro="requirements"/>
<requirement type="package" version="0.2.0">aoptk</requirement>
<expand macro="email_credentials"/>
</requirements>

<command detect_errors="exit_code"><![CDATA[
Expand All @@ -18,7 +19,11 @@
]]></command>

<inputs>
<expand macro="inputs"/>
<expand macro="query"/>
<param name="literature_database" type="select" label="Select which database to search." help="PubMed only accepts searches with up to 10 000 results. No limit for Europe PMC and PMC.">
<option value="europepmc" selected="true">Europe PMC</option>
<option value="pubmed">PubMed</option>
</param>
<param argument="--chemical_database" type="data" format="xlsx" label="Chemical database" help="Custom chemical database with toxicologically relevant chemicals. Excel file with single column: chemical_name. Examples can be found in Citations." />
</inputs>

Expand Down Expand Up @@ -96,5 +101,6 @@ For the purposes of this publication, Chemical-Identifier was originally develop
<citations>
<citation type="doi">10.18653/v1/w19-5034</citation>
<citation type="doi">10.1093/bioinformatics/btp163</citation>
<citation type="doi">10.5281/zenodo.20036704</citation>
</citations>
</tool>
148 changes: 148 additions & 0 deletions tools/aoptk/aoptk_download_publication_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<tool id="aoptk_download_publication_data" name="aoptk download publication data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="25.1" license="MIT">
<description>Download publication data - full text publications and figures, abstracts, or PDFs.</description>
<macros>
<import>macros.xml</import>
</macros>

<requirements>
<expand macro="requirements"/>
</requirements>

<command detect_errors="exit_code"><![CDATA[
python3 '${download_publication_data}'
]]></command>

<configfiles>
<configfile name="download_publication_data">
import os
from Bio import Entrez

with open("$input_file", "r") as f:
ids = [line.strip() for line in f.readlines()]
email = os.environ.get("EMAIL")
api_key = os.environ.get("NCBI_API_KEY")


#if $literature.database == "pmc":
from aoptk.literature.databases.pmc import PMC
Entrez.email = email
Entrez.api_key = api_key
database = PMC.__new__(PMC)
database.storage = "./"
database.figure_storage = "./figures"
database.id_list = ids

#elif $literature.database == "europepmc":
from aoptk.literature.databases.europepmc import EuropePMC
database = EuropePMC("", storage = "./", figure_storage="./figures")
database.id_list = ids

#elif $literature.database == "pubmed":
from aoptk.literature.databases.pubmed import PubMed
Entrez.email = email
Entrez.api_key = api_key
database = PubMed.__new__(PubMed)
database.id_list = ids

#else:
raise ValueError("Select valid database.")
#end if


#if $literature.type_choice == "publications":
publications = database.get_publications()
for publication in publications:
print(publication.figures)
with open(f"{publication.id}.txt", "w") as f:
f.write(publication.full_text)

#elif $literature.type_choice == "abstracts":
abstracts = database.get_abstracts()
for abstract in abstracts:
with open(f"{abstract.id}.txt", "w") as f:
f.write(abstract.text)

#elif $literature.type_choice == "pdfs":
pdfs = database.get_pdfs()

#else:
raise ValueError("Select valid data type.")
#end if


</configfile>
</configfiles>

<inputs>
<param name="input_file" type="data" format="txt" label="List of IDs to search for." help="Input text file with IDs to search for." />
<conditional name="literature">
<param name="database" type="select" label="Select which database to search." help="PubMed only accepts searches with up to 10 000 results. No limit for Europe PMC and PMC.">
<option value="pmc" selected="true">PMC</option>
<option value="pubmed">PubMed</option>
<option value="europepmc">Europe PMC</option>
</param>
<when value="pubmed">
<param name="type_choice" type="select" label="Data type">
<option value="abstracts">Abstracts</option>
</param>
</when>
<when value="europepmc">
<param name="type_choice" type="select" label="Data type">
<option value="publications">Full text publications</option>
<option value="abstracts">Abstracts</option>
</param>
</when>
<when value="pmc">
<param name="type_choice" type="select" label="Data type">
<option value="publications">Full text publications</option>
<option value="pdfs">PDFs</option>
</param>
</when>
</conditional>
</inputs>

<outputs>
<collection name="text" type="list" label="Downloaded ${database} ${type_choice}" format="txt">
<filter>literature['type_choice'] == 'publications' or literature['type_choice'] == 'abstracts'</filter>
<discover_datasets pattern="(?P&lt;designation&gt;.*)\.txt$" ext="txt" />
</collection>
<collection name="pdfs" type="list" label="Downloaded ${database} PDFs" format="pdf">
<filter>literature['type_choice'] == 'pdfs'</filter>
<discover_datasets pattern="(?P&lt;designation&gt;.*)\.pdf$" ext="pdf" />
</collection>
</outputs>

<tests>
<test expect_num_outputs="1">
<param name="literature|database" value="pmc"/>
<param name="literature|type_choice" value="publications"/>
<param name="input_file" value="test-data/ids.txt"/>
<output_collection name="text" type="list" count="2"/>
</test>
<test expect_num_outputs="1">
<param name="literature|database" value="europepmc"/>
<param name="literature|type_choice" value="abstracts"/>
<param name="input_file" value="test-data/ids.txt"/>
<output_collection name="text" type="list" count="2"/>
</test>
<test expect_num_outputs="1">
<param name="literature|database" value="pmc"/>
<param name="literature|type_choice" value="pdfs"/>
<param name="input_file" value="test-data/ids.txt"/>
<output_collection name="pdfs" type="list" count="2"/>
</test>
</tests>

<help><![CDATA[
Download Publication Data
=========================

Tools to download publication data - full text publications (including abstracts) and figures, abstracts, or PDFs.

]]></help>

<citations>
<citation type="doi">10.5281/zenodo.20036704</citation>
</citations>

</tool>
74 changes: 74 additions & 0 deletions tools/aoptk/aoptk_finalize_output.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<tool id="aoptk_final_modification" name="aoptk final modification" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="25.1" license="MIT">
<description>Finalize the output of relationship identification.</description>
<macros>
<import>macros.xml</import>
</macros>

<requirements>
<expand macro="requirements"/>
<requirement type="package" version="3.1.5">openpyxl</requirement>
</requirements>

<command detect_errors="exit_code"><![CDATA[
python3 '${final_modification}'
]]></command>

<configfiles>
<configfile name="final_modification">
import pandas as pd

def join_unique(series):
values = series.dropna().astype(str).str.strip()
return ";".join(pd.unique(values))

output = pd.read_csv("$input_file", sep="\t")

file_name = output["effect"].unique()[0].strip().lower().replace(" ", "_")

output["relationship"] = output["relationship"].astype(str).str.strip().str.lower()
relationships = sorted(output["relationship"].unique())
final_output = output[["heading"]].drop_duplicates()

for relationship in relationships:
subset = output[output["relationship"] == relationship]
result = subset.groupby("heading", as_index=False, dropna=False).agg(
hits=("id", "size"),
ids=("id", join_unique),
)
result.rename(columns={"hits": f"{relationship}", "ids": f"{relationship} IDs"}, inplace=True)
final_output = final_output.merge(result, on="heading", how="left")

final_output.to_excel("./final_output.xlsx", index=False)


</configfile>
</configfiles>

<inputs>
<param name="input_file" type="data" format="tabular" label="TSV with heading column." help="Input tsv file with chemical column." />
</inputs>

<outputs>
<data name="final_output" format="xlsx" from_work_dir="final_output.xlsx" label="Final output." />
</outputs>

<tests>
<test>
<param name="input_file" value="test-data/chemicals.tsv"/>
<output name="final_output" file="test-data/final_output.xlsx" compare="sim_size" delta="100"/>
</test>
</tests>

<help><![CDATA[
Final Modification
===================

Tool to remove duplicates and finalize the output of relationship identification.

]]></help>

<citations>
<citation type="doi">10.5281/zenodo.20036704</citation>
</citations>

</tool>
Loading
Loading