Browse code

fix_pathnet

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/branches/RELEASE_3_4/madman/Rpacks/StarBioTrek@125968 bc3139a8-67e5-0310-9ffc-ced21a209358

Claudia Cava authored on 17/01/2017 13:10:51
Showing 3 changed files

... ...
@@ -1,8 +1,8 @@
1 1
 Package: StarBioTrek
2 2
 Type: Package
3 3
 Title: StarBioTrek
4
-Version: 1.0.1
5
-Date: 12-19-2016
4
+Version: 1.0.2
5
+Date: 01-17-2017
6 6
 Author: Claudia Cava,
7 7
     Isabella Castiglioni
8 8
 Maintainer: Claudia Cava <claudia.cava@ibfm.cnr.it>
... ...
@@ -537,3 +537,17 @@ overlap <- function(net_type,x,currentPathway_genes){
537 537
   return(dst)
538 538
 }
539 539
 
540
+overlap_inv <- function(net_type,x,currentPathway_genes){
541
+  de<-net_type[which(net_type$m2_shar_pro==x),]
542
+  fr<-intersect(de$m_shar_pro,currentPathway_genes)
543
+  go=list()
544
+  if(length(fr)!=0)    {
545
+    for (i in 1:length(fr)){
546
+      de2<-de[which(de$m_shar_pro==fr[i]),]
547
+      go[[i]]<-de2
548
+    }
549
+  }            
550
+  dst<-do.call("rbind", go)
551
+  return(dst)
552
+}
553
+
... ...
@@ -8,6 +8,7 @@
8 8
 #' lista_net<-path_net(pathway=path,net_type=netw)
9 9
 path_net<-function(pathway,net_type){
10 10
   lista_int<-list()
11
+  colnames(net_type)<-c("m_shar_pro","m2_shar_pro")
11 12
   for (k in 1:ncol(pathway)){
12 13
     #k=1 
13 14
     print(paste(k,"PATHWAY",colnames(pathway)[k]))
... ...
@@ -27,11 +28,11 @@ path_net<-function(pathway,net_type){
27 28
       v<-do.call("rbind", b)
28 29
       c=list()
29 30
       for (i in 1:length(common2)){
30
-        x<-common1[i]
31
-        n<-overlap(net_type,x,currentPathway_genes)
31
+        x<-common2[i]
32
+        n<-overlap_inv(net_type,x,currentPathway_genes)
32 33
         c[[i]]<-n
33 34
       }
34
-      v2<-do.call("rbind", b)
35
+      v2<-do.call("rbind", c)
35 36
       mago<-rbind(v,v2)
36 37
       mago2<-mago[!duplicated(mago), ]
37 38
     }