broken chain import in liftOver
1
0
Entering edit mode
@jamesdalgleish-23638
Last seen 11 months ago
United States

I've been using liftover for years, but I've never encountered this error. Is there something wrong with my chain? I downloaded my chain from https://hgdownload.cse.ucsc.edu/goldenpath/hg19/liftOver/

 library(liftOver)
#Loading required package: gwascat
#Registered S3 methods overwritten by 'dbplyr':
 # method         from
 # print.tbl_lazy     
 # print.tbl_sql      
#gwascat loaded.  Use makeCurrentGwascat() to extract current image.
 #from EBI.  The data folder of this package has some legacy extracts.
#Loading required package: GenomicRanges
#Loading required package: stats4
#Loading required package: BiocGenerics

#Attaching package: ‘BiocGenerics’

#The following objects are masked from ‘package:stats’:

  #  IQR, mad, sd, var, xtabs

#The following objects are masked from ‘package:base’:

  #  anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
    #match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which.max, which.min

#Loading required package: S4Vectors

#Attaching package: ‘S4Vectors’

#The following objects are masked from ‘package:base’:

  #  expand.grid, I, unname

# Loading required package: IRanges

#Attaching package: ‘IRanges’

#The following object is masked from ‘package:grDevices’:

  #  windows

#Loading required package: GenomeInfoDb

#Attaching package: ‘GenomicRanges’

#The following object is masked from ‘package:magrittr’:

  #  subtract

#Loading required package: rtracklayer
#Loading required package: Homo.sapiens
#Loading required package: AnnotationDbi
#Loading required package: Biobase
#Welcome to Bioconductor

  #  Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")', and for packages 'citation("pkgname")'.

#Loading required package: OrganismDbi
#Loading required package: GenomicFeatures
#Loading required package: GO.db

#Loading required package: org.Hs.eg.db

#Loading required package: TxDb.Hsapiens.UCSC.hg19.knownGene
 library(rtracklayer)
 chain_file=rtracklayer::import.chain("hg19ToHg38.over.chain.gz")
#Error in .local(con, format, text, ...) : 
 # expected 11 elements in header, got 1, on line 1
 sessionInfo( )
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] liftOver_1.20.0                         Homo.sapiens_1.3.1                      TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2 org.Hs.eg.db_3.15.0                     GO.db_3.15.0                           
 [6] OrganismDbi_1.38.0                      GenomicFeatures_1.48.0                  AnnotationDbi_1.58.0                    Biobase_2.56.0                          rtracklayer_1.56.0                     
[11] GenomicRanges_1.48.0                    GenomeInfoDb_1.32.1                     IRanges_2.30.0                          S4Vectors_0.34.0                        BiocGenerics_0.42.0                    
[16] gwascat_2.28.0                          magrittr_2.0.3                         

loaded via a namespace (and not attached):
 [1] bitops_1.0-7                matrixStats_0.62.0          bit64_4.0.5                 filelock_1.0.2              progress_1.2.2              httr_1.4.3                  tools_4.2.0                
 [8] utf8_1.2.2                  R6_2.5.1                    DBI_1.1.2                   tidyselect_1.1.2            prettyunits_1.1.1           bit_4.0.4                   curl_4.3.2                 
[15] compiler_4.2.0              graph_1.74.0                cli_3.3.0                   xml2_1.3.3                  DelayedArray_0.22.0         readr_2.1.2                 RBGL_1.72.0                
[22] rappdirs_0.3.3              stringr_1.4.0               digest_0.6.29               Rsamtools_2.12.0            XVector_0.36.0              pkgconfig_2.0.3             MatrixGenerics_1.8.0       
[29] highr_0.9                   dbplyr_2.1.1                fastmap_1.1.0               BSgenome_1.64.0             rlang_1.0.2                 RSQLite_2.2.14              BiocIO_1.6.0               
[36] generics_0.1.2              BiocParallel_1.30.0         dplyr_1.0.9                 VariantAnnotation_1.42.0    RCurl_1.98-1.6              GenomeInfoDbData_1.2.8      Matrix_1.4-1               
[43] Rcpp_1.0.8.3                fansi_1.0.3                 lifecycle_1.0.1             stringi_1.7.6               yaml_2.3.5                  SummarizedExperiment_1.26.1 zlibbioc_1.42.0            
[50] BiocFileCache_2.4.0         grid_4.2.0                  blob_1.2.3                  parallel_4.2.0              snpStats_1.46.0             crayon_1.5.1                lattice_0.20-45            
[57] Biostrings_2.64.0           splines_4.2.0               hms_1.1.1                   KEGGREST_1.36.0             knitr_1.39                  pillar_1.7.0                rjson_0.2.21               
[64] biomaRt_2.52.0              XML_3.99-0.9                glue_1.6.2                  evaluate_0.15               data.table_1.14.2           BiocManager_1.30.17         png_0.1-7                  
[71] vctrs_0.4.1                 tzdb_0.3.0                  purrr_0.3.4                 tidyr_1.2.0                 assertthat_0.2.1            cachem_1.0.6                xfun_0.30                  
[78] restfulr_0.0.13             survival_3.3-1              tibble_3.1.7                GenomicAlignments_1.32.0    memoise_2.0.1               ellipsis_0.3.2
lifto liftOver • 2.0k views
ADD COMMENT
0
Entering edit mode

You could also try using one of the chain files in AnnotationHub, which gets auto-cached:

library(AnnotationHub)
query(ah <- AnnotationHub(), "hg19ToHg38")
ADD REPLY
2
Entering edit mode
@james-w-macdonald-5106
Last seen 16 hours ago
United States

You have to uncompress first:

> download.file("https://hgdownload.soe.ucsc.edu/gbdb/hg19/liftOver/hg19ToHg38.over.chain.gz", "hg19ToHg38.over.chain.gz")
trying URL 'https://hgdownload.soe.ucsc.edu/gbdb/hg19/liftOver/hg19ToHg38.over.chain.gz'
Content type 'application/x-gzip' length 227698 bytes (222 KB)
downloaded 222 KB

> system("gzip -d hg19ToHg38.over.chain.gz")
[1] 0
> import.chain("hg19ToHg38.over.chain.gz")
Error in .local(con, format, text, ...) : 
  expected 11 elements in header, got 1, on line 1
> z <- import.chain("hg19ToHg38.over.chain")
## success!
ADD COMMENT

Login before adding your answer.

Traffic: 867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6