EricSDavis / hictoolsr

An R package with a collection of useful tools for Hi-C data analysis.
https://EricSDavis.github.io/hictoolsr
8 stars 3 forks source link

extractCounts function returning empty outputs (chrom name issue) #3

Open ksmetz opened 3 years ago

ksmetz commented 3 years ago

When using extractCounts() to pull from a bedpe file (read in as a data.frame and converted to a GInteractions object with as_ginteractions()), the resulting object contained no rows.

This turned out to be an issue with the chromosome names - in the loop bedpe file used they were listed as 1, 2, etc. However this portion of the extractCounts() function requires that they be in "chr1", "chr2" format:

## Split binned binnedEP by chromosome
  chrBedpe <- lapply(chroms, function(chr) {
    bedpe[seqnames(first(bedpe)) == paste0('chr',chr)]
  })

Simply pasting "chr" before the chromosomes in the original bedpe object fixed this issue!