This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it possible to select the active interaction source in R STRINGdb package like in the website?

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 answer

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!

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.

Log in to answer this question.