Error using tximport on Salmon with sparseMatrix on scaledTPM option
1
0
Entering edit mode
noorpratap • 0
@noorpratap-15054
Last seen 8 months ago

I am trying to import the Salmon quantified transcripts with the following code snippet by using scaledTPM option and returning a sparseMatrix:

 txiSalmon <- tximport(files, type = "salmon", tx2gene = annFile, countsFromAbundance = "scaledTPM", txOut=T, sparse = T)


However, I get the following error:

invalid class “dgTMatrix” object: length(Dimnames[1]) differs from Dim[1]


Looking at the source code, I find that dims parameter has not been set for the if condition checking scaledTPM when creating the sparseMatrix. https://github.com/mikelove/tximport/blob/master/R/tximport.R#L556. Hopefully, that is the only reason it is failing. Setting, the above parameter in the locally downloaded code from the github repository seems to make the above code snippet work for me.

tximport Salmon sparse • 212 views
2
Entering edit mode
@mikelove
Last seen 1 day ago
United States

Thanks for the report, I've updated the code at mikelove/tximport so you can pull that version with devtools::install_github() now (1.17.1).

There was actually a unit test for sparse=TRUE and countsFromAbundance="scaledTPM", but the error only showed up if the last file or last gene did not contain a positive count I believe.

0
Entering edit mode

I pushed to 1.16.1 as well (should show up in 1-2 days).

0
Entering edit mode

Yes it had a zero count. Thanks for the update though.