git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/branches/RELEASE_3_4/madman/Rpacks/StarBioTrek@126629 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
Package: StarBioTrek |
2 | 2 |
Type: Package |
3 | 3 |
Title: StarBioTrek |
4 |
-Version: 1.0.2 |
|
5 |
-Date: 01-17-2017 |
|
4 |
+Version: 1.0.3 |
|
5 |
+Date: 02-09-2017 |
|
6 | 6 |
Author: Claudia Cava, |
7 | 7 |
Isabella Castiglioni |
8 | 8 |
Maintainer: Claudia Cava <claudia.cava@ibfm.cnr.it> |
... | ... |
@@ -15,7 +15,8 @@ Imports: |
15 | 15 |
AnnotationDbi, |
16 | 16 |
e1071, |
17 | 17 |
ROCR, |
18 |
- grDevices |
|
18 |
+ grDevices, |
|
19 |
+ igraph |
|
19 | 20 |
Description: This tool StarBioTrek presents some methodologies to measure pathway activity and cross-talk among pathways integrating also the information of network data. |
20 | 21 |
License: GPL (>= 3) |
21 | 22 |
biocViews: GeneRegulation, |
... | ... |
@@ -27,4 +27,7 @@ importFrom(SpidermiR,SpidermiRquery_species) |
27 | 27 |
importFrom(e1071,svm) |
28 | 28 |
importFrom(e1071,tune) |
29 | 29 |
importFrom(grDevices,rainbow) |
30 |
+importFrom(igraph,get.data.frame) |
|
31 |
+importFrom(igraph,graph.data.frame) |
|
32 |
+importFrom(igraph,induced.subgraph) |
|
30 | 33 |
importFrom(org.Hs.eg.db,org.Hs.egSYMBOL2EG) |
... | ... |
@@ -522,32 +522,3 @@ list_pathkegg<-list(pathway.codes,b) |
522 | 522 |
return(list_pathkegg) |
523 | 523 |
} |
524 | 524 |
|
525 |
- |
|
526 |
-overlap <- function(net_type,x,currentPathway_genes){ |
|
527 |
- de<-net_type[which(net_type$m_shar_pro==x),] |
|
528 |
- fr<-intersect(de$m2_shar_pro,currentPathway_genes) |
|
529 |
- go=list() |
|
530 |
- if(length(fr)!=0) { |
|
531 |
- for (i in 1:length(fr)){ |
|
532 |
- de2<-de[which(de$m2_shar_pro==fr[i]),] |
|
533 |
- go[[i]]<-de2 |
|
534 |
- } |
|
535 |
- } |
|
536 |
- dst<-do.call("rbind", go) |
|
537 |
- return(dst) |
|
538 |
-} |
|
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 |
- |
... | ... |
@@ -1,54 +1,37 @@ |
1 | 1 |
#' @title Get human KEGG pathway data and network data in order to define the common gene. |
2 | 2 |
#' @description path_net creates a list of network data for each human pathway. The network data will be generated when interacting genes belong to that pathway. |
3 |
-#' @param net_type network data as provided by getNETdata |
|
3 |
+#' @param data network data as provided by getNETdata |
|
4 | 4 |
#' @param pathway pathway data as provided by getKEGGdata |
5 |
+#' @importFrom igraph graph.data.frame induced.subgraph get.data.frame |
|
5 | 6 |
#' @export |
6 | 7 |
#' @return a list of network data for each pathway (interacting genes belong to that pathway) |
7 | 8 |
#' @examples |
8 |
-#' lista_net<-path_net(pathway=path,net_type=netw) |
|
9 |
-path_net<-function(pathway,net_type){ |
|
9 |
+#' lista_net<-path_net(pathway=path,data=netw) |
|
10 |
+path_net<-function(pathway,data){ |
|
10 | 11 |
lista_int<-list() |
11 |
- colnames(net_type)<-c("m_shar_pro","m2_shar_pro") |
|
12 | 12 |
for (k in 1:ncol(pathway)){ |
13 |
- #k=1 |
|
14 |
- print(paste(k,"PATHWAY",colnames(pathway)[k])) |
|
13 |
+ print(colnames(pathway)[k]) |
|
15 | 14 |
currentPathway_genes<-pathway[,k] |
16 |
- common1 <- intersect( net_type$m_shar_pro, currentPathway_genes) |
|
17 |
- common2 <- intersect( net_type$m2_shar_pro, currentPathway_genes) |
|
18 |
- if (length(common1)==0 & length(common2)==0 ){ |
|
19 |
- mago2<-character(length = 0) |
|
20 |
- } |
|
21 |
- if (length(common1)!=0 | length(common2)!=0 ){ |
|
22 |
- b=list() |
|
23 |
- for (i in 1:length(common1)){ |
|
24 |
- x<-common1[i] |
|
25 |
- n<-overlap(net_type,x,currentPathway_genes) |
|
26 |
- b[[i]]<-n |
|
27 |
- } |
|
28 |
- v<-do.call("rbind", b) |
|
29 |
- c=list() |
|
30 |
- for (i in 1:length(common2)){ |
|
31 |
- x<-common2[i] |
|
32 |
- n<-overlap_inv(net_type,x,currentPathway_genes) |
|
33 |
- c[[i]]<-n |
|
34 |
- } |
|
35 |
- v2<-do.call("rbind", c) |
|
36 |
- mago<-rbind(v,v2) |
|
37 |
- mago2<-mago[!duplicated(mago), ] |
|
38 |
- } |
|
39 |
- |
|
40 |
- if (length(mago2)!=0){ |
|
41 |
- lista_int[[k]]<-mago2 |
|
42 |
- } |
|
43 |
- if (length(mago2)==0){ |
|
44 |
- lista_int[[k]]<-"0"} |
|
45 |
- |
|
15 |
+ colnames(data) <- c("gene_symbolA", "gene_symbolB") |
|
16 |
+ i <- sapply(data, is.factor) |
|
17 |
+ data[i] <- lapply(data[i], as.character) |
|
18 |
+ ver<-unlist(data) |
|
19 |
+ n<-unique(ver) |
|
20 |
+ s<-intersect(n,currentPathway_genes) |
|
21 |
+ g <- graph.data.frame(data,directed=FALSE) |
|
22 |
+ g2 <- induced.subgraph(graph=g,vids=s) |
|
23 |
+ aaa<-get.data.frame(g2) |
|
24 |
+ colnames(aaa)[1] <- 'V1' |
|
25 |
+ colnames(aaa)[2] <- 'V2' |
|
26 |
+ lista_int[[k]]<-aaa |
|
46 | 27 |
names(lista_int)[k]<-colnames(pathway)[k] |
47 |
- } |
|
28 |
+ } |
|
48 | 29 |
return(lista_int) |
49 | 30 |
} |
50 | 31 |
|
51 | 32 |
|
33 |
+ |
|
34 |
+ |
|
52 | 35 |
#' @title Get human KEGG pathway data and output of path_net in order to define the common genes. |
53 | 36 |
#' @description list_path_net creates a list of interacting genes for each human pathway. |
54 | 37 |
#' @param lista_net output of path_net |
... | ... |
@@ -56,7 +39,7 @@ path_net<-function(pathway,net_type){ |
56 | 39 |
#' @export |
57 | 40 |
#' @return a list of genes for each pathway (interacting genes belong to that pathway) |
58 | 41 |
#' @examples |
59 |
-#' lista_netw<-path_net(pathway=path,net_type=netw) |
|
42 |
+#' lista_netw<-path_net(pathway=path,data=netw) |
|
60 | 43 |
#' list_path<-list_path_net(lista_net=lista_netw,pathway=path) |
61 | 44 |
list_path_net<-function(lista_net,pathway){ |
62 | 45 |
v=list() |
... | ... |
@@ -65,6 +48,7 @@ for (j in 1:length(lista_net)){ |
65 | 48 |
cf<-lista_net[[j]] |
66 | 49 |
i <- sapply(cf, is.factor) |
67 | 50 |
cf[i] <- lapply(cf[i], as.character) |
51 |
+ colnames(cf) <- c("m_shar_pro", "m2_shar_pro") |
|
68 | 52 |
m<-c(cf$m_shar_pro) |
69 | 53 |
m2<-c(cf$m2_shar_pro) |
70 | 54 |
s<-c(m,m2) |
... | ... |
@@ -18,7 +18,7 @@ a list of genes for each pathway (interacting genes belong to that pathway) |
18 | 18 |
list_path_net creates a list of interacting genes for each human pathway. |
19 | 19 |
} |
20 | 20 |
\examples{ |
21 |
-lista_netw<-path_net(pathway=path,net_type=netw) |
|
21 |
+lista_netw<-path_net(pathway=path,data=netw) |
|
22 | 22 |
list_path<-list_path_net(lista_net=lista_netw,pathway=path) |
23 | 23 |
} |
24 | 24 |
|
... | ... |
@@ -4,12 +4,12 @@ |
4 | 4 |
\alias{path_net} |
5 | 5 |
\title{Get human KEGG pathway data and network data in order to define the common gene.} |
6 | 6 |
\usage{ |
7 |
-path_net(pathway, net_type) |
|
7 |
+path_net(pathway, data) |
|
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 | 10 |
\item{pathway}{pathway data as provided by getKEGGdata} |
11 | 11 |
|
12 |
-\item{net_type}{network data as provided by getNETdata} |
|
12 |
+\item{data}{network data as provided by getNETdata} |
|
13 | 13 |
} |
14 | 14 |
\value{ |
15 | 15 |
a list of network data for each pathway (interacting genes belong to that pathway) |
... | ... |
@@ -18,6 +18,6 @@ a list of network data for each pathway (interacting genes belong to that pathwa |
18 | 18 |
path_net creates a list of network data for each human pathway. The network data will be generated when interacting genes belong to that pathway. |
19 | 19 |
} |
20 | 20 |
\examples{ |
21 |
-lista_net<-path_net(pathway=path,net_type=netw) |
|
21 |
+lista_net<-path_net(pathway=path,data=netw) |
|
22 | 22 |
} |
23 | 23 |
|
... | ... |
@@ -463,7 +463,7 @@ The function `path_net` creates a network of interacting genes for each pathway. |
463 | 463 |
The output will be a network of genes belonging to the same pathway. |
464 | 464 |
|
465 | 465 |
```{r, eval = TRUE} |
466 |
-network_path<-path_net(pathway=path,net_type=netw) |
|
466 |
+network_path<-path_net(pathway=path,data=netw) |
|
467 | 467 |
``` |
468 | 468 |
|
469 | 469 |
|