Skip to content

Commit a273547

Browse files
authored
Merge pull request #11 from IARCbioinfo/dev
Version 2 of the tool
2 parents fc2802f + 4f23d45 commit a273547

40 files changed

+3773
-3320
lines changed
File renamed without changes.
File renamed without changes.

Diff for: R/compareSignature_Galaxy.r

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#-----------------------------------#
44
# Author: Maude #
55
# Script: compareSignature_Galaxy.r #
6-
# Last update: 29/10/15 #
6+
# Last update: 14/02/17 #
77
#-----------------------------------#
88

99

@@ -16,7 +16,7 @@
1616
# Print a usage message if there is no argument pass to the command line
1717
#-------------------------------------------------------------------------------
1818
args <- commandArgs(TRUE)
19-
usage <- function()
19+
usage <- function()
2020
{
2121
msg <- paste0('Usage:\n',
2222
' compareSignature_Galaxy.r Published_Signature New_Signature Output_Folder\n'
@@ -61,7 +61,7 @@ dataFrame1 <- read.table(published_signature_file, header=T, sep="\t")
6161
# Remove the first three colmumns (Substitution Type, Trinucleotide Somatic, Mutation Type)
6262
dataFrame1 <- dataFrame1[,4:ncol(dataFrame1)]
6363
matrix1 <- as.matrix(dataFrame1)
64-
64+
6565
# Unkown signatures
6666
dataFrame2 <- read.table(unknown_signature_file, header=T, sep="\t")
6767
# Remove the first two columns (alteration, context)
@@ -78,7 +78,7 @@ cosine_res <- cosine(input_matrix_cos)
7878
# Keep only the comparison between the two matrices
7979
nbSign <- ncol(matrix1)+1 # +1 for havng the first signature of the matrix1
8080
cosine_res_subset <- cosine_res[nbSign:nrow(cosine_res), 1:ncol(matrix1)]
81-
81+
8282
# Save the matrix
8383
write.table(cosine_res_subset, file=output_cosineRes, quote=F, sep="\t", col.names=T, row.names=T)
8484

@@ -90,23 +90,23 @@ colnames(cosineRes_subset_melt) <- c("Unknown_Signatures", "Published_Signatures
9090
cosineRes_subset_melt$Published_Signatures <- as.character(cosineRes_subset_melt$Published_Signatures)
9191
#Then turn it back into an ordered factor
9292
cosineRes_subset_melt$Published_Signatures <- factor(cosineRes_subset_melt$Published_Signatures, levels=rev(unique(cosineRes_subset_melt$Published_Signature)))
93-
93+
9494
# Base plot: heatmap
9595
p1 <- ggplot(cosineRes_subset_melt, aes(x=Published_Signatures, y=Unknown_Signatures, fill=Similarity)) + geom_tile(colour="yellow") +scale_fill_gradientn(colours=c("yellow", "red")) + theme_classic()
96-
96+
9797
# Rename the signatures
98-
if(basename(published_signature_file) == "Frequency-COSMICv72-Hupki.txt")
98+
if(basename(published_signature_file) == "Frequency-COSMIC30-Hupki.txt")
9999
{
100100
p1 <- p1 + scale_x_discrete(breaks = c("Signature.1", "Signature.2", "Signature.3", "Signature.4", "Signature.5", "Signature.6", "Signature.7", "Signature.8", "Signature.9",
101101
"Signature.10", "Signature.11", "Signature.12", "Signature.13", "Signature.14", "Signature.15", "Signature.16", "Signature.17",
102102
"Signature.18", "Signature.19", "Signature.20", "Signature.21", "Signature.22", "Signature.23", "Signature.24", "Signature.25",
103103
"Signature.26", "Signature.27", "Signature.28", "Signature.29", "Signature.30",
104104
"Signature.1.MEF", "Signature.2.MEF", "Signature.3.MEF", "Signature.5.MEF"),
105-
labels = c("(Age) Sign 1", "(AID/APOBEC) Sign 2", "(BRCA1/2) Sign 3", "(Smoking) Sign 4", "Sign 5", "(DNA MMR deficiency) Sign 6", "(UV) Sign 7",
106-
"Sign 8", "(IgG) Sign 9", "(pol e) Sign 10", "(temozolomide) Sign 11", "Sign 12", "(AID/APOBEC) Sign 13", "Sign 14",
107-
"(DNA MMR deficiency) Sign 15", "Sign 16", "Sign 17", "Sign 18", "Sign 19", "(DNA MMR deficiency) Sign 20", "Sign 21", "(AA) Sign 22",
108-
"Sign 23", "(Aflatoxin) Sign 24", "Sign 25", "(DNA MMR deficiency) Sign 26", "Sign 27", "Sign 28", "(Tobacco chewing) Sign 29", "Sign 30",
109-
"(AA) Sign 1 MEF", "(AID) Sign 2 MEF", "(BaP) Sign 3 MEF", "(MNNG) Sign 5 MEF")
105+
labels = c("(Age) Sig 1", "(AID/APOBEC) Sig 2", "(BRCA1/2) Sig 3", "(Smoking) Sig 4", "Sig 5", "(DNA MMR deficiency) Sig 6", "(UV) Sig 7",
106+
"Sig 8", "(IgG) Sig 9", "(pol e) Sig 10", "(temozolomide) Sig 11", "Sig 12", "(AID/APOBEC) Sig 13", "Sig 14",
107+
"(DNA MMR deficiency) Sig 15", "Sig 16", "Sig 17", "Sig 18", "Sig 19", "(DNA MMR deficiency) Sig 20", "Sig 21", "(AA) Sig 22",
108+
"Sig 23", "(Aflatoxin) Sig 24", "Sig 25", "(DNA MMR deficiency) Sig 26", "Sig 27", "Sig 28", "(Tobacco chewing) Sig 29", "Sig 30",
109+
"(AA) Sig 1 MEF", "(AID) Sig 2 MEF", "(BaP) Sig 3 MEF", "(MNNG) Sig 5 MEF")
110110
)
111111
}
112112

Diff for: R/figs_MutSpecStat_Galaxy.r

+11-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
#########################################################################################################################################
11-
# Create the figures for the report and the HTML page #
11+
# Create the figures for the report and the HTML page #
1212
#########################################################################################################################################
1313

1414

@@ -23,13 +23,13 @@ suppressMessages(suppressWarnings(require("getopt")))
2323
# Recover the arguments
2424
#-------------------------------------------------------------------------------
2525
spec = matrix(c(
26-
"folderFigure", "folderFigure", 1, "character",
27-
"folderTemp", "folderTemp", 1, "character",
28-
"filename", "filename", 1, "character",
29-
"help", "h", 0, "logical"
30-
),
31-
byrow=TRUE, ncol=4
32-
)
26+
"folderFigure", "folderFigure", 1, "character",
27+
"folderTemp", "folderTemp", 1, "character",
28+
"filename", "filename", 1, "character",
29+
"help", "h", 0, "logical"
30+
),
31+
byrow=TRUE, ncol=4
32+
)
3333

3434
opt = getopt(spec)
3535

@@ -56,6 +56,7 @@ if ( !is.null(opt$help) )
5656
suppressMessages(suppressWarnings(library(ggplot2)))
5757
suppressMessages(suppressWarnings(library(gplots)))
5858
suppressMessages(suppressWarnings(library(gtable)))
59+
suppressMessages(suppressWarnings(library(grid)))
5960

6061

6162

@@ -111,14 +112,13 @@ bar <- bar + theme_classic()
111112
bar <- bar + xlab("")
112113
# Set the color of the bars and Changing the labels in the legend
113114
bar <- bar + scale_fill_manual(values=c("blue", "black", "red", "gray", "#00CC33", "pink"),
114-
labels=c("C:G>A:T", "C:G>G:C", "C:G>T:A", "T:A>A:T", "T:A>C:G", "T:A>G:C")
115-
)
115+
labels=c("C:G>A:T", "C:G>G:C", "C:G>T:A", "T:A>A:T", "T:A>C:G", "T:A>G:C")
116+
)
116117
# Remove the label in x axis
117118
bar <- bar + theme(axis.text.x = element_blank())
118119
# Change the name of the y label
119120
bar <- bar + ylab("Percent")
120121
# Save the plot for the HTML page (higher resolution)
121-
options(bitmapType='cairo')
122122
png(outputDistrSBS, width=1800, height=1500, res=300)
123123
print(bar)
124124
dev.off()
@@ -147,7 +147,6 @@ pie <- pie + guides(fill=guide_legend(ncol=2)) + theme(legend.position="bottom")
147147
# Remove the legend title
148148
pie <- pie + labs(fill="")
149149
# Save the plot for the HTML page (higher resolution)
150-
options(bitmapType='cairo')
151150
png(outputImpactProt, width=1600, height=1800, res=300)
152151
print(pie)
153152
dev.off()
@@ -172,7 +171,6 @@ cb_palette_SB <- c("#0072B2", "#CC0000")
172171
# Base plot
173172
p_sb <- ggplot(file_sb, aes(x=Alteration, y=Count, fill=Strand)) + theme_classic() + geom_bar(stat="identity", position="dodge") + scale_fill_manual(values=cb_palette_SB) + theme(axis.text.x = element_text(angle=60, hjust=1)) + xlab("") + theme(legend.position="bottom")
174173
# Save the plot for the HTML page (higher resolution)
175-
options(bitmapType='cairo')
176174
png(outputSB, width=1000, height=1200, res=300)
177175
print(p_sb)
178176
dev.off()
@@ -198,27 +196,23 @@ outputHeatmapGenomicPercentReport <- paste0(opt$folderTemp, "/", opt$filename, "
198196
## COUNT
199197
heatmap_C <- read.table(inputHeatmapGenomic, header=T)
200198
# Save the plot for the report
201-
options(bitmapType='cairo')
202199
png(filename=outputHeatmapGenomicReport, bg="transparent", width=240, height=360)
203200
# Heatmap with an absolute scale
204201
heatmap.2(as.matrix(heatmap_C),Rowv=F,Colv=F,col=colorpanel(384,low="yellow",high="red"),dendrogram="none",scale="none",trace="none",key=F,labRow=rownames(as.matrix(heatmap_C)),labCol=colnames(as.matrix(heatmap_C)),lmat=rbind(c(5,1,4),c(3,1,2)), lhei=c(0.75,0.75),lwid=c(0.5,1.5,0.5))
205202
dev.off()
206203
# Save the plot for the HTML page (higher resolution)
207-
options(bitmapType='cairo')
208204
png(filename=outputHeatmapGenomic, width=1100, height=1600, res=300)
209205
heatmap.2(as.matrix(heatmap_C),Rowv=F,Colv=F,col=colorpanel(384,low="yellow",high="red"),dendrogram="none",scale="none",trace="none",key=F,labRow=rownames(as.matrix(heatmap_C)),labCol=colnames(as.matrix(heatmap_C)),lmat=rbind(c(5,1,4),c(3,1,2)), lhei=c(0.75,0.75),lwid=c(0.5,1.5,0.5))
210206
dev.off()
211207

212208
## PERCENT
213209
heatmap_P <- read.table(inputHeatmapGenomicPercent, header=T)
214210
# Save the plot for the report
215-
options(bitmapType='cairo')
216211
png(filename=outputHeatmapGenomicPercentReport,bg="transparent", width=240, height=360)
217212
# Heatmap with an absolute scale
218213
heatmap.2(as.matrix(heatmap_P),Rowv=F,Colv=F,col=colorpanel(384,low="yellow",high="red"),dendrogram="none",scale="none",trace="none",key=F,labRow=rownames(as.matrix(heatmap_P)),labCol=colnames(as.matrix(heatmap_P)),lmat=rbind(c(5,1,4),c(3,1,2)), lhei=c(0.75,0.75),lwid=c(0.5,1.5,0.5))
219214
dev.off()
220215
# Save the plot for the HTML page (higher resolution)
221-
options(bitmapType='cairo')
222216
png(filename=outputHeatmapGenomicPercent, width=1100, height=1600, res=300)
223217
heatmap.2(as.matrix(heatmap_P),Rowv=F,Colv=F,col=colorpanel(384,low="yellow",high="red"),dendrogram="none",scale="none",trace="none",key=F,labRow=rownames(as.matrix(heatmap_P)),labCol=colnames(as.matrix(heatmap_P)),lmat=rbind(c(5,1,4),c(3,1,2)), lhei=c(0.75,0.75),lwid=c(0.5,1.5,0.5))
224218
dev.off()

0 commit comments

Comments
 (0)