Filtering output from tximport
1
0
Entering edit mode
Sheean • 0
@a1d6aa85
Last seen 3.0 years ago
United States

Hello,

I would like to filter the resulting txi file generated from tximport of Salmon files to exclude columns where there are >=4 0s in 'counts'.

I did: txi <-tximport(files, type = "salmon", txOut = TRUE)

this yields txi, a large list of 4 elements, where:

attributes(txi) $names [1] "abundance" "counts" "length" "countsFromAbundance"

I want to remove/exclude columns where there are >=4 0s in "counts." Counts are in columns 22-41.

To do this, I did:

txi_subset = txi[!rowSums(txi[, c(22:41)] == 0) >=4, ]

I get:

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'rowSums': incorrect number of dimensions

Any help would be appreciated. Thank you.

tximport Salmon • 1.8k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

You already acknowledged that your 'txi' object is a list, but then you tried to subset it as if it were a data.frame or a matrix.

ADD COMMENT
0
Entering edit mode

Right. Recommend tximeta package and function which will give a SummarizedExperiment.

Most users who want a Bioc-like object benefit from tximeta over tximport, the former calls the latter anyway.

coldata <- data.frame(
  files=c("/path/sample1/quant.sf",...), 
  names=c("s1",...), 
  condition=...
)
se <- tximeta(coldata)
ADD REPLY
0
Entering edit mode

Thanks, I'm not totally sure this will work to resolve the need to remove 0's. Regardless, I'm getting:

Error: lexical error: invalid char in json text. ./cmd_info.json (right here) ------^

I restarted R Studio and got the same error.

ADD REPLY
0
Entering edit mode

That error has been resolved by previous users here by using up to date package versions.

ADD REPLY

Login before adding your answer.

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