mskilab-org / chromunity

Discovery of communities in Pore-C concatemers
11 stars 4 forks source link

`sliding_window_background` error with non-human chromunity object #18

Open hackkr opened 5 months ago

hackkr commented 5 months ago

Hello! I am encountering an error when I try to generate background bindsets. I'm wondering if it stems from the use of hg_seqlengths().

Here's several work arounds I tried.

> set.seed(198)
> back_gr = sliding_window_background(chromosome= "NC_017276.1", binsets = sw_this$binsets, n = 1000, resolution = 5e3)

Warning: NAs introduced by coercion
Generating distributions
|========================================================================| 100%, Elapsed 00:01
Generating GRanges
|                                                                        |   0%, ETA NA
Warning: all scheduled cores encountered errors in user code. Error in rbindlist(this.list, fill = TRUE) : 
Item 1 of input is not a data.frame, data.table or list

I tried supplying a forged a BSgenome for my organism. It is loaded in the environment.

> set.seed(198)
> back_gr = sliding_window_background(chromosome= "NC_017276.1", binsets = sw_this$binsets, n = 1000, resolution = 5e3, genome.to.use = Sis_REY15A)

Warning: NAs introduced by coercion Error in nchar(dbs) : no method for coercing this S4 class to a vector

setting genome to NULL as with sliding_window_chromunity() in #15 yields a slightly more informative error.

> back_gr = sliding_window_background(chromosome= "NC_017276.1", binsets = sw_this$binsets, n = 1000, resolution = 5e3, genome.to.use = NULL)

Warning: NAs introduced by coercionWarning: hg_seqlengths: supply genome seqlengths or set default with env variable DEFAULT_GENOME (e.g. Sys.setenv(DEFAULT_GENOME = "BSgenome.Hsapiens.UCSC.hg19::Hsapiens").  DEFAULT_BSGENOME can also be set to a path or URL of a tab delimited text *.chrom.sizes fileGenerating distributions
|========================================================================|| 100%, Elapsed 00:01
Generating GRanges
|                                                                        |   0%, ETA NA
Warning: all scheduled cores encountered errors in user codeError in rbindlist(this.list, fill = TRUE) : 
  Item 1 of input is not a data.frame, data.table or list

setting DEFAULT_GENOME to my forged genome does not resolve it. I also tried passing along the seqlengths(Sis_REY15A) output as a list. Both returned the error Item 1 of input is not a data.frame, data.table or list

hackkr commented 4 months ago

Hi! Just wanted to follow up with this issue.

jameson-orvis commented 4 months ago

Hi! Sorry for the wait. Similarly to sliding_window_chromunity function you should be able to pass in NULL for the genome argument and it should work. Try pulling the latest changes and let me know if it works for you.

hackkr commented 3 months ago

Hello,

Sorry my the delayed response! Thanks for working on this issue. I just tried pulling the most recent commits from either the master or non-standard-genomes-branch and running my code again, and I am still encountering the same error.

>set.seed(198)
>back_gr = sliding_window_background(chromosome= "NC_017276.1", binsets = sw_this$binsets, resolution = 5e4)

Warning: NAs introduced by coercionGenerating distributions
  |==================================================================| 100%, Elapsed 00:01
Generating GRanges
  |                                                                  |   0%, ETA NA
Warning: all scheduled cores encountered errors in user codeError in rbindlist(this.list, fill = TRUE) : Item 1 of input is not a data.frame, data.table or list

traceback:

Error in rbindlist(this.list, fill = TRUE) : Item 1 of input is not a data.frame, data.table or list
2. rbindlist(this.list, fill = TRUE)
1. sliding_window_background(chromosome = "NC_017276.1", binsets = sw_this$binsets, resolution = 50000)