cellgeni / sceasy

A package to help convert different single-cell data formats to each other
GNU General Public License v3.0
363 stars 53 forks source link

convert to loom from sce error #2

Closed SimonDMurray closed 4 years ago

SimonDMurray commented 4 years ago

This is your SCE data

> sce
class: SingleCellExperiment 
dim: 230 80 
metadata(0):
assays(2): counts logcounts
rownames(230): MS4A1 CD79B ... SPON2 S100B
rowData names(5): vst.mean vst.variance vst.variance.expected vst.variance.standardized vst.variable
colnames(80): ATGCCAGAACGACT CATGGCCTGTGCAT ... GGAACACTTCAGAC CTTGATTGATCTTC
colData names(8): orig.ident nCount_RNA ... RNA_snn_res.1 ident
reducedDimNames(2): PCA TSNE
spikeNames(0):

This is my sce data

> seur_sce
class: SingleCellExperiment 
dim: 31053 1011 
metadata(0):
assays(2): counts logcounts
rownames(31053): Xkr4 Gm1992 ... Vmn2r122 CAAA01147332.1
rowData names(0):
colnames(1011): AAACCCACACCAGTAT-1 AAACCCAGTCACCTTC-1 ... TTTGTTGGTGTCATTG-1 TTTGTTGTCCGCAACG-1
colData names(4): orig.ident nCount_RNA nFeature_RNA ident
reducedDimNames(0):
spikeNames(0):

When i run the line

sce_loom <- sceasy:::convertFormat(seur_sce, from="sce", to="loom", outFile='/Users/sm42/Sceasy/Test/sce_loom_data.loom')

This error is produced

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘NSBS’ for signature ‘"list"’

i have attached my file im trying to use seur_sce_data.rds.zip

nh3 commented 4 years ago

It's due to your object has a rowData table with 0 column. I've added code to handle this by automatically adding the rownames as a column if 0 column is detected.

SimonDMurray commented 4 years ago

I tried to install the updated version on Rstudio using

devtools::install_github('cellgeni/sceasy', ref = "v0.0.4")

and it still only downloaded version 0.01

Downloading GitHub repo cellgeni/sceasy@v0.0.4
Skipping 2 packages not available: SingleCellExperiment, LoomExperiment
✔  checking for file ‘/private/var/folders/7d/kyg4qyys7f54fsb1ng8jbxh4000lcq/T/RtmpfrjuCb/remotes42a95514ef2f/cellgeni-sceasy-2caaff4/DESCRIPTION’ ...
─  preparing ‘sceasy’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘sceasy_0.0.1.tar.gz’

Installing package into ‘/Users/sm42/Library/R/3.6/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘sceasy’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
No man pages found in package  ‘sceasy’ 
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sceasy)

and so the same error still arose

nh3 commented 4 years ago

The latest modifications are in master, so please try ref="master".

And, building ‘sceasy_0.0.1.tar.gz has nothing to do with the actual version. It was building v0.0.4 which doesn't contain the latest fixes.

SimonDMurray commented 4 years ago

Thanks for all the help, only one function not working now. When trying to convert loom to anndata

#loom2anndata
loom_ann <- sceasy:::convertFormat('/Users/sm42/Sceasy/Test/sce_loom_data.loom', from="loom", to="anndata", outFile='/Users/sm42/Sceasy/Test/loom_ann_data.h5ad')

This error appears

Error in py_call_impl(callable, dots$args, dots$keywords) : KeyError: "Unable to open object (object 'attrs' doesn't exist)"

using this data sce_loom_data.loom.zip even though converting loom to sce works using same data

nh3 commented 4 years ago

It works for me. Can you paste your relevant R and python module versions?

SimonDMurray commented 4 years ago

R version 3.6.1 on R studio and python 3.7 via anaconda

nh3 commented 4 years ago

I meant things like reticulate, anndata, loompy etc.

SimonDMurray commented 4 years ago

My session info is:

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

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

other attached packages:
 [1] R.methodsS3_1.7.1           sceasy_0.0.1                reticulate_1.13             hdf5r_1.3.0                
 [5] Seurat_3.1.1                LoomExperiment_1.2.0        rtracklayer_1.44.4          rhdf5_2.28.0               
 [9] SingleCellExperiment_1.6.0  SummarizedExperiment_1.14.1 DelayedArray_0.10.0         BiocParallel_1.18.1        
