Dear all,
I have a data.frame that I want to convert to GRranges format. When I use the following command I am taking the following errors
suppressPackageStartupMessages(library(GenomicRanges))
bed <- data.frame(chrom=c(rep("Chr1",5)),
chromStart=c(18915152,24199229,73730,81430,89350),
chromEnd=c(18915034,24199347,74684,81550,89768),
strand=c("-","+","+","+","+"))
bed
#> chrom chromStart chromEnd strand
#> 1 Chr1 18915152 18915034 -
#> 2 Chr1 24199229 24199347 +
#> 3 Chr1 73730 74684 +
#> 4 Chr1 81430 81550 +
#> 5 Chr1 89350 89768 +
makeGRangesFromDataFrame(bed)
#> Error in .width_as_unnamed_integer(width, msg = "an end that is greater or equal to its start minus one"): each range must have an end that is greater or equal to its start minus
#> one
Created on 2022-08-01 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)
How do people deal with this? Do they flip the order of the " - " strand?
Any help or suggestion is welcome
I am using Genomation package within MethylKit and I am getting a similar error while using T2TCHM13v2.0/hs1 assembly. It worked well when I worked with NCBI RefSeq.bed file but showing the error "Error in .width_as_unnamed_integer(width, msg = "an end that is greater or equal to its start minus one") : each range must have an end that is greater or equal to its start minus one" when used with CAT/Liftoff Genes.bed file.
I also checked manually the start and end coordinates to confirm the start< end, which is perfectly fine. Is it something to do with the CAT/LiftOff Genes.bed file? I find this bed file useful as it has gene symbols rather than NCBI RefSeq IDs.
Below is the error:
gene.obj=readTranscriptFeatures(system.file("extdata","catLiftOffGenes_T2T_wholegene.bed", package = "methylKit")) Reading the table... Calculating intron coordinates...
Error in .width_as_unnamed_integer(width, msg = "an end that is greater or equal to its start minus one") : each range must have an end that is greater or equal to its start minus one
Please do not asking questions in existing threads, open a new question with the necessary details and a reproducible example.