navinlabcode / copykit

Toolkit for single-cell copy number analysis
Other
16 stars 4 forks source link

Error when smoothed_bincounts is not in the assay #97

Closed Puriney closed 1 year ago

Puriney commented 1 year ago

When I run objd <- calcInteger(objd, method = 'scquantum') , the this error shows up.

Error in assay(objd, "smoothed_bincounts") : 
  'assay(<CopyKit>, i="character", ...)' invalid subscript 'i'
'smoothed_bincounts' not in names(assays(<CopyKit>))

I find it is because the object did not contain the smoothed_bincounts assay, and the way the function examines the existence of this assay has a problem.

https://github.com/navinlabcode/copykit/blob/690eb41b54d8bf331f7dd1475d24ad452c54f3a4/R/calcInteger.R#L62

You may consider checking the existence in this way:

'smoothed_bincounts' %in% assayNames(scCNA)
darlanminussi commented 1 year ago

Thank you for the PR!