Reading a text file in R in KNIME

I have a FASTA database that I am trying to read in to KNIME. So far all of the tools available in KNIME through the community either fail outright or never finish. I’m trying to roll my own solution in R. The problem I can’t seem to figure out though is how to read a text file into an R snippet in KNIME.
I expected the solution might be to go through Load Text Files, which produces four potential strings for the R snippet (knime.in$Location, knime.in$URL, knime.in$Filename, and knime.in$“File contents”). However if I try to use any of those as a file name for “readLines” or “read.fasta” in R, they all return
Error: ‘con’ is not a connection

Hi @lparsons42 -

Sorry for the delayed reply. Have you tried using the readFASTA() function in the protr package? It seems like that might do the trick:

https://cran.r-project.org/web/packages/protr/vignettes/protr.html#read-fasta-format-files

I’d try using that function to read the data, and once you have a dataframe that you wish to use in a KNIME workflow, point that dataframe to knime.out within the R Snippet node.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.