Skip to content

Error in as.POSIXct.numeric(e) #217

@xuzongren

Description

@xuzongren

hi!
When i run filterDoublets(ArchRProj = proj1),I got an error "Error in as.POSIXct.numeric(e) : 'origin' must be supplied".
And i don't konw how to solve the problem.There is nothing wrong with the previous steps.
I want to know how to deal with this problem, continue to analyze the data (My data comes from 10x)
Thanks!

Activity

rcorces

rcorces commented on Jun 19, 2020

@rcorces
Collaborator

Can you reproduce this error using the tutorial dataset?

xuzongren

xuzongren commented on Jun 22, 2020

@xuzongren
Author

When i use tutorial dataset,this error does not occur.
Is there something wrong with my data? (but my data comes from 10X cellranger-atac,I didn't do anything else to fragments.tsv.gz file.)
How can I deal with this error?

Meggie-MH

Meggie-MH commented on Jun 22, 2020

@Meggie-MH

Run into the same error here. Hope to see update on the issue.

rcorces

rcorces commented on Jun 22, 2020

@rcorces
Collaborator

We will need more information in order to help since we cannot reproduce this error. If you can create a minimal example, including input files, that would be helpful.

xuzongren

xuzongren commented on Jun 23, 2020

@xuzongren
Author

The R^2 values of my samples all < 0.9, that mean I can skip this step(filterDoublets)?

rcorces

rcorces commented on Jun 23, 2020

@rcorces
Collaborator

No, that is not the correct interpretation. see #173 (comment) for an explanation

xuzongren

xuzongren commented on Jun 23, 2020

@xuzongren
Author

Thanks. I've read the question( #173 (comment)).
And how can I create a minimal example so that you can better solve this problem?

rcorces

rcorces commented on Jun 23, 2020

@rcorces
Collaborator

Ideally, take a random 50,000 lines (or the first 50,000 if you prefer) of your fragment file and see if you get the same error. If so, provide us with the small fragment file and the code you used that resulted in the error.

jgranja24

jgranja24 commented on Jun 23, 2020

@jgranja24
Contributor

hi!
When i run filterDoublets(ArchRProj = proj1),I got an error "Error in as.POSIXct.numeric(e) : 'origin' must be supplied".
And i don't konw how to solve the problem.There is nothing wrong with the previous steps.
I want to know how to deal with this problem, continue to analyze the data (My data comes from 10x)
Thanks!

When does this happen? Towards the end or beginning? Is there a logfile you can share?

xuzongren

xuzongren commented on Jun 23, 2020

@xuzongren
Author

@jgranja24 ,This step does not generate any logfiles.
it show me this:
error

xuzongren

xuzongren commented on Jun 24, 2020

@xuzongren
Author

@rcorces ,I'm sorry for what I said earlier(I guess I forgot to run the tutorial dataset)
Today,I run tutorial dataset, the same error occurred……emmmm,do you have any suggestions?
Thanks!

rcorces

rcorces commented on Jun 24, 2020

@rcorces
Collaborator

@Meggie-MH are you also running on Windows? We arent currently supporting windows and I should make that more clear on the home page.

@jgranja24 - I think this is a problem related to date format conversion on Windows from Sys.time(). https://rdrr.io/r/base/Sys.time.html

ArchRProj <- addProjectSummary(ArchRProj = ArchRProj, name = "filterDoublets",

Meggie-MH

Meggie-MH commented on Jun 24, 2020

@Meggie-MH

@rcorces No, I was running on Mac. I also tried the tutorial dataset and ran into the same error from filterDoublets. The only thing I did different from the tutorial was creating arrow files by inputting individual fragments.tsv.gz and then combined all the arrow files into one character vector before running the following the steps. For some reasons, it takes infinite time to createarrowfiles directly from 'hemefragments' folder which contains three tsv.gz datasets. Not sure if that's the step starts with this issue.

9 remaining items

Meggie-MH

Meggie-MH commented on Jun 25, 2020

@Meggie-MH

@rcorces Woohoo, rewrite the function works! Thanks a lot :)

  • Back to your previous question, it does't avoid the error when running > summary <- c("Date" = as.Date(Sys.time(), origin = "1970-01-01"), test1 = 1, test2 = "two")
huidongchen

huidongchen commented on Jun 25, 2020

@huidongchen

First of all, thanks for creating such an amazing tool! I have been such a huge fan.

Unfortunately I'm running into the same problem. The same error happens when filtering doublets. (I m running it on Linux)

proj <- filterDoublets(ArchRProj = proj,cutEnrich=5)

Error info

Error in as.POSIXct.numeric(e): 'origin' must be supplied
Traceback:
1. filterDoublets(ArchRProj = proj, cutEnrich = 5)
2. addProjectSummary(ArchRProj = ArchRProj, name = "filterDoublets", 
 .     summary = c(Date = Sys.time(), cutEnrich = cutEnrich, cutScore = cutScore, 
 .         filterRatio = filterRatio))
3. append(pS, SimpleList(summary))
4. SimpleList(summary)
5. c(Date = Sys.time(), cutEnrich = cutEnrich, cutScore = cutScore, 
 .     filterRatio = filterRatio)
6. c.POSIXct(Date = Sys.time(), cutEnrich = cutEnrich, cutScore = cutScore, 
 .     filterRatio = filterRatio)
7. .POSIXct(c(unlist(lapply(list(...), function(e) unclass(as.POSIXct(e))))))
8. unlist(lapply(list(...), function(e) unclass(as.POSIXct(e))))
9. lapply(list(...), function(e) unclass(as.POSIXct(e)))
10. FUN(X[[i]], ...)
11. as.POSIXct(e)
12. as.POSIXct.numeric(e)
13. stop("'origin' must be supplied")

Rewriting the function as suggested by @jgranja24 works for me too.

rcorces

rcorces commented on Jun 25, 2020

@rcorces
Collaborator

@Meggie-MH - thanks for checking. We will update the dev branch with the fix from @jgranja24

@huidongchen - can you confirm which version of R you are using? Presumably >4.0?

huidongchen

huidongchen commented on Jun 25, 2020

@huidongchen

@huidongchen - can you confirm which version of R you are using? Presumably >4.0?

Thanks for your quick reply! Yes, I'm using R 4.0.1

xuzongren

xuzongren commented on Jun 28, 2020

@xuzongren
Author

@jgranja24 ,Thanks for your help!
@rcorces ,And I've run this function successfully,Using the function @jgranja24 wrote.
Thanks again for all your help! (I also use R 4.0.1)

liviuspenter

liviuspenter commented on Jul 8, 2020

@liviuspenter

I can confirm this problem. The fixed function worked for me and I am happy to have found the information in this thread!

My system:

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin19.5.0 (64-bit)

rcorces

rcorces commented on Jul 8, 2020

@rcorces
Collaborator

@jgranja24 can you make the relevant update(s) in dev? This gets rid of the project summary so if anything downstream uses the summary that will also need to change

ankushs0128

ankushs0128 commented on Aug 7, 2020

@ankushs0128

Facing the Same Issue on R 4.0.1! Running filterdoublet functions works well

Hi @Meggie-MH can you try running this filterDoublets function where we just remove the line causing the issue


filterDoublets <- function(ArchRProj = NULL, cutEnrich = 1, cutScore = -Inf, filterRatio = 1){

  fn <- unclass(lsf.str(envir = asNamespace("ArchR"), all = TRUE))
    for (i in seq_along(fn)) {
        tryCatch({
            eval(parse(text = paste0(fn[i], "<-ArchR:::", fn[i])))
        }, error = function(x) {
        })
    }

  .validInput(input = ArchRProj, name = "ArchRProj", valid = c("ArchRProj"))
  .validInput(input = cutEnrich, name = "cutEnrich", valid = c("numeric"))
  .validInput(input = cutScore, name = "cutScore", valid = c("numeric"))
  .validInput(input = filterRatio, name = "filterRatio", valid = c("numeric"))

  if(any(grepl("filterDoublets", names(ArchRProj@projectSummary)))){
    stop("Already ran filterDoublets on ArchRProject! Cannot be re-ran on an ArchRProject!")
  }

  df <- getCellColData(ArchRProj, c("Sample", "DoubletEnrichment", "DoubletScore"))
  splitDF <- split(seq_len(nrow(df)), as.character(df$Sample))

  cellsFilter <- lapply(splitDF, function(y){

    x <- df[y, ,drop = FALSE]

    n <- nrow(x)

    x <- x[order(x$DoubletEnrichment, decreasing = TRUE), ]
    
    if(!is.null(cutEnrich)){
      x <- x[which(x$DoubletEnrichment >= cutEnrich), ]
    } 
    
    if(!is.null(cutScore)){
      x <- x[which(x$DoubletScore >= cutScore), ]
    } 

    if(nrow(x) > 0){
      head(rownames(x), filterRatio * n * (n / 100000))
    }else{
      NULL
    }

  }) %>% unlist(use.names=FALSE)

  message("Filtering ", length(cellsFilter), " cells from ArchRProject!")
  tabRemove <- table(df[cellsFilter,]$Sample)
  tabAll <- table(df$Sample)
  samples <- unique(df$Sample)
  for(i in seq_along(samples)){
    if(!is.na(tabRemove[samples[i]])){
      message("\t", samples[i], " : ", tabRemove[samples[i]], " of ", tabAll[samples[i]], " (", round(100 * tabRemove[samples[i]] / tabAll[samples[i]], 1),"%)")
    }else{
      message("\t", samples[i], " : ", 0, " of ", tabAll[samples[i]], " (0%)")
    }
  }

  if(length(cellsFilter) > 0){
    
    ArchRProj@cellColData <- ArchRProj@cellColData[rownames(ArchRProj@cellColData) %ni% cellsFilter,,drop=FALSE]

  }
  
  ArchRProj

}
rcorces

rcorces commented on Aug 11, 2020

@rcorces
Collaborator

@jgranja24 - can you make this update on dev?

jgranja24

jgranja24 commented on Oct 15, 2020

@jgranja24
Contributor

This is now fixed on the release branch

devtools::install_github("GreenleafLab/ArchR", ref="release_1.0.0", repos = BiocManager::repositories())

Closing this issue, if you have any more troubles please open a new issue!

Best

Jeff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @rcorces@huidongchen@jgranja24@ankushs0128@xuzongren

      Issue actions

        Error in as.POSIXct.numeric(e) · Issue #217 · GreenleafLab/ArchR