Import data for igraph using R
I want to create igraph through R using my string interaction tsv database files.
Can anyone tell me how to read graph with string interaction tsv files in R.
It will be of much help. Thank you.
• 2,975 views
•
link
0 answers
No answers yet.
Log in to answer this question.
It should be possible, but you need to provide a bit more context. E.g. an example of your input file. TSV file import is directly supported via the R studio user interface. igraph is available as an R-package.
Thanks. To run igraph command of the interaction.tsv file do i need to first convert to .txt files? because the R prog. can read my files but whenever i give read.graph command of the tsv file as such with "ncol" command it results in error:
Until then it works fine. After which when i give the next command i.e
the above mentioned error results.
I am not 100% sure at the moment, but I think read.graph requires a very igraph specific format that is itself only produced by igraph itself. Please give me the first 10 lines of your tsv file and I can fire up R and have look. eg. post the output of head(G) or head string_interactions.tsv in the linux shell.
Provide example input file,
head string_interactions.tsv.If your data is a 3 column ("from, to, weight") delimited file, then try using
igraph::graph_from_data_frame().OK thanks much. I'll try out.
I just started doing some work with
igraphmyself and while I'm not sure if this will directly answer your question I found the following resource to be really helpful:https://kateto.net/networks-r-igraph
Thank you so much.