methylKit icon indicating copy to clipboard operation
methylKit copied to clipboard

regionCounts doesnt work when save.db=TRUE

Open katwre opened this issue 3 years ago • 1 comments

Hello, regionCounts() just threw me an error:

Error in validObject(.Object) :
  invalid class “methylBaseDB” object: 1: invalid object for slot "coverage.index" in class "methylBaseDB": got class "NULL", should be or extend class "numeric"
invalid class “methylBaseDB” object: 2: invalid object for slot "numCs.index" in class "methylBaseDB": got class "NULL", should be or extend class "numeric"
invalid class “methylBaseDB” object: 3: invalid object for slot "numTs.index" in class "methylBaseDB": got class "NULL", should be or extend class "numeric"

do debugged, and so far I noticed that here https://github.com/al2na/methylKit/blob/cfbc32ed9dd490e9e8070d33cacaa6ebecb56d76/R/methylDBFunctions.R#L2076 regionCounts created a tabix file that looks like this:

#Date:2021-01-23 19:00:14
#Class:methylBaseDB
#DT:tabix
#SI:CB2007;CB2022;CB2019;CB2021;CB2001;CB2005;CB2010;CB2006;CB2049;CB2017;CB2011;CB2018;CB2012;CB2024;CB2025;CB2016;CB2020;CB2023;CB2013;CB2008;CB2039;CB2004;CB2002;CB2014
#AS:hg38
#CT:CpG
#TM:3;5;4;3;5;2;4;1;4;1;1;4;2;5;5;4;1;2;5;3;1;2;3;2
#DS:TRUE
#RS:region
#DT:tabix
chr1    61922   62140   *       879     592     287     757     77      680     275     164     111     179     54      125     492     171     321     418     316     102     482     77      405     375     172
     203     186     122     64      432     145     287     521     251     270     437     328     109
     424     297     127     712     185     527     797     71      726     576     341     235     511
     322     189     759     278     481     885     84      801     548     301     247     413     217
     196     415     102     313     702     259     443     1081    523     558
chr1    779860  780130  *       760     602     158     946     90      856     1034    680     354     667     491     176     714     90      624     669     614     55      843     78      765     592     419
     173     721     507     214     698     422     276     507     413     94      765     147     618
     841     720     121     685     533     152     545     123     422     1216    432     784     675
     569     106     910     608     302     893     382     511     398     288     110     698     336
     362     839     484     355     811     600     211     1528    1233    295

and then I get the error in this line https://github.com/al2na/methylKit/blob/cfbc32ed9dd490e9e8070d33cacaa6ebecb56d76/R/methylDBFunctions.R#L2205 and so then when I remove if clauses that are here https://github.com/al2na/methylKit/blob/dd8f40c129c95bc4844552e747669a3da8a122ab/R/methylDBClasses.R#L679 and here https://github.com/al2na/methylKit/blob/dd8f40c129c95bc4844552e747669a3da8a122ab/R/methylDBClasses.R#L683 then it works fine.. I am feeling confused

Cheers, Kasia

katwre avatar Jan 23 '21 18:01 katwre

Hi Kasia,

would you mind sending me the code that produced your error? If possible please show me a reproducible example.

Best, Alex

alexg9010 avatar Jan 23 '21 21:01 alexg9010