@@ -19,39 +19,41 @@ maf=read.table(infile,sep="\t",as.is=TRUE)
19
19
20
20
pdf(outfile , width = 7 , height = 7 )
21
21
22
- if (nr_in_dbSNP > 3 && length(which(maf [,1 ]== 1 ))> 1 ){
23
-
24
- dens_in_dbSNP <- density(x = maf [maf [,1 ]== 1 ,3 ])
25
- dens_in_all <- density(x = maf [,3 ])
26
- perc_in_dbSNP <- round((100 * nr_in_dbSNP / snvnum ),2 )
27
-
28
- maxy <- max(dens_in_all $ y )
29
- if (max(dens_in_all $ y ) < max(dens_in_dbSNP $ y )){
30
- maxy <- max(dens_in_dbSNP $ y )
22
+ if (nrow(maf )> 1 ) {
23
+ if (nr_in_dbSNP > 3 && length(which(maf [,1 ]== 1 ))> 1 ){
24
+
25
+ dens_in_dbSNP <- density(x = maf [maf [,1 ]== 1 ,3 ])
26
+ dens_in_all <- density(x = maf [,3 ])
27
+ perc_in_dbSNP <- round((100 * nr_in_dbSNP / snvnum ),2 )
28
+
29
+ maxy <- max(dens_in_all $ y )
30
+ if (max(dens_in_all $ y ) < max(dens_in_dbSNP $ y )){
31
+ maxy <- max(dens_in_dbSNP $ y )
32
+ }
33
+
34
+ plot(dens_in_dbSNP , ylim = c(0 ,maxy ), col = " red" , cex.lab = 1.5 , cex.axis = 1.5 , lwd = 3 , xlab = paste(" Mutant allele frequency from " , snvnum , " SNVs and " , nr_in_dbSNP , " in dbSNP" , sep = " " ), xlim = c(0 , 1.0 ),main = " " )
35
+ lines(dens_in_all ,col = " blue" , lwd = 3 )
36
+ abline(v = 0.5 ,col = " black" ,lty = 2 )
37
+ title(main = paste(pid , perc_in_dbSNP , " % in dbSNP" , sep = " " ), cex.main = 1.5 )
38
+
39
+ legend(" topright" , c(" ALL" ," IN dbSNP" ), fill = c(" blue" ," red" ), cex = 0.7 , lwd = 1 , bty = " n" )
40
+ }else {
41
+ # dens_in_dbSNP <- density(x = maf[maf[,1]==1,3])
42
+ dens_in_all <- density(x = maf [,3 ])
43
+ perc_in_dbSNP <- round((100 * nr_in_dbSNP / snvnum ),2 )
44
+
45
+ maxy <- max(dens_in_all $ y )
46
+ # if(max(dens_in_all$y) < max(dens_in_dbSNP$y)){
47
+ # maxy <- max(dens_in_dbSNP$y)
48
+ # }
49
+
50
+ plot(dens_in_all , ylim = c(0 ,maxy ), col = " red" , cex.lab = 1.5 , cex.axis = 1.5 , lwd = 3 , xlab = paste(" Mutant allele frequency from " , snvnum , " SNVs and " , nr_in_dbSNP , " in dbSNP" , sep = " " ), xlim = c(0 , 1.0 ),main = " " )
51
+ # lines(dens_in_all,col = "blue", lwd = 3)
52
+ abline(v = 0.5 ,col = " black" ,lty = 2 )
53
+ title(main = paste(pid , perc_in_dbSNP , " % in dbSNP" , sep = " " ), cex.main = 1.5 )
54
+
55
+ legend(" topright" , c(" ALL" ," IN dbSNP" ), fill = c(" blue" ," red" ), cex = 0.7 , lwd = 1 , bty = " n" )
31
56
}
32
-
33
- plot(dens_in_dbSNP , ylim = c(0 ,maxy ), col = " red" , cex.lab = 1.5 , cex.axis = 1.5 , lwd = 3 , xlab = paste(" Mutant allele frequency from " , snvnum , " SNVs and " , nr_in_dbSNP , " in dbSNP" , sep = " " ), xlim = c(0 , 1.0 ),main = " " )
34
- lines(dens_in_all ,col = " blue" , lwd = 3 )
35
- abline(v = 0.5 ,col = " black" ,lty = 2 )
36
- title(main = paste(pid , perc_in_dbSNP , " % in dbSNP" , sep = " " ), cex.main = 1.5 )
37
-
38
- legend(" topright" , c(" ALL" ," IN dbSNP" ), fill = c(" blue" ," red" ), cex = 0.7 , lwd = 1 , bty = " n" )
39
- }else {
40
- # dens_in_dbSNP <- density(x = maf[maf[,1]==1,3])
41
- dens_in_all <- density(x = maf [,3 ])
42
- perc_in_dbSNP <- round((100 * nr_in_dbSNP / snvnum ),2 )
43
-
44
- maxy <- max(dens_in_all $ y )
45
- # if(max(dens_in_all$y) < max(dens_in_dbSNP$y)){
46
- # maxy <- max(dens_in_dbSNP$y)
47
- # }
48
-
49
- plot(dens_in_all , ylim = c(0 ,maxy ), col = " red" , cex.lab = 1.5 , cex.axis = 1.5 , lwd = 3 , xlab = paste(" Mutant allele frequency from " , snvnum , " SNVs and " , nr_in_dbSNP , " in dbSNP" , sep = " " ), xlim = c(0 , 1.0 ),main = " " )
50
- # lines(dens_in_all,col = "blue", lwd = 3)
51
- abline(v = 0.5 ,col = " black" ,lty = 2 )
52
- title(main = paste(pid , perc_in_dbSNP , " % in dbSNP" , sep = " " ), cex.main = 1.5 )
53
-
54
- legend(" topright" , c(" ALL" ," IN dbSNP" ), fill = c(" blue" ," red" ), cex = 0.7 , lwd = 1 , bty = " n" )
55
57
}
56
58
57
59
dev.off()
0 commit comments