"step 4: measuring baselines ...": Error in mixtools::normalmixEM(data.c, lambda = rep(1, 3)/3, mu = c(-0.2, : NA/NaN/Inf in foreign function call (arg 4)

Open
#91 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start at the step 4 baseline-measurement code that calls mixtools::normalmixEM(data.c, ...), and inspect the values passed as data.c after the three filtering blocks were commented out. Reproduce the reported input and determine which calculation introduces non-finite values; done means the cause and the required correction or input condition are documented and confirmed.

Written by the indexing model from the issue text.

Description

Dear authors
Thank you for developing such an excellent package!
When I use it,I met some questions.
Because all the cells were filtered out when I first run the original code, three places in the original code were commented:

1——
`# genes.raw <- apply(rawmat, 2, function(x) (sum(x > 0)))

if (sum(genes.raw > 200) == 0)

stop("none cells have more than 200 genes")

if (sum(genes.raw < 100) > 1) {

rawmat <- rawmat[, -which(genes.raw < 200)]

print(paste("filtered out ", sum(genes.raw <= 200),

" cells with less than 200 genes; remaining ", ncol(rawmat),

" cells", sep = ""))

}

2——

if (length(toRev) > 0) {

anno.mat <- anno.mat[-toRev, ]

}

ToRemov2 <- NULL

for (i in 8:ncol(anno.mat)) {

cell <- cbind(anno.mat$chromosome_name, anno.mat[, i])

cell <- cell[cell[, 2] != 0, ]

if (length(as.numeric(cell)) < 5) {

rm <- colnames(anno.mat)[i]

ToRemov2 <- c(ToRemov2, rm)

}

else if (length(rle(cell[, 1])$length) < 23 | min(rle(cell[,

1])$length) < ngene.chr) {

rm <- colnames(anno.mat)[i]

ToRemov2 <- c(ToRemov2, rm)

}

i <- i + 1

}

if (length(ToRemov2) == (ncol(anno.mat) - 7))

stop("all cells are filtered")

if (length(ToRemov2) > 0) {

anno.mat <- anno.mat[, -which(colnames(anno.mat) %in%

ToRemov2)]

}

3——

ToRemov3 <- NULL

for (i in 8:ncol(anno.mat2)) {

cell <- cbind(anno.mat2$chromosome_name, anno.mat2[,

i])

cell <- cell[cell[, 2] != 0, ]

if (length(as.numeric(cell)) < 5) {

rm <- colnames(anno.mat2)[i]

ToRemov3 <- c(ToRemov3, rm)

}

else if (length(rle(cell[, 1])$length) < 23 | min(rle(cell[,

1])$length) < ngene.chr) {

rm <- colnames(anno.mat2)[i]

ToRemov3 <- c(ToRemov3, rm)

}

i <- i + 1

}

if (length(ToRemov3) == ncol(norm.mat.relat))

stop("all cells are filtered")

if (length(ToRemov3) > 0) {

norm.mat.relat <- norm.mat.relat[, -which(colnames(norm.mat.relat) %in%

ToRemov3)]

}`

Then I am encountering errors on "step 4: measuring baselines ...":
Error in mixtools::normalmixEM(data.c, lambda = rep(1, 3)/3, mu = c(-0.2, : NA/NaN/Inf in foreign function call (arg 4)
but I have checked that there is no NA value in my counts. Is it generated in the process of calculation? I can't solve this problem .Could you please help me?
I would appreciate it if you could reply to me.
Thank you very much!

Dominant language
R
Stars
305
Forks
66
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from navinlabcode/copykat

All issues in navinlabcode/copykat

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.