<p>Step 1: 
Add the the GFP sequence to your fasta file</p>

<pre><code>&gt;GFP_name
ATG.....TAA
</code></pre>

<p>Step 2:
Annotate the gtf so that it contains all the necessary information to annotate your information</p>

<p>Add this line to your GTF file but modify where necessary:
"Make sure that all columns are tab separated"</p>

<pre><code>GFP_name    AddedGene   exon    1   1966    .   +   1   gene_id "GFP"; transcript_id "GFP"; gene_name "GFP"; transcript_name "GFP"
</code></pre>

<ul>
<li>The first column has to correspond to the header of the fasta sequence </li>
<li>start and end indicates the length of your sequence. I added a 1966 bp long sequence to my gtf</li>
</ul>

<p>Code example:
step 1:</p>

<pre><code>cat reference.fa gfp_seq.fa &gt; new_reference.fa
</code></pre>

<p>step 2:</p>

<pre><code>cat genes.gtf gfp.gtf &gt; new_genes.gtf
</code></pre>

<p>-  gfp_seq.fa is your custom gene in fasta file
-  gfp.gtf is your custom gtf line or lines if you want to add more</p>

<p>You can also open your current reference fasta and gtf file in a text editor and copy paste the sequence and gtf line in there. </p>

<p>Then run <code>cellranger mkref</code> on your new_reference and new_genes file</p>

CC BY-SA 4.0
2019-07-26T16:06:26.240Z
Hi Mack, thank you for your reply. And I was still wandering whether "the genes.gtf" in Code2 "cat genes.gtf gfp.gtf > new_genes.gtf "  is the gtf that had to be filtered before or after Code 2 to proceed filter step?
hua
CC BY-SA 4.0
2019-07-26T16:30:07.017Z
You can add this line to the filtered gtf file. You can download the gtf file for your species of interest, format it for cellranger using the mkgtf function. The output.gtf will be used together with your reference.fa. You can add all custom genes to this output.gtf as long as you follow the correct format and annotate it as exon. You can also add gtf lines to the non-filtered gtf file and filter it then. I prefer to generate a species reference for myself and the lab, and modify that one for my own use.
Mack123456
CC BY-SA 4.0
2019-07-26T18:17:07.613Z
Hi Mack, much appreciated for your help. And after making reference, it comes the error as below: " Property 'transcript_id' not found in GTF line 1704071: GFP AddedGene exon 1 846 . + 1 gene_id “GFP"; transcript_id “GFP"; gene_name “GFP"; transcript_name “GFP" "
hua
CC BY-SA 4.0
2019-07-26T20:56:58.703Z
I am sorry for that. I believe I had a copy/paste error that adjusted the quotes. Make sure your quotes around the "GFP" are correct in your gtf line. That should solve the problem but feel free to reach out if not. Also make sure each column is tab separated.
Mack123456
CC BY-SA 4.0
2019-07-28T16:35:36.157Z
Hi Mack, thank you for your advice. Finally, I make it. And I have another question want to ask you whether it is possible that I can add a truncate sequence into the customer reference? The information is as below: 1. We use Cre/loxp system. 2. The truncate we want to add into customer reference is Nkx2-5.  Which was excised of exon2 and the flanking sequences resulted in a truncated RNA molecule that lacks exon 2 coding sequences, the splice sites, and the 3' noncoding region, rendering it essentially nonfunctional.
hua
CC BY-SA 4.0
2019-07-28T16:37:14.387Z
And maybe you can have a look at its construction in the paper. Here is the link of that mice https://ars.els-cdn.com/content/image/1-s2.0-S0092867404004052-gr1_lrg.jpg. You can see the Fig.1A.
hua
CC BY-SA 4.0
2019-07-29T18:23:18.210Z
Technically yes, but if the transcript is stable and detectable by the 10x chemistry, you should be able to map it to the wt-nkx annotation. You might need transcript assembly instead of mapping to a reference but that is material for a new question.
Mack123456
CC BY-SA 4.0
2019-08-01T03:01:52.913Z
Thank you for your time. And the last question is whether we add the GFP into the reference will make the result slightly different?
hua
CC BY-SA 4.0
2019-08-01T03:34:43.650Z
That depends on what you are trying to assess. If you post an analysis with and without GFP in reference and explain the question you are addressing it will be more helpful for us to help you out.
Mack123456
CC BY-SA 4.0
2019-08-02T01:51:28.523Z
It shows that the web_summary information changes a little bit. Like before using GFP reference, the cell number is 6542, the mean reads per cell are 35877, and the median genes per cell is 2539 all of them changed to 8452 cell, 27770 reads per cell, 1559 genes per cell. So did that cause any problem? Did that usually happen or I did something wrong?
hua
CC BY-SA 4.0
2019-08-02T16:13:02.093Z
Even tho cellranger is intuitive there is still a lot of bioinformatics that happens under the hood. Without knowing how you ran cellranger it is hard to say if this is supposed to happen. For example: are you sure you ran both references on the same cellranger version? Version 2 and 3 use different algorithms to call cells. Did you enter the same parameters in cellranger count (--expect-cells vs --force-cells vs default, etc?). A new question with details on how you ran cellranger would be helpful to troubleshoot or explain what happend.
Mack123456
CC BY-SA 4.0
2019-08-05T14:42:40.133Z
Hi Mack, thank you for your advice, after looking my cell ranger version it is 2.1.0 before making GFP reference. And I change it to 3.0.1 they work right now!
hua
CC BY-SA 4.0
2019-07-25T21:36:32.037Z
2019-07-26T20:53:54.237Z
2019-07-26T20:53:54.237Z
Mack123456
<p>Update your gtf file, update the genome fasta, run cellranger mkref.</p>