[13] matrixStats_0.55.0          Biobase_2.44.0              GenomicRanges_1.36.1        GenomeInfoDb_1.20.0        
[17] IRanges_2.18.3              S4Vectors_0.22.1            BiocGenerics_0.30.0        

loaded via a namespace (and not attached):
  [1] Rtsne_0.15               colorspace_1.4-1         ggridges_0.5.1           XVector_0.24.0           rstudioapi_0.10         
  [6] leiden_0.3.1             listenv_0.7.0            npsurv_0.4-0             bit64_0.9-7              ggrepel_0.8.1           
 [11] codetools_0.2-16         splines_3.6.1            lsei_1.2-0               knitr_1.25               zeallot_0.1.0           
 [16] jsonlite_1.6             Rsamtools_2.0.2          ica_1.0-2                cluster_2.1.0            png_0.1-7               
 [21] R.oo_1.22.0              uwot_0.1.4               HDF5Array_1.12.2         sctransform_0.2.0        compiler_3.6.1          
 [26] httr_1.4.1               backports_1.1.5          assertthat_0.2.1         Matrix_1.2-17            lazyeval_0.2.2          
 [31] htmltools_0.4.0          tools_3.6.1              rsvd_1.0.2               igraph_1.2.4.1           gtable_0.3.0            
 [36] glue_1.3.1               GenomeInfoDbData_1.2.1   RANN_2.6.1               reshape2_1.4.3           dplyr_0.8.3             
 [41] Rcpp_1.0.2               vctrs_0.2.0              Biostrings_2.52.0        gdata_2.18.0             ape_5.3                 
 [46] nlme_3.1-141             gbRd_0.4-11              lmtest_0.9-37            xfun_0.10                stringr_1.4.0           
 [51] globals_0.12.4           lifecycle_0.1.0          irlba_2.3.3              gtools_3.8.1             XML_3.98-1.20           
 [56] future_1.14.0            zlibbioc_1.30.0          MASS_7.3-51.4            zoo_1.8-6                scales_1.0.0            
 [61] RColorBrewer_1.1-2       pbapply_1.4-2            gridExtra_2.3            ggplot2_3.2.1            stringi_1.4.3           
 [66] caTools_1.17.1.2         bibtex_0.4.2             Rdpack_0.11-0            SDMTools_1.1-221.1       rlang_0.4.0             
 [71] pkgconfig_2.0.3          bitops_1.0-6             lattice_0.20-38          ROCR_1.0-7               purrr_0.3.2             
 [76] Rhdf5lib_1.6.1           GenomicAlignments_1.20.1 htmlwidgets_1.5.1        bit_1.1-14               cowplot_1.0.0           
 [81] tidyselect_0.2.5         RcppAnnoy_0.0.13         plyr_1.8.4               magrittr_1.5             R6_2.4.0                
 [86] gplots_3.0.1.1           pillar_1.4.2             fitdistrplus_1.0-14      survival_2.44-1.1        RCurl_1.95-4.12         
 [91] tsne_0.1-3               tibble_2.1.3             future.apply_1.3.0       crayon_1.3.4             KernSmooth_2.23-15      
 [96] plotly_4.9.0             grid_3.6.1               data.table_1.12.4        metap_1.1                digest_0.6.21           
[101] tidyr_1.0.0              R.utils_2.9.0            RcppParallel_4.4.4       munsell_0.5.0            viridisLite_0.3.0 

My loompy version is loompy-3.0.6 and anndata is anndata-0.6.22.post1 natsort-6.0.0

SimonDMurray commented 4 years ago

I accidentally closed the issue? Did you get my last message?

nh3 commented 4 years ago

loompy-3.0.6 is not going to work. You need loompy=2.x. You might also need anndata<0.6.20.

SimonDMurray commented 4 years ago

I changed all the versions and same error still appeared. I checked my attrs version and it is 19.1.0, is this a correct version?

nh3 commented 4 years ago

Turns out this is solved by pointing the r-studio copy of reticulate to use the correct conda environment (hence the correct version of loompy and anndata).