StringDB: Cannot use payload mechanism to colour nodes
1
0
Entering edit mode
Luca • 0
@24072125
Last seen 4 months ago
Germany

Hi all,

I need some help with an analysis I am doing using the package STRINGdb.

In the vignette, the authors talk about the payload mechanism, which should allow you to label the nodes with a coloured halo, when you plot a network of interactions. I tried to replicate the example they provide, and it works fine. However, I cannot find a way of doing the same with my own data.

Please have a look below at the code I am using.


 head(string_df)
   gene            STRING_id log2FoldChange          padj
1 BCL7C 9606.ENSP00000215115     -0.1456586  9.285457e-01
2 BCL7C 9606.ENSP00000459007     -0.1456586  9.285457e-01
3 BCL7C 9606.ENSP00000461177     -0.1456586  9.285457e-01
4 BCL7C 9606.ENSP00000369674     -0.1456586  9.285457e-01
5 TSTD1 9606.ENSP00000388293     -1.0200344  3.510905e-02
6 SYK 9606.ENSP00000364904       -0.4645502  9.611069e-01

string_df <- string_db$map( string_df, "gene", removeUnmappedRows = TRUE )
Error in eval(e, x, parent.frame()) : object 'STRING_id' not found


string_df_padj05 <- string_db$add_diff_exp_color( subset(string_df,padj< 0.05 ), logFcColStr="log2FoldChange" )


payload_id2 <- string_db$post_payload( string_df_padj05$STRING_id,
                                       colors=string_df_padj05$color )


string_db$plot_network(  string_df_padj05$STRING_id, payload_id=payload_id2 )

All commands apparently work, with the exception of string_db$map (no idea what the error means)

string_db$map( string_df, "gene", removeUnmappedRows = TRUE )
Error in eval(e, x, parent.frame()) : object 'STRING_id' not found

The plot I get (unfortunately I cannot share it) does not show any halo. Also, the payload object for my analysis (payload_id_new) seems to be missing something compared to the one generated for the example in the vignette (payload_id_vignette):

payload_id_vignette
[1] "R_JXOFAPSLKYQWX308"
attr(,"Content-Type")
                  charset 
"text/plain"      "utf-8" 

> payload_id_new
[1] ""
attr(,"Content-Type")
                  charset 
"text/plain"      "utf-8"

I am not familiar with this kind of analysis, and any help/suggestion would e really welcome!

Thank you in advance

RNASeqData STRINGdb DifferentialExpression GraphAndNetwork Network • 329 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 14 hours ago
United States

You show that your data.frame has already been mapped:

 head(string_df)
   gene            STRING_id log2FoldChange          padj
1 BCL7C 9606.ENSP00000215115     -0.1456586  9.285457e-01
2 BCL7C 9606.ENSP00000459007     -0.1456586  9.285457e-01
3 BCL7C 9606.ENSP00000461177     -0.1456586  9.285457e-01
4 BCL7C 9606.ENSP00000369674     -0.1456586  9.285457e-01
5 TSTD1 9606.ENSP00000388293     -1.0200344  3.510905e-02
6 SYK 9606.ENSP00000364904       -0.4645502  9.611069e-01

In other words, if your data.frame has a STRING_id column, it's already been mapped!

As for the halos, you have to say which ones you want the halo around, which you apparently have not done, based on your code. Contrast to the code from the vignette:

data(diff_exp_example1)
head(diff_exp_example1)
example1_mapped <- string_db$map( diff_exp_example1, "gene", removeUnmappedRows = TRUE )
options(SweaveHooks=list(fig=function()
par(mar=c(2.1, 0.1, 4.1, 2.1))))
## these are the IDs to have halos!
hits <- example1_mapped$STRING_id[1:200]  
getOption("SweaveHooks")[["fig"]]()
string_db$plot_network( hits )
# filter by p-value and add a color column 
# (i.e. green down-regulated gened and red for up-regulated genes)
example1_mapped_pval05 <- string_db$add_diff_exp_color( subset(example1_mapped, pvalue<0.05), 
                                                            logFcColStr="logFC" )    


# post payload information to the STRING server
payload_id <- string_db$post_payload( example1_mapped_pval05$STRING_id, 
                                        colors=example1_mapped_pval05$color )


getOption("SweaveHooks")[["fig"]]()
# display a STRING network png with the "halo"
string_db$plot_network( hits, payload_id=payload_id ) <-------------- Note that the first argument here is the 'hits' we generated above
0
Entering edit mode

Thanks a lot for your feedback! The STRING_id column was not added with the mapping function, I had generated those IDs myself using Ensembl annotation data. Apparently that was the issue, because after removing the column I could successfully run the mapping command without errors, and get the halo in the figure! There was however a small mistake in the code I shared above. Function string_db$plot_network should be given a list of STRING ids:

string_db$plot_network(  string_df_padj05$STRING_id, payload_id=payload_id2 )

With this correction, the code can be applied to a data frame which does not have a manually generated column STRING_id and everything works fine.

ADD REPLY

Login before adding your answer.

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