morinlab / GAMBLR

Set of standardized functions to operate with genomic data
https://morinlab.github.io/GAMBLR/
MIT License
3 stars 2 forks source link

Issue with rtracklayer specific to R4 #58

Closed Kdreval closed 2 years ago

Kdreval commented 2 years ago

The liftover_bedpe function gives an error that occurs only in R version 4 (not R3.6):

> hg19_sv <- get_manta_sv() %>% head(20)
> hg38_sv <- liftover_bedpe(bedpe_df = hg19_sv, target_build="hg38")
  CHROM_A  START_A    END_A CHROM_B  START_B    END_B NAME SOMATIC_SCORE STRAND_A STRAND_B TYPE FILTER VAF_tumour
1    chr1  1556541  1556547    chr1  1556664  1556670    .            40        -        -  BND   PASS          0
2    chr1  6012725  6012732    chr1  6012825  6012832    .            48        +        +  BND   PASS          0
3    chr1  8464072  8464090    chr1  8464293  8464311    .            40        +        +  BND   PASS          0
4    chr1 10084099 10084251    chr1 10084266 10084411    .            48        -        -  BND   PASS          0
5    chr1 10526162 10526172    chr1 10526290 10526300    .            40        -        -  BND   PASS          0
6    chr1 15878430 15878436    chr1 15878608 15878614    .            40        +        +  BND   PASS          0
  VAF_normal DP_tumour DP_normal tumour_sample_id normal_sample_id pair_status
1          0        55        73  00-14595_tumorA  00-14595_normal     matched
2          0        32        85  00-14595_tumorA  00-14595_normal     matched
3          0       215        84  00-14595_tumorA  00-14595_normal     matched
4          0        43        50  00-14595_tumorA  00-14595_normal     matched
5          0       121        92  00-14595_tumorA  00-14595_normal     matched
6          0       126       101  00-14595_tumorA  00-14595_normal     matched
Error: 'chr1    1621161 1621167 .   0   -   1621161 1621167 0   1   6   0' does not exist in current working directory ('/projects/rmorin/projects/gambl-repos/gambl-kdreval').
In addition: Warning message:
In if (!grepl("chr", original_bedpe$CHROM_A)) { :
  the condition has length > 1 and only the first element will be used

@mattssca tracked it down to the rtracklayer issue with this line:

bedpe_obj = rtracklayer::import(text = char_vec, format = "bed")

The solution needs to ensure functionality is maintained both in R3.6 and R4.

rdmorin commented 2 years ago

Is this a situation where I fixed a bug when we upped R versions and created a bug by doing so?

Kdreval commented 2 years ago

I don't think so - that error was reported by Helena in August with exact same error, but you and me both did not reproduce it at that time. Today, this error came up again - and I reproduced it in R4, but not in R3.6. I think this is a difference in the version of one of the rtracklayer's dependencies