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

STRING analysis 2.0.3 - added meaningful error messages #109

Open
wants to merge 1 commit into
base: 4.7.7a
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Do not delete this file!
This file serves to indicate that the workflow was written as part of the usual save routine (not exported).

Workflow was last saved by user knimeuser on Wed Mar 27 08:40:50 CET 2024
Workflow was last saved by user knimeuser on Fri Sep 06 16:40:17 CEST 2024
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<entry key="x-coordinate" type="xint" value="969"/>
<entry key="y-coordinate" type="xint" value="359"/>
<entry key="width" type="xint" value="142"/>
<entry key="height" type="xint" value="34"/>
<entry key="height" type="xint" value="32"/>
<entry key="alignment" type="xstring" value="CENTER"/>
<entry key="borderSize" type="xint" value="0"/>
<entry key="borderColor" type="xint" value="16777215"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<entry key="array-size" type="xint" value="1"/>
<entry key="0" type="xstring" value="Input table containing the column with the protein accessions to be used for the enrichment analysis"/>
</config>
<entry key="sub-node-description" type="xstring" value="Metanode makes api call to String-db.org to get the html link with the enrichment analysis results using provided list of protein accessions.%%00010%%00010So far only the multiple proteins search using he specified column containing the protein accessions is implemented. Protein accessions have to be in supported format (e.g. UniProtKB identified). Multiple protein accessions separated by delimiter (e.g. semicolon) are supported where you can select whether to use just the first protein accession or all of them.%%00010%%00010Metanode generates html link you can paste into your browser and browse the results or you can ask it to open the browser for you with the generated link as well.%%00010%%00010Please note there is limitation in the number of accessions processed on the String-db API. The limit is about 400 proteins. Thus, there is form field where you an limit the number of proteins processed (400 by default). If you will exceed the limit, the enrichment analysis will not be performed and you will get an error message. The enrichment analysis can be done manually by pasting the list of accessions to the String-db website search.%%00010%%00010You can name the enrichment analysis, the name will be used in the resulting table so you can easily combine multiple enrichment analyses into a single table.%%00010%%00010More information on the used API can be found here: https://string-db.org/help/api/#linking-to-the-network-on-string-webpage.%%00010%%00010=================%%00010%%00010Used programs and tools and their respective licenses at the time of the metanode creation. Version numbers and the licenses might differ based on your local installation. Please inspect your local installation and contact us if you can not locate your local version and or license terms.%%00010%%00010KNIME nodes (The KNIME nodes consists of the following GNU GPL 3.0 License. Licence terms are available here: https://www.gnu.org/licenses/gpl.html)%%00010Python 3 (The Python consists of the following Python 3 License. Licence terms are available here: https://docs.python.org/3/license.html)%%00010%%00010String-db API (the String-db API consists of the following Creative Commons Attribution 4.0 International (CC BY 4.0) License. Licence terms are available here: https://creativecommons.org/licenses/by/4.0/%%00010%%00010The metanode was created in KNIME 4.7.7. unning inside the docker image (https://hub.docker.com/r/cfprot/knime/), tag 4.7.7a.%%00010%%00010=================%%00010%%00010This version of metanode is available under the GNU GPL 3.0 License, unless stated otherwise. The full version of the license terms is available at https://www.gnu.org/licenses/gpl.html.%%00010Version: 2.0.2 from 2024-03-27%%00010Contact person: David Potesil ([email protected])%%00010More information can be found at https://github.com/OmicsWorkflows/KNIME_metanodes."/>
<entry key="sub-node-description" type="xstring" value="Metanode makes api call to String-db.org to get the html link with the enrichment analysis results using provided list of protein accessions.%%00010%%00010So far only the multiple proteins search using he specified column containing the protein accessions is implemented. Protein accessions have to be in supported format (e.g. UniProtKB identified). Multiple protein accessions separated by delimiter (e.g. semicolon) are supported where you can select whether to use just the first protein accession or all of them.%%00010%%00010Metanode generates html link you can paste into your browser and browse the results or you can ask it to open the browser for you with the generated link as well.%%00010%%00010Please note there is limitation in the number of accessions processed on the String-db API. The limit is about 400 proteins. Thus, there is form field where you an limit the number of proteins processed (400 by default). If you will exceed the limit, the enrichment analysis will not be performed and you will get an error message. The enrichment analysis can be done manually by pasting the list of accessions to the String-db website search.%%00010%%00010You can name the enrichment analysis, the name will be used in the resulting table so you can easily combine multiple enrichment analyses into a single table.%%00010%%00010More information on the used API can be found here: https://string-db.org/help/api/#linking-to-the-network-on-string-webpage.%%00010%%00010=================%%00010%%00010Used programs and tools and their respective licenses at the time of the metanode creation. Version numbers and the licenses might differ based on your local installation. Please inspect your local installation and contact us if you can not locate your local version and or license terms.%%00010%%00010KNIME nodes (The KNIME nodes consists of the following GNU GPL 3.0 License. Licence terms are available here: https://www.gnu.org/licenses/gpl.html)%%00010Python 3 (The Python consists of the following Python 3 License. Licence terms are available here: https://docs.python.org/3/license.html)%%00010%%00010String-db API (the String-db API consists of the following Creative Commons Attribution 4.0 International (CC BY 4.0) License. Licence terms are available here: https://creativecommons.org/licenses/by/4.0/%%00010%%00010The metanode was created in KNIME 4.7.7. unning inside the docker image (https://hub.docker.com/r/cfprot/knime/), tag 4.7.7a.%%00010%%00010=================%%00010%%00010This version of metanode is available under the GNU GPL 3.0 License, unless stated otherwise. The full version of the license terms is available at https://www.gnu.org/licenses/gpl.html.%%00010Version: 2.0.3 from 2024-09-06%%00010Contact person: David Potesil ([email protected])%%00010More information can be found at https://github.com/OmicsWorkflows/KNIME_metanodes."/>
</config>
<entry key="customDescription" type="xstring" isnull="true" value=""/>
<entry key="state" type="xstring" value="CONFIGURED"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<entry key="memory_policy" type="xstring" value="CacheSmallInMemory"/>
</config>
<config key="model">
<entry key="script" type="xstring" value="# load dataframe, turn factors into strings%%00010df &lt;- knime.in%%00010df &lt;- data.frame(lapply(df, as.character), stringsAsFactors=FALSE)%%00010version &lt;- gsub('.', '-', knime.flow.in[[&quot;version&quot;]], fixed = TRUE)%%00010%%00010# map protein names to STRING identifiers with having separate table with the full map result%%00010map_list &lt;- paste(df[,1], collapse = &quot;%0d&quot;)%%00010map_query &lt;- paste0(&quot;https://version-&quot;, version,&quot;.string-db.org/api/tsv/get_string_ids?identifiers=&quot;, map_list, &quot;&amp;species=&quot;, knime.flow.in[[&quot;organism&quot;]], &quot;&amp;limit=1&quot;, '&amp;caller_identity=&quot;https://github.com/OmicsWorkflows/KNIME_metanodes&quot;')%%00010map &lt;- read.table(file = map_query, header = TRUE, quote = &quot;&quot;, sep = &quot;\t&quot;, fill = TRUE)%%00010map_ids &lt;- as.character(map[,2])%%00010map_ids &lt;- map_ids[map_ids != &quot;&quot;]%%00010%%00010# get a link to the STRING website based on the number of proteins found%%00010if(length(map_ids) == 0){%%00010%%00009output &lt;- &quot;no proteins found; please check other reported tables for more details&quot;%%00010} else if(length(map_ids) == 1){%%00010%%00009output &lt;- &quot;only 1 protein found, will not perform enrichment analysis; please check other reported tables for more details&quot;%%00010} else {%%00010%%00009list &lt;- paste(map_ids, collapse = &quot;%0d&quot;)%%00010%%00009query &lt;- paste0(&quot;https://version-&quot;, version,&quot;.string-db.org/api/tsv/get_link?identifiers=&quot;, list, &quot;&amp;species=&quot;, knime.flow.in[[&quot;organism&quot;]], &quot;&amp;caller_identity='https://github.com/OmicsWorkflows/KNIME_metanodes'&quot;)%%00010%%00009output &lt;- read.table(file = query, header = TRUE)[1,1]%%00010%%00009output &lt;- as.character(output)%%00010%%00009%%00010%%00009# open link?%%00010%%00009if(knime.flow.in[[&quot;open_link&quot;]] == 1){%%00010%%00009browseURL(output)%%00010%%00009}%%00010}%%00010# output dataframe%%00010output_df &lt;- data.frame(Analysis = knime.flow.in[[&quot;analysis_name&quot;]], Link = output)%%00010knime.out &lt;- output_df"/>
<entry key="script" type="xstring" value="library(httr)%%00010%%00010# load dataframe, turn factors into strings%%00010df &lt;- knime.in%%00010df &lt;- data.frame(lapply(df, as.character), stringsAsFactors=FALSE)%%00010version &lt;- gsub('.', '-', knime.flow.in[[&quot;version&quot;]], fixed = TRUE)%%00010%%00010# map protein names to STRING identifiers with having separate table with the full map result%%00010map_list &lt;- paste(df[,1], collapse = &quot;%0d&quot;)%%00010map_query &lt;- paste0(&quot;https://version-&quot;, version,&quot;.string-db.org/api/tsv/get_string_ids?identifiers=&quot;, map_list, &quot;&amp;species=&quot;, knime.flow.in[[&quot;organism&quot;]], &quot;&amp;limit=1&quot;, '&amp;caller_identity=&quot;https://github.com/OmicsWorkflows/KNIME_metanodes&quot;')%%00010test &lt;- GET(map_query)%%00010%%00010if(test$status_code == 200) {%%00010%%00009map &lt;- read.table(file = map_query, header = TRUE, quote = &quot;&quot;, sep = &quot;\t&quot;, fill = TRUE)%%00010%%00009map_ids &lt;- as.character(map[,2])%%00010%%00009map_ids &lt;- map_ids[map_ids != &quot;&quot;]%%00010%%00009%%00010%%00009# get a link to the STRING website based on the number of proteins found%%00010%%00009if(length(map_ids) == 0){%%00010%%00009%%00009output &lt;- &quot;no proteins found; please check other reported tables for more details&quot;%%00010%%00009} else if(length(map_ids) == 1){%%00010%%00009%%00009output &lt;- &quot;only 1 protein found, will not perform enrichment analysis; please check other reported tables for more details&quot;%%00010%%00009} else {%%00010%%00009%%00009list &lt;- paste(map_ids, collapse = &quot;%0d&quot;)%%00010%%00009%%00009query &lt;- paste0(&quot;https://version-&quot;, version,&quot;.string-db.org/api/tsv/get_link?identifiers=&quot;, list, &quot;&amp;species=&quot;, knime.flow.in[[&quot;organism&quot;]], &quot;&amp;caller_identity='https://github.com/OmicsWorkflows/KNIME_metanodes'&quot;)%%00010%%00009%%00009%%00010%%00009%%00009test2 &lt;- GET(query)%%00010%%00009%%00009%%00010%%00009%%00009if(test2$status_code == 200) {%%00010%%00009%%00009%%00009output &lt;- read.table(file = query, header = TRUE)[1,1]%%00010%%00009%%00009%%00009output &lt;- as.character(output)%%00010%%00009%%00009%%00009%%00010%%00009%%00009%%00009# open link?%%00010%%00009%%00009%%00009if(knime.flow.in[[&quot;open_link&quot;]] == 1) browseURL(output)%%00010%%00010%%00009%%00009} else if(test2$status_code == 414) {%%00010%%00009%%00009%%00009stop('URL too long')%%00010%%00009%%00009} else {%%00010%%00009%%00009%%00009stop('Unknown error occurred')%%00010%%00009%%00009}%%00010%%00009}%%00010%%00009# output dataframe%%00010%%00009output_df &lt;- data.frame(Analysis = knime.flow.in[[&quot;analysis_name&quot;]], Link = output)%%00010%%00009knime.out &lt;- output_df%%00010} else {%%00010%%00009response &lt;- content(test, as = &quot;text&quot;, encoding = &quot;UTF-8&quot;)%%00010%%00009if(grepl('unknown organism', response)) {%%00010%%00009%%00009stop(paste0('Organism &quot;', knime.flow.in[[&quot;organism&quot;]], '&quot; not found'))%%00010%%00009} else {%%00010%%00009%%00009stop('Unknown error occurred')%%00010%%00009}%%00010}"/>
<entry key="templateUUID" type="xstring" isnull="true" value=""/>
<entry key="version" type="xstring" value="version 1.x"/>
<entry key="Output non numbers (NaN, Inf, -Inf) as missing cells" type="xboolean" value="false"/>
Expand Down
Loading