<p><em>Answer from StupidWolf, converted from comment:</em></p>
<p>There is a function call Read10X in seurat, you can see how to use it with the example in <a href="https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/rkit" rel="nofollow noreferrer">https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/rkit</a></p>
<p>You place the three files into a directory / folder, then you specify Read10X()... hey how big is your data? you might need to run this on a machine with enough RAM.</p>
<p>You can try downloading the data following instructions here:</p>
<p><a href="https://satijalab.org/seurat/v3.1/pbmc3k_tutorial.html" rel="nofollow noreferrer">https://satijalab.org/seurat/v3.1/pbmc3k_tutorial.html</a></p>

CC BY-SA 4.0
2021-05-07T09:59:12.273Z
2021-05-07T09:59:12.273Z
gringer
<p>Have a look here and the entire tutorial:</p>
<p><a href="https://github.com/hbctraining/scRNA-seq/blob/master/lessons/03_SC_quality_control-setup.md" rel="nofollow noreferrer">https://github.com/hbctraining/scRNA-seq/blob/master/lessons/03_SC_quality_control-setup.md</a></p>

CC BY-SA 4.0
2021-03-09T02:03:12.823Z
2021-03-09T02:03:12.823Z
Endo
<p>To convert data from one format into another, you may find some software tool sometimes. But mostly no such tool can be found to satisfy all the requirements that we want.</p>
<p>In such situations, I recommend that you write a C program that reads data from the input file and writes it into the output file. In this way, you have complete flexibility so that you can determine the exact output format and what part of data to ignore or include. To do that, you should be familiar with some concepts in C language such as arrays, loops, strings, and file operations.</p>
<p>For an example of such conversions, you can get ideas from the following page:
<a href="https://stackoverflow.com/questions/55347322/c-program-to-convert-a-text-file-into-a-csv-file">https://stackoverflow.com/questions/55347322/c-program-to-convert-a-text-file-into-a-csv-file</a></p>
<p>Of course, such a converter program can be written in other languages too such as C# and Python.</p>
<p>The program can be developed in R language too. You need to be familiar with import functions, loops, strings, and arrays in this language.</p>
<p>We cannot expect that custom tools exist for all our file convertions. Every bioinformatician must be skilled in a standard programming language such as C, C#, Java, Python, or R. Then, he/she will be able to develop any custom program that reads an input file and generates a custom output file.</p>

CC BY-SA 4.0
2020-04-10T16:58:44.257Z
It's a rather onerous workaround to write C programs as interfaces between R packages and data (R generally has excellent data import functionality).
Maximilian Press
CC BY-SA 4.0
2020-04-09T07:26:02.033Z
2021-05-07T10:04:32.803Z
2021-05-07T10:04:32.803Z
A A Khodaparast
<p>I will have some scRNA-seq data. The goal of the experiment will be to see if there is any difference in gene expression between treatment groups using the package Seurat from R.</p>
<p>I have read a tutorial how to do the analyze, but this tutorial does not explain how to import data.
I am a total beginner with R, I searched the internet,but the majority of the explanations related to csv/excel/txt... common files.
Data are from Cell ranger and spread in 3 files with following file extensions : .tsv and .mtx (barcodes.tsv, genes.tsv and matrix.mtx).</p>
<p>Collaborators ran Cell Ranger and gave these cell ranger output files : <code>barcodes.tsv</code>, <code>genes.tsv</code> and <code>matrix.mtx</code>.</p>
<p>Can someone give me the code to import these kind of data to R ?</p>
<p>Thank you in advance.</p>
<p>update: By &quot;directory&quot; you means &quot;folder&quot; on my computer for example ? So I need to save the 3 files under one folder and then to put name of the folder into brackets after the Read10x function ? I am a total beginner with R (I have used to R commander for statistical tests but that's it...).</p>
<p>update 2: I successed to import data into Seurat with the explanation of StupidWolf. I do not know C language ( I do not know almost any language ..). My system crashed a little further in the analyze after importing, not enough RAM... so now I am learning Linux commands to switch on the cluster.</p>

<r><scrnaseq><seurat>
How to import data from cell ranger to R (Seurat)?
# How to import data from cell ranger to R (Seurat)?

(Asked by: username_0 on 2020-04-07)

I will have some scRNA-seq data. The goal of the experiment will be to see if there is any difference in gene expression between treatment groups using the package Seurat from R.

I have read a tutorial how to do the analyze, but this tutorial does not explain how to import data.
I am a total beginner with R, I searched the internet,but the majority of the explanations related to csv/excel/txt... common files.
Data are from Cell ranger and spread in 3 files with following file extensions : .tsv and .mtx (barcodes.tsv, genes.tsv and matrix.mtx).

Collaborators ran Cell Ranger and gave these cell ranger output files : `barcodes.tsv`, `genes.tsv` and `matrix.mtx`.

Can someone give me the code to import these kind of data to R ?

Thank you in advance.

update: By "directory" you means "folder" on my computer for example ? So I need to save the 3 files under one folder and then to put name of the folder into brackets after the Read10x function ? I am a total beginner with R (I have used to R commander for statistical tests but that's it...).

update 2: I successed to import data into Seurat with the explanation of StupidWolf. I do not know C language ( I do not know almost any language ..). My system crashed a little further in the analyze after importing, not enough RAM... so now I am learning Linux commands to switch on the cluster.

**Tags:** r, scrnaseq, seurat

---

## 3 answers

### Answer by username_1 on 2021-05-07. Score: 3

*Answer from StupidWolf, converted from comment:*

There is a function call Read10X in seurat, you can see how to use it with the example in <https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/rkit>

You place the three files into a directory / folder, then you specify Read10X()... hey how big is your data? you might need to run this on a machine with enough RAM.

You can try downloading the data following instructions here:

<https://satijalab.org/seurat/v3.1/pbmc3k_tutorial.html>


---

### Answer by username_2 on 2021-03-09. Score: 0

Have a look here and the entire tutorial:

<https://github.com/hbctraining/scRNA-seq/blob/master/lessons/03_SC_quality_control-setup.md>


---

### Answer by username_3 on 2020-04-09. Score: -2

To convert data from one format into another, you may find some software tool sometimes. But mostly no such tool can be found to satisfy all the requirements that we want.

In such situations, I recommend that you write a C program that reads data from the input file and writes it into the output file. In this way, you have complete flexibility so that you can determine the exact output format and what part of data to ignore or include. To do that, you should be familiar with some concepts in C language such as arrays, loops, strings, and file operations.

For an example of such conversions, you can get ideas from the following page:
<https://stackoverflow.com/questions/55347322/c-program-to-convert-a-text-file-into-a-csv-file>

Of course, such a converter program can be written in other languages too such as C# and Python.

The program can be developed in R language too. You need to be familiar with import functions, loops, strings, and arrays in this language.

We cannot expect that custom tools exist for all our file convertions. Every bioinformatician must be skilled in a standard programming language such as C, C#, Java, Python, or R. Then, he/she will be able to develop any custom program that reads an input file and generates a custom output file.

> **Comments:**
> **username_4**: It's a rather onerous workaround to write C programs as interfaces between R packages and data (R generally has excellent data import functionality).  

---

