Browse code

updated how the mbias table is generated

Divyagash authored on 21/03/2018 03:12:07
Showing 2 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: scmeth
2 2
 Type: Package
3 3
 Title: Functions to conduct quality control analysis in methylation data
4
-Version: 0.99.29
4
+Version: 0.99.30
5 5
 Author: Divy Kangeyan <[email protected]>
6 6
 Maintainer: Divy Kangeyan <[email protected]>
7 7
 Depends: R (>= 3.5.0)
... ...
@@ -50,16 +50,17 @@ mbiasplot <- function(dir=NULL,mbiasFiles=NULL){
50 50
 
51 51
     mbiasTable <- rbind(CpG_Mbias_Read1[,c('position','X..methylation','read')],
52 52
                         CpG_Mbias_Read2[,c('position','X..methylation','read')])
53
+    colnames(mbiasTable)<-c('position','methylation','read')
53 54
     mbiasTableList[[i]] <- mbiasTable
54 55
     }
55 56
 
56 57
     mt <- reshape2::melt(mbiasTableList,
57
-                        id.vars=c('position', 'X..methylation', 'read'))
58
+                        id.vars=c('position', 'methylation', 'read'))
58 59
     mt$read_rep <- paste(mt$read, mt$L1, sep="_")
59 60
 
60
-    meanTable <- stats::aggregate( X..methylation ~ position+read, data=mt, FUN=mean)
61
-    sdTable <- stats::aggregate( X..methylation ~ position+read, data=mt, FUN=sd)
62
-    seTable <- stats::aggregate( X..methylation ~ position+read, data=mt, FUN=function(x){sd(x)/sqrt(length(x))})
61
+    meanTable <- stats::aggregate( methylation ~ position+read, data=mt, FUN=mean)
62
+    sdTable <- stats::aggregate( methylation ~ position+read, data=mt, FUN=sd)
63
+    seTable <- stats::aggregate( methylation ~ position+read, data=mt, FUN=function(x){sd(x)/sqrt(length(x))})
63 64
 
64 65
     sum_mt<-data.frame('position'=meanTable$position,'read'=meanTable$read,
65 66
                        'meth'=meanTable$X..methylation, 'sdMeth'=sdTable$X..methylation,