-
Notifications
You must be signed in to change notification settings - Fork 14
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
ipaPy2 PR #629
Open
acquayefrank
wants to merge
45
commits into
RECETOX:master
Choose a base branch
from
acquayefrank:ipa
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ipaPy2 PR #629
Changes from 44 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a338bbc
started ipapy2 clustering tool
hechth f95e14a
added empty lines
hechth 4982aba
added help text
hechth 8990fcf
added citation
hechth 2e6e58f
added tests
hechth 3c28584
lint
hechth 357a3e5
Update macros.xml
ChangLiuuczlcl8 8286e5a
Add files via upload
ChangLiuuczlcl8 c5a98a0
Update ipapy2_clustering.py
ChangLiuuczlcl8 d9b87e9
Update ipapy2_clustering.xml
ChangLiuuczlcl8 9705593
Add files via upload
ChangLiuuczlcl8 8c5bafd
Add files via upload
ChangLiuuczlcl8 a7f5ff8
Add files via upload
ChangLiuuczlcl8 c217fe1
first
ChangLiuuczlcl8 94af151
Update tools/ipapy2/ipapy2_clustering.xml
hechth 76dc71a
Merge branch 'ipa_stub' of github.com:RECETOX/galaxytools into ipa_stub
hechth 04166cd
changed ionization to select
hechth 651874d
Update tools/ipapy2/ipapy2_MS1_annotation.xml
ChangLiuuczlcl8 5e4d5e9
delete outdated files
ChangLiuuczlcl8 895aee6
add compute bio and gibbs sampler
ChangLiuuczlcl8 a37e307
fix error in macros
ChangLiuuczlcl8 f28a256
Merge pull request #474 from ChangLiuuczlcl8/ipa_stub
hechth f539a24
Merge branch 'master' into ipa_stub
hechth fc7b6e0
Merge branch 'master' into ipa_stub
hechth b088e09
Merge branch 'master' into ipa
3fabee0
fixed 3 tests
acquayefrank cf93eb6
fixed a few more tests
acquayefrank 822ee55
cleaner test data
acquayefrank 67f7cfe
cleaner test data
acquayefrank 2c265d3
Merge branch 'RECETOX:master' into ipa
acquayefrank c8bb50e
working state
acquayefrank 6e41fbf
Merge branch 'ipa' of github.com:acquayefrank/galaxytools into ipa
acquayefrank 5be1b0d
Update tools/ipapy2/.shed.yml
acquayefrank 77a0c8b
made changes based on code review
acquayefrank 4cfdafd
completed ms annotation code cleanup
acquayefrank b3b9e04
finished refactoring
acquayefrank fe475ce
lint
hechth 40f4207
lint and fixed tests
hechth 5411edf
removed not needed code
hechth 0694a63
added min and max values
hechth d806e37
lint
hechth 96b7fb8
Merge branch 'RECETOX:master' into ipa
acquayefrank c978d8b
Update tools/ipapy2/ipapy2_MS1_annotation.xml
acquayefrank fc5625d
added some extra references in the README
acquayefrank a8c80e2
added imporvements from code review
acquayefrank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: ipaPy2 | ||
owner: recetox | ||
remote_repository_url: "https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2" | ||
homepage_url: "https://github.com/francescodc87/ipaPy2" | ||
categories: | ||
- Metabolomics | ||
description: "Mass spectrometry data annotation tool." | ||
long_description: "New Python implementation of the Integrated Probabilistic Annotation (IPA) - A Bayesian annotation method for LC/MS data integrating biochemical relations, isotope patterns and adduct formation." | ||
auto_tool_repositories: | ||
name_template: "{{ tool_id }}" | ||
description_template: "{{ tool_name }} tool from the ipaPy2 package" | ||
suite: | ||
name: suite_ipapy2 | ||
description: tools from the ipaPy2 suite are used for annotation of mass spectrometry data | ||
type: repository_suite_definition |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import argparse | ||
|
||
|
||
from ipaPy2 import ipa | ||
from utils import flattern_annotations, LoadDataAction, StoreOutputAction | ||
|
||
|
||
def main( | ||
input_dataset_database, | ||
input_dataset_adduct, | ||
ppm, | ||
ratiosd, | ||
ppmunk, | ||
ratiounk, | ||
ppmthr, | ||
pRTNone, | ||
pRTout, | ||
output_dataset, | ||
ncores, | ||
): | ||
write_func, file_path = output_dataset | ||
|
||
annotations = ipa.MS1annotation( | ||
input_dataset_database, | ||
input_dataset_adduct, | ||
ppm=ppm, | ||
ratiosd=ratiosd, | ||
ppmunk=ppmunk, | ||
ratiounk=ratiounk, | ||
ppmthr=ppmthr, | ||
pRTNone=pRTNone, | ||
pRTout=pRTout, | ||
ncores=ncores, | ||
) | ||
annotations_flat = flattern_annotations(annotations) | ||
write_func(annotations_flat, file_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
""" | ||
Annotation of the dataset based on the MS1 information. Prior probabilities | ||
are based on mass only, while post probabilities are based on mass, RT, | ||
previous knowledge and isotope patterns. | ||
""" | ||
) | ||
parser.add_argument( | ||
"--input_dataset_database", | ||
nargs=2, | ||
action=LoadDataAction, | ||
required=True, | ||
help="A dataset containing the MS1 data. Ideally obtained from map_isotope_patterns", | ||
) | ||
parser.add_argument( | ||
"--input_dataset_adducts", | ||
nargs=2, | ||
action=LoadDataAction, | ||
required=True, | ||
help="A dataset containing information on all possible adducts.", | ||
) | ||
parser.add_argument( | ||
"--ppm", | ||
type=float, | ||
required=True, | ||
default=100, | ||
help="accuracy of the MS instrument used.", | ||
) | ||
parser.add_argument( | ||
"--ratiosd", | ||
type=float, | ||
default=0.9, | ||
help="acceptable ratio between predicted intensity and observed intensity of isotopes.", | ||
) | ||
parser.add_argument( | ||
"--ppmunk", | ||
type=float, | ||
help="pm associated to the 'unknown' annotation. If not provided equal to ppm.", | ||
) | ||
parser.add_argument( | ||
"--ratiounk", | ||
type=float, | ||
default=0.5, | ||
help="isotope ratio associated to the 'unknown' annotation.", | ||
) | ||
parser.add_argument( | ||
"--ppmthr", | ||
type=float, | ||
help="maximum ppm possible for the annotations. if not provided equal to 2*ppm.", | ||
) | ||
parser.add_argument( | ||
"--pRTNone", | ||
type=float, | ||
default=0.8, | ||
help="multiplicative factor for the RT if no RTrange present in the database.", | ||
) | ||
parser.add_argument( | ||
"--pRTout", | ||
type=float, | ||
default=0.4, | ||
help="multiplicative factor for the RT if measured RT is outside the RTrange present in the database.", | ||
) | ||
parser.add_argument( | ||
"--output_dataset", | ||
nargs=2, | ||
action=StoreOutputAction, | ||
required=True, | ||
help="MS1 annotated data", | ||
) | ||
parser.add_argument( | ||
"--ncores", | ||
type=int, | ||
default=None, | ||
help="number of cores to use for the computation.", | ||
) | ||
args = parser.parse_args() | ||
main( | ||
args.input_dataset_database, | ||
args.input_dataset_adducts, | ||
args.ppm, | ||
args.ratiosd, | ||
args.ppmunk, | ||
args.ratiounk, | ||
args.ppmthr, | ||
args.pRTNone, | ||
args.pRTout, | ||
args.output_dataset, | ||
args.ncores, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<tool id="ipapy2_MS1_annotation" name="IPA MS1 annotation" version="@TOOL_VERSION@+galaxy0" profile="21.09"> | ||
<macros> | ||
<import>macros.xml</import> | ||
</macros> | ||
|
||
<requirements> | ||
<requirement type="package" version="@TOOL_VERSION@">ipapy2</requirement> | ||
<expand macro="extra_requirements"/> | ||
</requirements> | ||
|
||
<command detect_errors="exit_code"><![CDATA[ | ||
#set $computed_ppmthr = float($ppm) * 2 | ||
python3 '${__tool_directory__}/ipapy2_MS1_annotation.py' | ||
--input_dataset_database '${mapped_isotope_patterns}' '${mapped_isotope_patterns.ext}' | ||
--input_dataset_adducts '${all_adducts}' '${all_adducts.ext}' | ||
--ppm ${ppm} | ||
--ratiosd ${ratiosd} | ||
#if $ppmunk | ||
--ppmunk ${ppmunk} | ||
#else | ||
--ppmunk ${ppm} | ||
#end if | ||
--ratiounk ${ratiounk} | ||
#if $ppmthr | ||
--ppmthr ${ppmthr} | ||
#else | ||
--ppmthr ${computed_ppmthr} | ||
#end if | ||
--pRTNone ${pRTNone} | ||
--pRTout ${pRTout} | ||
--output_dataset '${MS1_annotations}' '${MS1_annotations.ext}' | ||
--ncores \${GALAXY_SLOTS:-1} | ||
]]></command> | ||
|
||
<inputs> | ||
<param label="Mapped isotope patterns" name="mapped_isotope_patterns" type="data" format="csv,tsv,tabular,parquet" help="A dataset containing the MS1 data. Ideally obtained from map_isotope_patterns" /> | ||
<param label="all possible adducts" name="all_adducts" type="data" format="csv,tsv,tabular,parquet" help="A dataset containing the information on all the possible adducts given the database. Ideally obtained from compute_all_adducts" /> | ||
<expand macro="ppm"/> | ||
<section name="unknown" title="settings for the identification of unknowns"> | ||
<expand macro="ms_unknown"/> | ||
</section> | ||
<section name="optional_settings" title="optional settings"> | ||
<expand macro="ms_options"/> | ||
</section> | ||
</inputs> | ||
|
||
<outputs> | ||
<data label="${tool.name} on ${on_string}" name="MS1_annotations" format_source="mapped_isotope_patterns"/> | ||
</outputs> | ||
|
||
<tests> | ||
<test> | ||
<param name="mapped_isotope_patterns" value="mapped_isotope_patterns.csv"/> | ||
<param name="all_adducts" value="all_adducts.csv"/> | ||
<param name="ppm" value="3"/> | ||
<output name="MS1_annotations" file="MS1_annotations.csv" lines_diff="20"/> | ||
</test> | ||
</tests> | ||
|
||
<help><![CDATA[ | ||
:: | ||
Annotation of the dataset based on the MS1 information. Prior probabilities | ||
are based on mass only, while post probabilities are based on mass, RT, | ||
previous knowledge and isotope patterns. | ||
|
||
https://github.com/francescodc87/ipaPy2#usage | ||
|
||
https://academic.oup.com/bioinformatics/article/39/7/btad455/7230779 | ||
|
||
]]></help> | ||
|
||
<expand macro="citations"/> | ||
</tool> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the citation annotations for this. Freetext is very unstructured. If you add this to structured elements Galaxy can do some cool stuff with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a citations section in the help text; this was just added to provide more information for users.