Is it possible to select the active interaction source in R STRINGdb package like in the website?
1
0
Entering edit mode
3.7 years ago
Expe ▴ 10

In the Stringdb website it is possible to select the active interaction sources in settings. Among these options, let's say I am only interested in Experiments and Databases. There I can uncheck the options I don't want. I wonder if this option is available also for R STRINGdb package. The function string_db$get_interactions(exampleproteins) returns a series of columns with the score that each option (Textmining, Experiments...) contributes with, but I can't find how to filter the score by column as in the website. Maybe an option in STRINGdb$new() may give me the desired result? I know about the threshold I can set, but it is not what I mean. Thanks in advance for your help.

stringdb R interaction source • 1.6k views
ADD COMMENT
2
Entering edit mode
2.1 years ago
gabt ▴ 110

Few months passed since the question was asked but maybe it can still help someone!

This is how I did it, since I was not able to find a function that automatically does that, too:

library("STRINGdb")
library("igraph")

#get species ID, for Mus musculus
sID <- get_STRING_species(version="10", species_name=NULL)[grep("musculus", get_STRING_species(version="10", species_name=NULL)$official_name), 1]

#10090 refers to Mus musculus
stringDB <- STRINGdb$new(version="10", species=sID, score_threshold=400, input_directory=getwd())

#originalData contains some gene names
mappedGenes <- stringDB$map(originalData, "geneNames", removeUnmappedRows=F)

#keep only those genes that were actually found
foundGenes <- mappedGenes[!is.na(mappedGenes$STRING_id), ]

#get the network
wholeNet <- stringDB$get_subnetwork(foundGenes$STRING_id)

#those edges that do not meet the requirements will be deleted
deleteThis <-  which(E(wholeNet)$experiments <= 300)

#if there are any edges to delete, do it
if (length(deleteThis) > 0) {
    onlyExp <- delete.edges(wholeNet, deleteThis)
}
else {
    #otherwise keep the network as is
    onlyExp <- wholeNet
}
#of course you can filter accordingly to your needs

#then, in case there are multiple connected components (you never know), or islands as they call it
for (expN in decompose(onlyExp)){
    if (length(E(expN)>0)) {
        plot(expN, vertex.label.color="black", vertex.label.cex=0.9, vertex.label=V(expN)$name,  edge.color="gray28", layout=layout_nicely)
    }
}

hopefully it will work!

ADD COMMENT
0
Entering edit mode

Hi, I would like to know the codes I should run to import an excel sheet with my list of protein targets that I want analysed on the String database using R. 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.

ADD REPLY

Login before adding your answer.

Traffic: 2632 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