-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrunOntoscope.R
123 lines (69 loc) · 2.59 KB
/
runOntoscope.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# runOntoscope.R
#
# Purpose: Run an "Ontoscope" query, and analysis based on
# and extending the mogrify workflow of
# Rackham et al. (2016).
#
# V 0.00001
# Date: March 29. 2016
# Author: Boris Steipe and BCB420 class
#
# V 0.00001 Very first crude code to integrate modules
#
# ==========================================================
setwd("~/Documents/07.TEACHING/50.8-BCB420-JTB2020 2016/BCB420/Ontoscope")
# ==== INITS =============================
source("../Ontoscope/phylify/ontology-explorer.r")
# ========================================
# load the ontology
load("../Ontoscope/phylify/COdat.RData")
mogList <- getMogrifyIDs()
targetParent <- "FF:0000592"
# use gather module to get a list of background Fantom IDs
x1 <- neighborhood(COdat, order=1, nodes= targetParent, mode="out")
x2 <- neighborhood(COdat, order=2, nodes= targetParent, mode="out")
x3 <- neighborhood(COdat, order=3, nodes= targetParent, mode="out")
parent <- "FF:0101581"
bck <- neighborhood(COdat, order=2, nodes=parent, mode="in")
# source Fantom functions
source("./fantom_import/fantom_main.R")
fantom
x <- fantomSearch("cardiac")
cell <- levels(x$FANTOM.5.Ontology.ID)[400]
bck <- levels(x$FANTOM.5.Ontology.ID)[1:2]
request <- c(cell, bck)
fantomOntology(request)
fantomSummarize(5) #parameter is min. expression count threshold
# load up CONTRAST
source("./contrast/contrast.R")
# NOTE: change format!
counts <- fantomCounts[ , -1]
rownames(counts) <- fantomCounts$short_description
colnames(counts) <- c("fib", "card1", "card2")
diffExp <- contrast_v2(counts)
# Build a network
# Normalize the STRING file by executing functions in ./WEAVE/normalizeWeave.R
# If this has been run before, you only need to reload the file.
# load(file = STRINGnew)
# use only high-confidence edges (score > 900)
tmp <- src
src <- src[src$combined_score > 900, ]
nrow(src)
# build the WEAVE network using WEAVE-STRING.R fucntions
# STRGRAPH <- graph_from_data_frame(src, directed = FALSE)
load("MARA.RData")
# needs code here that builds a network for the cell-types we are working with.
# ....
# using tools from TRRUST_network to load TRRUST GRN
#works if ontoscope is the working directory
#This is the entire TRRUST network with no subsetting
#Directed from Transcription Factor to Gene
source("./TRRUST_network/TRRUST_network.R")
trrust <- loadTRRUST()
setMode(1)
genes <- trrust[,1]
trrust_nodes <- getNodes(trrust)
trrust_edges <- getEdges (trrust)
trrust_nodes <- getWeights(trrust_nodes,trrust_edges)
TRRUST_GRNGRAPH <- graph_from_data_frame(trrust_edges, directed = TRUE)
# [END]