forked from trinityrnaseq/RNASeq_Trinity_Tuxedo_Workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cummeRbund.demo.R
84 lines (67 loc) · 2.87 KB
/
cummeRbund.demo.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
library(cummeRbund);
cat("\n","Reading cuffdiff output","\n")
cat("cuff = readCufflinks('diff_out');\n")
cuff = readCufflinks('diff_out');
cat("\n","Plotting FPKM density for genes:","\n")
cat("csDensity(genes(cuff))\n");
print(csDensity(genes(cuff)));
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("\n","Plotting scatter for gene fpkms in Sp_log vs. Sp_plat:","\n")
cat("csScatter(genes(cuff), 'Sp_log', 'Sp_plat'))\n");
print(csScatter(genes(cuff), 'Sp_log', 'Sp_plat'));
dev.flush()
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("\n","Plotting scatter matrix:","\n")
cat("csScatterMatrix(genes(cuff)\n");
print(csScatterMatrix(genes(cuff)));
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("\n","Plotting volcano matrix:","\n")
cat("csVolcanoMatrix(genes(cuff), 'Sp_log', 'Sp_plat')\n")
print(csVolcanoMatrix(genes(cuff), 'Sp_log', 'Sp_plat'));
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("\n","Get genes found as diff expressed:","\n")
cat("gene_diff_data = diffData(genes(cuff));\n")
gene_diff_data = diffData(genes(cuff));
# how many genes?
cat("How many genes?\n");
cat("nrow(gene_diff_data)\n");
count = nrow(gene_diff_data);
cat("\n","Have :",count, "\n")
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("\n","Extract diff expressed genes according to specified criteria:","\n")
cat("sig_gene_data = subset(gene_diff_data,(significant=='yes' | p_value < 0.01))\n");
sig_gene_data = subset(gene_diff_data,(significant=='yes' | p_value < 0.01));
# how many significant diff expr?
cat("How many significant genes selected?\n");
count = nrow(sig_gene_data);
cat("count = nrow(sig_gene_data)\n");
cat("\n", "Found ", count, " genes diff expressed according to criteria: p_value < 0.01", "\n");
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat ("\n", "Examples of DE genes:", "\n");
cat("head(sig_gene_data)\n");
print(head(sig_gene_data));
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
ex_gene_id = sig_gene_data$gene_id[1]
cat("Examine the expression values for one of the genes. We'll select" , ex_gene_id, "\n");
cat("ex_gene = getGene(cuff, '", ex_gene_id, "')\n", sep='');
ex_gene = getGene(cuff, ex_gene_id)
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat ("Generate the expression plot for this gene.\n");
cat("expressionBarplot(ex_gene, logMode=T, showErrorbars=F)\n");
print(expressionBarplot(ex_gene, logMode=T, showErrorbars=F))
cat("\n","Press Enter to Continue","\n")
readLines(file("stdin"),1)
cat("Generate a clustered heatmap for all significant genes:\n");
cat("sig_genes = getGenes(cuff, sig_gene_data$gene_id)\n");
sig_genes = getGenes(cuff, sig_gene_data$gene_id);
cat("csHeatmap(sig_genes, cluster='both')\n");
print(csHeatmap(sig_genes, cluster='both'));
cat("\n", "Done with cummeRbund demo", "\n");