Open lipikakalson opened 2 years ago
Hi Lipika,
this information is not stored to avoid blowing up the size of the resulting data frame. However, you can retrieve this information by joining the results of the sponge method with the data frame that keeps track which miRNA-gene associations are considered. Here is a rough example showing how this can be done (code not tested, no guarantees here).
annotate_miRNAs <- function(sponge_interactions, miRNAs_significance) {
foreach(interactions =
itertools::isplitRows(sponge_interactions,
chunks = 120),
.combine = rbind, .packages = c("foreach", "iterators", "SPONGE"),
.export = c("miRNAs_significance")) %dopar%
{
foreach(interaction = iter(interactions, by="row"),
.combine=rbind) %do%
{
geneA <- as.character(interaction$geneA)
geneB <- as.character(interaction$geneB)
mirA_selected <- as.character(miRNAs_significance[[geneA]]$mir)
mirB_selected <- as.character(miRNAs_significance[[geneB]]$mir)
shared_mirs <- intersect(mirA_selected, mirB_selected)
if(length(shared_mirs) == 0) stop("gene pair does not share miRNAs")
return(data.frame(geneA = geneA,
geneB = geneB,
miRNA = shared_mir,
total_number_miRNAs = length(shared_mirs),
check.rows = FALSE, check.names = FALSE,
stringsAsFactors = FALSE, row.names = NULL))
}
}
}
While using the sponge function, result is a data table with both genes (A and B), the number of miRNAs (), gene-gene correlation (), partial correlation given all miRNAs () and the values, i.e. mscor=cor−pcor. I want the name of these shared miRNAs whose number is listed in column 3. Can anybody help me with this? Or if in anyway i could get all the three nodes by using some other function?
Hoping for earliest response. Thanking you in advance.
Best Lipika