CC BY-SA 4.0
2019-07-26T13:49:59.650Z
This looks like a comment. Or at least I don't understand how this helps to add a new gene. Could you expand it so that it is more clear ?
llrs
CC BY-SA 4.0
2019-07-28T20:05:30.860Z
Although this might be a valid answer, I find somehow dissatisfactory. I think some explanation would improve it a lot.
Kamil S Jaron
CC BY-SA 4.0
2019-07-25T21:28:03.160Z
2019-07-25T21:28:03.160Z
swbarnes2
<p>Anyone here knows how to add a new gene (GFP) to customer reference by using cellranger? We use the Cre/loxp system by using R26RmTmG mice and want to use GFP to isolate specific cells. I have read the cellranger workflow but still, have no idea how to do it. Like it is said that I should update the GTF file as shown in the screenshot. <a href="https://i.sstatic.net/VA1mD.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VA1mD.jpg" alt="enter image description here"></a></p>

<single-cell>
making a customer reference by using cell ranger
# making a customer reference by using cell ranger

(Asked by: username_0 on 2019-07-25)

Anyone here knows how to add a new gene (GFP) to customer reference by using cellranger? We use the Cre/loxp system by using R26RmTmG mice and want to use GFP to isolate specific cells. I have read the cellranger workflow but still, have no idea how to do it. Like it is said that I should update the GTF file as shown in the screenshot. [![enter image description here](https://i.sstatic.net/VA1mD.jpg)](https://i.sstatic.net/VA1mD.jpg)

**Tags:** single-cell

---

## 2 answers

### Answer by username_1 on 2019-07-25. Score: 1 | Accepted answer

Step 1: 
Add the the GFP sequence to your fasta file
>GFP_name
ATG.....TAA

Step 2:
Annotate the gtf so that it contains all the necessary information to annotate your information
Add this line to your GTF file but modify where necessary:
"Make sure that all columns are tab separated"
GFP_name    AddedGene   exon    1   1966    .   +   1   gene_id "GFP"; transcript_id "GFP"; gene_name "GFP"; transcript_name "GFP"


The first column has to correspond to the header of the fasta sequence 
start and end indicates the length of your sequence. I added a 1966 bp long sequence to my gtf

Code example:
step 1:
cat reference.fa gfp_seq.fa > new_reference.fa

step 2:
cat genes.gtf gfp.gtf > new_genes.gtf

-  gfp_seq.fa is your custom gene in fasta file
-  gfp.gtf is your custom gtf line or lines if you want to add more
You can also open your current reference fasta and gtf file in a text editor and copy paste the sequence and gtf line in there. 
Then run cellranger mkref on your new_reference and new_genes file

> **Comments:**
> **username_0**: Hi Mack, thank you for your reply. And I was still wandering whether "the genes.gtf" in Code2 "cat genes.gtf gfp.gtf > new_genes.gtf "  is the gtf that had to be filtered before or after Code 2 to proceed filter step?  
> **username_1**: You can add this line to the filtered gtf file. You can download the gtf file for your species of interest, format it for cellranger using the mkgtf function. The output.gtf will be used together with your reference.fa. You can add all custom genes to this output.gtf as long as you follow the correct format and annotate it as exon. You can also add gtf lines to the non-filtered gtf file and filter it then. I prefer to generate a species reference for myself and the lab, and modify that one for my own use.  
> **username_0**: Hi Mack, much appreciated for your help. And after making reference, it comes the error as below: " Property 'transcript_id' not found in GTF line 1704071: GFP AddedGene exon 1 846 . + 1 gene_id “GFP"; transcript_id “GFP"; gene_name “GFP"; transcript_name “GFP" "  
> **username_1**: I am sorry for that. I believe I had a copy/paste error that adjusted the quotes. Make sure your quotes around the "GFP" are correct in your gtf line. That should solve the problem but feel free to reach out if not. Also make sure each column is tab separated.  
> **username_0**: Hi Mack, thank you for your advice. Finally, I make it. And I have another question want to ask you whether it is possible that I can add a truncate sequence into the customer reference? The information is as below: 1. We use Cre/loxp system. 2. The truncate we want to add into customer reference is Nkx2-5.  Which was excised of exon2 and the flanking sequences resulted in a truncated RNA molecule that lacks exon 2 coding sequences, the splice sites, and the 3' noncoding region, rendering it essentially nonfunctional.  
> **username_0**: And maybe you can have a look at its construction in the paper. Here is the link of that mice https://ars.els-cdn.com/content/image/1-s2.0-S0092867404004052-gr1_lrg.jpg. You can see the Fig.1A.  
> **username_1**: Technically yes, but if the transcript is stable and detectable by the 10x chemistry, you should be able to map it to the wt-nkx annotation. You might need transcript assembly instead of mapping to a reference but that is material for a new question.  
> **username_0**: Thank you for your time. And the last question is whether we add the GFP into the reference will make the result slightly different?  
> **username_1**: That depends on what you are trying to assess. If you post an analysis with and without GFP in reference and explain the question you are addressing it will be more helpful for us to help you out.  
> **username_0**: It shows that the web_summary information changes a little bit. Like before using GFP reference, the cell number is 6542, the mean reads per cell are 35877, and the median genes per cell is 2539 all of them changed to 8452 cell, 27770 reads per cell, 1559 genes per cell. So did that cause any problem? Did that usually happen or I did something wrong?  
> **username_1**: Even tho cellranger is intuitive there is still a lot of bioinformatics that happens under the hood. Without knowing how you ran cellranger it is hard to say if this is supposed to happen. For example: are you sure you ran both references on the same cellranger version? Version 2 and 3 use different algorithms to call cells. Did you enter the same parameters in cellranger count (--expect-cells vs --force-cells vs default, etc?). A new question with details on how you ran cellranger would be helpful to troubleshoot or explain what happend.  
> **username_0**: Hi Mack, thank you for your advice, after looking my cell ranger version it is 2.1.0 before making GFP reference. And I change it to 3.0.1 they work right now!  

---

### Answer by username_2 on 2019-07-25. Score: 0

Update your gtf file, update the genome fasta, run cellranger mkref.

> **Comments:**
> **username_3**: This looks like a comment. Or at least I don't understand how this helps to add a new gene. Could you expand it so that it is more clear ?  
> **username_4**: Although this might be a valid answer, I find somehow dissatisfactory. I think some explanation would improve it a lot.  

---

