How to filter out low read counts
1
0
Entering edit mode
@annkolman78-21980
Last seen 4.5 years ago

Hi,

I have my data in a SummarizedExperiment format. I would like to filter out reads that have less than 1 read count (exp_count<1)

data

  data class: RangedSummarizedExperiment 
    dim: 56756 100 
    metadata(0):
    assays(10): exp_count TPM ...
      FPKM
      FPKM_CO
    rownames(57736): ENSG00000000003
      ENSG00000000005 ... ENSG00000273492
      ENSG00000273493
    rowData names(9): gene hgncl ...
     colnames(100): 1 1 ...
      99 100
    colData names(13): ID SAMPLE

I have tried:

data_matrix <- data@assays[[1]]
data_filtered <- data_matrix[rowSums(count(data_matrix))>1,]

but got an error:

Error in count(data_matrix) : 
  Argument 'x' must be a vector: numeric

and

data_filtered <- data[rowSums(count(data@assays[[1]]))>1,]

Error in count(data@assays[[1]]) : 
  Argument 'x' must be a vector: numeric

Thank you.

summarizedExperiment • 1.3k views
ADD COMMENT
0
Entering edit mode

Please NEVER use direct slot access @ and instead use accessors, assay() or assays(data)[[1]].

ADD REPLY
0
Entering edit mode

Hi,

Thank you for your reply. I have modified it. What is the reason? But, unfortunatelly it didn't solve the problem.

Thank you

ADD REPLY
0
Entering edit mode

'Accessors' define how the object is to be manipulated by the user, allowing the developer to chose representations that are efficient for them. For instance, in the Biostrings package

> dna = Biostrings::DNAStringSet("AA")
> dna@<tab>
dna@elementMetadata dna@metadata        dna@ranges
dna@elementType     dna@pool

there is no obvious relationship between operations the user might like to perform and the slots used by the developer to represent the data.

ADD REPLY
1
Entering edit mode
@martin-morgan-1513
Last seen 4 weeks ago
United States

Note that assays(data)[["exp_count"]] is a matrix, so perhaps you are interested in

keep <- rowSums(assays(data)[["exp_count"]]) > 1
data_filtered <- data[keep,]
ADD COMMENT
0
Entering edit mode

Thank you for your answer, I run it and got this error:

Error in assay(data)[["exp_count"]] : 
  subscript out of bounds
ADD REPLY
0
Entering edit mode

updated assay() --> assays()

ADD REPLY
0
Entering edit mode

It is working thank you very much!

ADD REPLY

Login before adding your answer.

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