-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignature_commands.txt
105 lines (40 loc) · 1.91 KB
/
signature_commands.txt
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
cd ~/somatic/somatic_signatures
pwd
ls
R
library(SomaticSignatures)
library(BSgenome.Hsapiens.UCSC.hg19)
library(ggplot2)
library(Cairo)
setwd(”~/somatic/somatic_signatures”)
files <- list.files("~/somatic/somatic_signatures", pattern="vcf$", full.names=TRUE)
files
vranges <- lapply(files, function(v) readVcfAsVRanges(v,"hg19"))
vranges.cat <- do.call(c,vranges)
vranges.cat
vranges.cat <- ucsc(vranges.cat)
print(table(sampleNames(vranges.cat)))
mc <- mutationContext(vranges.cat, BSgenome.Hsapiens.UCSC.hg19)
mm <- motifMatrix(mc, group = "sampleNames", normalize=TRUE)
dim(mm)
gof_nmf <- assessNumberSignatures(mm, 2:10, nReplicates = 5)
Cairo(file="plotNumberOfSignatures.pdf", type="pdf", units="in", width=9, height=8, dpi=72)
plotNumberSignatures(gof_nmf)
dev.off()
sigs_nmf = identifySignatures(mm, 3, nmfDecomposition)
Cairo(file="plot3Signatures.pdf", type="pdf", units="in", width=10, height=8, dpi=72)
plotSignatures(sigs_nmf,normalize=TRUE, percent=FALSE) + ggtitle("Somatic Signatures: NMF - Barchart") + scale_fill_brewer(palette = "Set2")
dev.off()
Cairo(file="PlotSampleContribution3Signatures.pdf", type="pdf", units="in", width=9, height=6, dpi=72)
plotSamples(sigs_nmf, normalize=TRUE) + scale_y_continuous(breaks=seq(0, 1, 0.2), expand = c(0,0))+ theme(axis.text.x = element_text(size=6))
dev.off()
#advanced
sigs_nmf = identifySignatures(mm, 4, nmfDecomposition)
Cairo(file="plot4Signatures.pdf", type="pdf", units="in", width=10, height=8, dpi=72)
plotSignatures(sigs_nmf,normalize=TRUE, percent=FALSE) + ggtitle("Somatic Signatures: NMF - Barchart") + scale_fill_brewer(palette = "Set2")
dev.off()
Cairo(file="PlotSampleContribution4Signatures.pdf", type="pdf", units="in", width=9, height=6, dpi=72)
plotSamples(sigs_nmf, normalize=TRUE) + scale_y_continuous(breaks=seq(0, 1, 0.2), expand = c(0,0))+ theme(axis.text.x = element_text(size=6))
dev.off()
quit()
n