rowRanges in Summarized Experiment changes counts
1
1
Entering edit mode
krc3004 ▴ 10
@krc3004-12978
Last seen 6.5 years ago

Hi all,

First post here, so apologies if I haven't explained anything clearly/followed standard guidelines.

I'd like to create a summarized experiment object for downstream analysis of my count data from RNA seq analysis.  The way I do this is something like this:

rna_raw_counts_no_tech_rep_ordered.se <- SummarizedExperiment(list(rna_raw_counts_no_tech_rep_ordered), rowRanges = exons.genes)

Where rna_raw_counts_no_tech_rep_ordered is my table of raw counts across all samples.  exons.genes is a GRanges list which looks like this (one example gene; this contains ranges for the whole genome of interest):

$00R_Pgap2 
GRanges object with 5 ranges and 0 metadata columns:
      seqnames                 ranges strand
  [1]     chr7 [102235854, 102235872]      +
  [2]     chr7 [102236094, 102236346]      +
  [3]     chr7 [102236448, 102236542]      +
  [4]     chr7 [102237122, 102237230]      +
  [5]     chr7 [102237401, 102237530]      +

 

However, I notice that when I add the rowRanges argument to the SummarizedExperiment function as shown above, my counts across all samples change!  When it isn't included, the counts stay the same as what's in the raw count table.  I can access the counts like this:

assaysrna_raw_counts_no_tech_rep_ordered.se)[[1]]["00R_Pgap2 ",]

Has anyone come across an error like this?  Thanks very much for your help!

deseq2 summarizedexperiment rangedsummarizedexperiment rnaseq • 1.4k views
ADD COMMENT
0
Entering edit mode

Can you provide a reproducible example? For instance, I hae

> library(SummarizedExperiment)
> m <- matrix(1:4, 2, dimnames=list(letters[1:2], NULL))
> rowRanges <- GRanges("chr1", IRanges(1:2, 3, names=letters[1:2]))
> assay(SummarizedExperiment(list(m), rowRanges=rowRanges))
  [,1] [,2]
a    1    3
b    2    4

Also, it's important to make sure we're using current software, so I have

> sessionInfo()
R version 3.4.0 Patched (2017-05-04 r72654)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

Matrix products: default
BLAS: /home/mtmorgan/bin/R-3-4-branch/lib/libRblas.so
LAPACK: /home/mtmorgan/bin/R-3-4-branch/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] SummarizedExperiment_1.6.1 DelayedArray_0.2.0        
[3] matrixStats_0.52.2         Biobase_2.36.1            
[5] GenomicRanges_1.28.1       GenomeInfoDb_1.12.0       
[7] IRanges_2.10.0             S4Vectors_0.14.0          
[9] BiocGenerics_0.22.0       

loaded via a namespace (and not attached):
 [1] lattice_0.20-35         bitops_1.0-6            grid_3.4.0             
 [4] zlibbioc_1.22.0         XVector_0.16.0          Matrix_1.2-10          
 [7] tools_3.4.0             RCurl_1.95-4.8          compiler_3.4.0         
[10] GenomeInfoDbData_0.99.0
ADD REPLY
0
Entering edit mode
krc3004 ▴ 10
@krc3004-12978
Last seen 6.5 years ago

Never mind!  Silly mistake on my part- the names in exons.genes weren't in the same order as the row names in rna_raw_counts_no_tech_rep_ordered, so things got jumbled, not changed.  Fixed the order and everything looks good. 

ADD COMMENT

Login before adding your answer.

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