0
$\begingroup$

I am using RStudio Cloud for running velocyto R package. So I have tried to import velocyto file from http://pklab.med.harvard.edu/velocyto/mouseBM/SCG71.loom

I tried to upload that like so

enter image description here

But saying

> SCG71 <- read.table("/cloud/project/SCG71.loom", header=TRUE, quote="\"")
Error in make.names(col.names, unique = TRUE) : 
  invalid multibyte string at '<89>HDF'
In addition: There were 19 warnings (use warnings() to see them)

Can you help me in very initial of velocyto R?

$\endgroup$

2 Answers 2

1
$\begingroup$

This seems to be an encoding problem (certain characters not being recognized), see this, this and also this. Probably the file "/cloud/project/SCG71.loom" is encoded with a format that is not included in your "locale".

Check the output of Sys.getlocale() and see if your input file's encoding is listed. If not, you will need to try something like Sys.setlocale("LC_CTYPE", "en_US.UTF-8") or Sys.setlocale("LC_ALL", "English") (see the third link for details).

$\endgroup$
4
  • $\begingroup$ Thank you, says > Sys.getlocale() [1] "LC_CTYPE=C.UTF-8;LC_NUMERIC=C;LC_TIME=C.UTF-8;LC_COLLATE=C.UTF-8;LC_MONETARY=C.UTF-8;LC_MESSAGES=C.UTF-8;LC_PAPER=C.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C.UTF-8;LC_IDENTIFICATION=C" > $\endgroup$
    – Zizogolu
    Commented Nov 17, 2019 at 21:52
  • $\begingroup$ Did you try Sys.setlocale("LC_CTYPE", "en_US.UTF-8") $\endgroup$
    – haci
    Commented Nov 17, 2019 at 22:11
  • $\begingroup$ Thank you, > Sys.setlocale("LC_CTYPE", "en_US.UTF-8") [1] "en_US.UTF-8" $\endgroup$
    – Zizogolu
    Commented Nov 17, 2019 at 22:27
  • $\begingroup$ But are you getting the same error after setting the locale with Sys.setlocale()? Please don't just run commands and report the output but try to make sense of these. There is quite some information and workarounds to problems like yours in the links I provided. $\endgroup$
    – haci
    Commented Nov 18, 2019 at 7:02
1
$\begingroup$

Velocyto.R

I'm not sure that your issues is from RStudio cloud but more about how you are trying to open the file. The file that you are trying to import is not a velocyto file but a .loom file that can be open using the velocyto.R package.

I'm not very familiar with this kind of of .loom file but on the velocyto.R tutorial, it is specified to do the following:

library(velocyto.R)
ldat <- read.loom.matrices("SCG71.loom")

And you have the following file structures:

> str(ldat)
List of 3
 $ spliced  :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. ..@ i       : int [1:2822201] 74 130 178 192 202 223 225 258 353 418 ...
  .. ..@ p       : int [1:6668] 0 464 786 1469 2502 3290 3760 4974 5388 5659 ...
  .. ..@ Dim     : int [1:2] 24421 6667
  .. ..@ Dimnames:List of 2
  .. .. ..$ : chr [1:24421] "Xkr4" "Rp1" "Sox17" "Mrpl15" ...
  .. .. ..$ : chr [1:6667] "SCG71:AAACGATCCTACTTGT" "SCG71:AAACACTACGTAGAAG" "SCG71:AAACACGGCATCGCAG" "SCG71:AAACAAACAGCAGAAC" ...
  .. ..@ x       : num [1:2822201] 1 1 1 1 1 1 1 1 1 4 ...
  .. ..@ factors : list()
 $ unspliced:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. ..@ i       : int [1:528048] 61 100 339 352 377 445 465 528 617 758 ...
  .. ..@ p       : int [1:6668] 0 115 188 283 431 580 696 994 1127 1232 ...
  .. ..@ Dim     : int [1:2] 24421 6667
  .. ..@ Dimnames:List of 2
  .. .. ..$ : chr [1:24421] "Xkr4" "Rp1" "Sox17" "Mrpl15" ...
  .. .. ..$ : chr [1:6667] "SCG71:AAACGATCCTACTTGT" "SCG71:AAACACTACGTAGAAG" "SCG71:AAACACGGCATCGCAG" "SCG71:AAACAAACAGCAGAAC" ...
  .. ..@ x       : num [1:528048] 1 3 1 1 1 1 1 1 1 1 ...
  .. ..@ factors : list()
 $ ambiguous:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. ..@ i       : int [1:47846] 11915 13649 13830 15638 18068 19585 23490 24345 8142 8767 ...
  .. ..@ p       : int [1:6668] 0 8 13 25 42 56 64 87 97 100 ...
  .. ..@ Dim     : int [1:2] 24421 6667
  .. ..@ Dimnames:List of 2
  .. .. ..$ : chr [1:24421] "Xkr4" "Rp1" "Sox17" "Mrpl15" ...
  .. .. ..$ : chr [1:6667] "SCG71:AAACGATCCTACTTGT" "SCG71:AAACACTACGTAGAAG" "SCG71:AAACACGGCATCGCAG" "SCG71:AAACAAACAGCAGAAC" ...
  .. ..@ x       : num [1:47846] 2 1 1 1 1 2 1 2 1 1 ...
  .. ..@ factors : list()

Alternative 1 - LoomExperiment

On bioconductor, you can also find LoomExperiment. On my computer, once I get it install, I was able to load your SCG71.loom file using:

library(LoomExperiment)
scle <- import("SCG71.loom",type = "LoomExperiment", rownames_attr = NULL, colnames_attr = NULL)

Then, you can find the output here:

> head(scle)
class: LoomExperiment 
dim: 6 6667 
metadata(4): chunks creation_date velocyto.__version__ velocyto.logic
assays(4): matrix ambiguous spliced unspliced
rownames: NULL
rowData names(6): Accession Chromosome ... Start Strand
colnames: NULL
colData names(1): CellID
rowGraphs(0): NULL
colGraphs(0): NULL

You can then load some data

> scle$CellID[c(1:5)]
[1] "SCG71:AAACGATCCTACTTGT" "SCG71:AAACACTACGTAGAAG" "SCG71:AAACACGGCATCGCAG"
[4] "SCG71:AAACAAACAGCAGAAC" "SCG71:AAACAAACTTTGGGAG"

After that, I don't know what to do with that but I think your issue of importing a datafile is because you don't have the right package to open it.

Alternative - using LoomR

Alternatively, you can also install the package loomR and then enter:

library(loomR)
lfile = connect(filename = "SCG71.loom", mode = "r+")

And you get the output:

> lfile
Class: loom
Filename: /***my_directory***/SCG71.loom
Access type: H5F_ACC_RDWR
Attributes: creation_date, chunks, velocyto.__version__, velocyto.logic, version
Listing:
       name    obj_type dataset.dims dataset.type_class
  col_attrs   H5I_GROUP         <NA>               <NA>
 col_graphs   H5I_GROUP         <NA>               <NA>
     layers   H5I_GROUP         <NA>               <NA>
     matrix H5I_DATASET 6667 x 24421          H5T_FLOAT
  row_attrs   H5I_GROUP         <NA>               <NA>
 row_graphs   H5I_GROUP         <NA>               <NA>

Then, for manipulating these files, you should refer to their tutorial (it's beyond my skills and the scope of your question).

Hope it helps you to figure the solution of your question

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.