-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRead_cTF.R
66 lines (49 loc) · 2.18 KB
/
Read_cTF.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
# Read_cTF.R
#
# Purpose: To read cTF (combination of transcription data) in R and look at it.
# Version: 0.1
# Date: 2016-03-20
# Author: Anam Qudrat
#
# Input: Ranks
# Output: Data matrix
# Depends: NA
#
# ToDo: How to generate a combined expression set for cTF and Gsx (gene expression score) data?
# Notes: Need actual data. Do we even need the data as an ExpressionSet?
#
# V 0.1: First code
# ====================================================================
# ==== PARAMETERS ==================================================
cTFFile <- "TFdata.txt" # Output of RANK Module with cTF ranks.
# ==== PACKAGES ====================================================
# # Here, I propose to build an ExpressionSet which can be easily manipulated and serves as the input/output for many Bioconductor functions. This class is designed to combine several different sources of infomration into a single convenient structure.
# Install and load Biobase into R.
if (!require(Biobase, quietly=TRUE)) {
install.packages("Biobase")
library(Biobase)
}
# ==== FUNCTIONS ===================================================
source("http://bioconductor.org/biocLite.R")
biocLite(c("Biobase"))
library ("Biobase")
# ==== ANALYSIS ====================================================
# Building an ExpressionSet from Scratch
# Collect Gsx data into a matrix. Assume the Gsx data is in a tab-delimited text file (exported from a spreadsheet).
cTFFile <- "/Users/amatulah/Desktop/BCB420/dev/Analyze/ReadcTF/TFdata.txt"
cTF <- as.matrix(read.table(cTFFile, header=TRUE, sep="\t", #the argument becomes sep=","
row.names=1,
as.is=TRUE))
# ==== TESTS =======================================================
#Check whether Read matches your expectations
class(cTF)
dim(cTF)
colnames(cTF)
head(cTF[,1])
#Create a minimal expression set
Set1 <- ExpressionSet(transcriptionfactors=cTF)
#Look at the cTF data using a histogram. This will lead us into classfication and determining a cutoff.
png('cTF.histogram.png')
hist(cTF,breaks=100,col='yellow',main='Histogram of gene expression levels',xlab='Expression level')
dev.off()
# [END]