thelovelab / fishpond

Differential expression and allelic analysis, nonparametric statistics
https://thelovelab.github.io/fishpond
27 stars 9 forks source link

Using loadFry for HTO quantifications #24

Closed jeremymsimon closed 2 years ago

jeremymsimon commented 2 years ago

Hi @DongzeHE and @mikelove - I'm currently working through this alevin-fry vignette for processing HTO/ADT data from 10X.

The tutorial was written I believe before loadFry was incorporated here into fishpond, and the authors include their own load_fry function for reading alevin-fry quantifications (RNA, ADT, HTO) into R.

I can load my RNA data just fine with fishpond::loadFry but I can't figure out how to load the HTO data that way, I get an error:

locating quant file
Reading meta data
USA mode: FALSE
Processing 10 genes and 10013 barcodes
Not in USA mode, ignore argument outputFormat
Constructing output SingleCellExperiment object
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'j' in selecting a method for function '[': error in evaluating the argument 'x' in selecting a method for function 'colSums': unable to find an inherited method for function 'assay' for signature '"SingleCellExperiment", "logical"'

But their load_fry function works fine for this, so it seems like the two functions have deviated somewhat.

Is there some parameter I can specify to fishpond::loadFry to properly load the HTO object? I've even tried a custom format specifying only "spliced" counts (since that's what their vignette suggests) but I get the same error.

Thanks!

DongzeHE commented 2 years ago

Hello @jeremymsimon,

Thanks so much for bringing this issue up! The function in the tutorial was a previous version of the fsihpond::loadFry() function. So they should do the same thing. If possible, could you please paste the command you used to call loadFry here? I need to figure out what causes this error. Thanks!

Dongze

jeremymsimon commented 2 years ago

Hi @DongzeHE -

hto_q <- load_fry('/path/to/HTO_quant_crlike')

dim(hto_q)
[1]    10 10013

counts(hto_q)[1:10,1:5]
10 x 5 sparse Matrix of class "dgTMatrix"
           GACCCTTTCGCTCCCA AGAACAACACATTGCA GTTTGGATCCTGAAAT GAATAGATCCTTCATG ACTGATGTCTCGCTAT
Hashtag_1                 .               13             5814               21                6
Hashtag_2              6154               18                3             5258                5
Hashtag_3                20                8                1                6                2
Hashtag_4                13             4774             4185                3             9450
Hashtag_5                 3               29                5                7                9
Hashtag_6                12                8                1                2                3
Hashtag_7              3267               10                5                4                2
Hashtag_8                 8               13                2                9                6
Hashtag_9                 4             5226                3             4734                1
Hashtag_10                1                6                6                1               14
hto_q <- fishpond::loadFry(fryDir='/path/to/HTO_quant_crlike')
locating quant file
Reading meta data
USA mode: FALSE
Processing 10 genes and 10013 barcodes
Not in USA mode, ignore argument outputFormat
Constructing output SingleCellExperiment object
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'j' in selecting a method for function '[': error in evaluating the argument 'x' in selecting a method for function 'colSums': unable to find an inherited method for function ‘assay’ for signature ‘"SingleCellExperiment", "logical"’
DongzeHE commented 2 years ago

Could you please reinstall fishpond from GitHub? This error might be caused by a previous bug in the code.

You can do

devtools::install_github("mikelove/fishpond", force = TRUE)

I am sorry for the inconvenience.

Dongze

jeremymsimon commented 2 years ago

Ah, yes - thanks! That did it! I guess I was using an outdated version.

mikelove commented 2 years ago

Thanks both. Will be released very soon 👍