How to run protein-protein interaction on R using STRING database
1
0
Entering edit mode
4.0 years ago
tpm ▴ 30

Hi,

I would like to know the codes precisely on how I load data with my list of protein targets that I want analysed on the String database. So far I know that I have to run these codes below.

From then on, I do not know how I should:

  1. Load the dataset
  2. Link the dataset on R in order to run it on R

    install.packages("BiocManager")
    install.packages("STRINGdb")
    library("STRINGdb")
    

PS. I am a beginner level in programming.

Thank you in advance, I hope for a favourable response.

stringdb • 7.7k views
ADD COMMENT
1
Entering edit mode

Hi, first of all I'm not an expert at all but I've been working with STRINGdb in R this week and I wanted to contribute to the community.

Firstly, in case you don't know it, you can use the gene symbols you have in your Excel without mapping them to a STRING id, so you can save yourself the mapping part.

You don't say how (in which format) do you want the network, it can be as a PNG image or as a TSV file, for example. If you want an image you can just use the get_png method from STRINGdb package. An easy way to use it in your example would be something like this:

  string_db$get_png(p$gene, file="network.png")

However, I don't know why you put 00 as score_threshold, the medium (and by default) value is 400 and if you to set it lower than that, I suggest a value of 200.

Hope it serves. Regards

ADD REPLY
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

ADD REPLY
0
Entering edit mode

How did you install STRINGdb, a Biooconductor package, using install.packages() instead of BiocManager::install()?

ADD REPLY
0
Entering edit mode

May I kindly RamRS,

From then on, what codes can I use to avoid getting the error below: Error in tempMatr[i, ] : incorrect number of dimensions

The question is on linking the dataset on R to the STRING database.

install.packages("BiocManager")
install.packages("STRINGdb")
library(BiocManager)
library("STRINGdb")
string_db <- STRINGdb$new( version="11", species=469008, score_threshold=00, input_directory="")
library(readxl)
p <- read_excel("1.xlsx")
View(p)
p_mapped <- string_db$map( p, "gene", removeUnmappedRows = TRUE )
**Error in tempMatr[i, ] : incorrect number of dimensions**

Basically the proteins I want to establish a network for are in this sharable link: https://drive.google.com/file/d/1aJisbhWyqUFcx_wIBMxcDtw5fMIE-z5d/view?usp=sharing

I would greatly appreciate the help very much.

ADD REPLY
0
Entering edit mode

I am not sure why, but when you read your data from Excel into R some times you will face difficulty around your data type. Conveting your data to data frame by data.frame function resovled the issue. look at :

   str(p)
    tibble [331 x 3] (S3: tbl_df/tbl/data.frame)
     $ Protein IDs: chr [1:331] "UPI000012B727" "UPI000012A283" "UPI000013B55B" "UPI00000540BA" ...
     $ dprfH-wt   : num [1:331] 5.24 4.64 3.95 3.92 3.79 ...
     $ gene       : chr [1:331] "GLND_ECOLI" "EUTC_ECOLI" "MSCM_ECOLI" "TATA_ECOLI" ...

converting p to pp as a dataframe

pp <- data.frame(p)

str(pp)
'data.frame':   331 obs. of  3 variables:
 $ Protein.IDs: chr  "UPI000012B727" "UPI000012A283" "UPI000013B55B" "UPI00000540BA" ...
 $ dprfH.wt   : num  5.24 4.64 3.95 3.92 3.79 ...
 $ gene       : chr  "GLND_ECOLI" "EUTC_ECOLI" "MSCM_ECOLI" "TATA_ECOLI" ...

Now it works,

string_db <- STRINGdb$new( version="11", species=469008, score_threshold=00, input_directory="")
p_mapped <- string_db$map( pp, "gene", removeUnmappedRows = TRUE )
Warning:  we couldn't map to STRING 100% of your identifiers

It seems your identifires are not in correct format.

ADD REPLY
0
Entering edit mode

Also, make sure you pasted correct codes for package installation. Is it possible to install a Biocondoctor package by install.packages() function?

ADD REPLY
0
Entering edit mode

Its better to check on the website on installations: anyhow if you run this code it will work,

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("STRINGdb")
ADD REPLY

Login before adding your answer.

Traffic: 3111 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6