rtracklayer::export empty score
1
0
Entering edit mode
@dinocolmillo-22425
Last seen 4.1 years ago

Hi, first question here

I'm trying to export a GRanges object with rtracklayer's function "export", but the gscores are all stored as 0 in the newly created file.

phast <-phastCons100way.UCSC.hg19
gs1 <- gscores(phast, GRanges(seqnames="chr22", IRanges(start=50967020:50967025, width=1)))
gs1
GRanges object with 6 ranges and 1 metadata column:
      seqnames    ranges strand |   default
         <Rle> <IRanges>  <Rle> | <numeric>
  [1]    chr22  50967020      * |         1
  [2]    chr22  50967021      * |         1
  [3]    chr22  50967022      * |       0.8
  [4]    chr22  50967023      * |         1
  [5]    chr22  50967024      * |         1
  [6]    chr22  50967025      * |         0

My GRanges object has gscores in "default", but then in the file they are at 0:

rtracklayer::export(gs1, "test.bed")

This is the content of the test.bed file:

chr22   50967019    50967020    .   0   .
chr22   50967020    50967021    .   0   .
chr22   50967021    50967022    .   0   .
chr22   50967022    50967023    .   0   .
chr22   50967023    50967024    .   0   .
chr22   50967024    50967025    .   0   .

Thanks

PD: my session info

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] rtracklayer_1.46.0              phastCons100way.UCSC.hg19_3.7.2 phastCons100way.UCSC.hg38_3.7.1
 [4] shiny_1.4.0                     GenomicScores_1.10.0            GenomicRanges_1.38.0           
 [7] GenomeInfoDb_1.22.0             IRanges_2.20.0                  S4Vectors_0.24.0               
[10] BiocGenerics_0.32.0            

loaded via a namespace (and not attached):
 [1] SummarizedExperiment_1.16.0   tidyselect_0.2.5              BiocVersion_3.10.1           
 [4] purrr_0.3.3                   lattice_0.20-38               vctrs_0.2.0                  
 [7] htmltools_0.4.0               BiocFileCache_1.10.2          yaml_2.2.0                   
[10] interactiveDisplayBase_1.24.0 blob_1.2.0                    XML_3.98-1.20                
[13] rlang_0.4.1                   pillar_1.4.2                  later_1.0.0                  
[16] glue_1.3.1                    DBI_1.0.0                     BiocParallel_1.20.0          
[19] rappdirs_0.3.1                bit64_0.9-7                   dbplyr_1.4.2                 
[22] matrixStats_0.55.0            GenomeInfoDbData_1.2.2        zlibbioc_1.32.0              
[25] Biostrings_2.54.0             memoise_1.1.0                 Biobase_2.46.0               
[28] fastmap_1.0.1                 httpuv_1.5.2                  curl_4.2                     
[31] AnnotationDbi_1.48.0          Rcpp_1.0.3                    xtable_1.8-4                 
[34] backports_1.1.5               promises_1.1.0                BSgenome_1.54.0              
[37] BiocManager_1.30.10           DelayedArray_0.12.0           jsonlite_1.6                 
[40] XVector_0.26.0                mime_0.7                      bit_1.1-14                   
[43] Rsamtools_2.2.1               AnnotationHub_2.18.0          digest_0.6.22                
[46] dplyr_0.8.3                   grid_3.6.0                    tools_3.6.0                  
[49] bitops_1.0-6                  magrittr_1.5                  RCurl_1.95-4.12              
[52] tibble_2.1.3                  RSQLite_2.1.2                 crayon_1.3.4                 
[55] pkgconfig_2.0.3               zeallot_0.1.0                 Matrix_1.2-17                
[58] assertthat_0.2.1              httr_1.4.1                    R6_2.4.1                     
[61] GenomicAlignments_1.22.1      compiler_3.6.0
rtracklayer • 837 views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States

The score column needs to be named "score".

ADD COMMENT
0
Entering edit mode

Thanks for your quick answer!

Since gscores() seems to return the scores under the colname of the selected population, I'm using this answer to make the export: https://www.biostars.org/p/89341/

ADD REPLY

Login before adding your answer.

Traffic: 882 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