<p>The simplest method is to download the GTF file for GRCm38 and filter that. You can then use one of the many tools out there (<a href="http://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html" rel="nofollow noreferrer">bedtools getfasta</a> (make sure to enforce strandedness and possibly use the <code>--split</code> option, if you happen to use a BED12 file), <a href="https://ccb.jhu.edu/software/tophat/index.shtml" rel="nofollow noreferrer">gtf_to_fasta</a> from tophat2 (it's the only reason to keep tophat2 installed), etc.) to make a transcriptomic fasta file.</p>

<p>Alternatively, <a href="https://www.ensembl.org/biomart/martview" rel="nofollow noreferrer">Ensembl BioMart</a> can be used to directly download a transcriptomic fasta file using a filter to select only those transcripts on pre-defined chromosomes. Other filters can be applied as well. If you don't already have a GTF file downloaded and one of the previously mentioned packages installed, then this may be the simplest way to get what you want.</p>

CC BY-SA 3.0
2018-04-17T22:25:56.617Z
2018-04-17T22:25:56.617Z
Devon Ryan
<p>I'm currently performing differential expression analysis using alignment-free quantification using Kallisto. To do this, I need to create a Kallisto index using Ensembl's cDNA and ncRNA annotations available at the following two links:</p>

<p><a href="ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/cdna/Mus_musculus.GRCm38.cdna.all.fa.gz" rel="nofollow noreferrer">ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/cdna/Mus_musculus.GRCm38.cdna.all.fa.gz</a> <a href="ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/ncrna/Mus_musculus.GRCm38.ncrna.fa.gz" rel="nofollow noreferrer">ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/ncrna/Mus_musculus.GRCm38.ncrna.fa.gz</a></p>

<p>However, later on in my analysis I realized that I had multiple Ensembl gene IDs pointing to the same gene. For example, I was gettign results for both ENSMUSG00000026012 and ENSMUSG00000102412 which both map to Cd28. I realized that the reason for this error was due to the fact that the annotations I was using contained haplotypes.</p>

<p>I would like to remove these haplotypes, and to do this I believe that I need to rerun my analysis using a primary assembly. However, Ensembl doesn't have annotated cDNA and ncRNA FASTA files of the primary assembly. How can I filter these files to contain only genes present in the primary assembly? Is there a better way for me to solve this issue?</p>

CC BY-SA 3.0
2018-04-17T23:53:47.603Z
Both Ensembl and GenBank databases have their own ideas about what constitutes a gen, and the mapping of Ensembl genes to RefSeq genes is not one-to-one. There are some RefSeq genes that map to multiple Ensembl genes, some Ensembl genes that map to multiple RefSeq genes, and some genes that are not in the other database.
gringer
<ensembl><filtering>
How to filter Ensembl cDNA and ncRNA FASTA files by primary assembly?
# How to filter Ensembl cDNA and ncRNA FASTA files by primary assembly?

(Asked by: username_0 on 2018-04-17)

I'm currently performing differential expression analysis using alignment-free quantification using Kallisto. To do this, I need to create a Kallisto index using Ensembl's cDNA and ncRNA annotations available at the following two links:

<ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/cdna/Mus_musculus.GRCm38.cdna.all.fa.gz> <ftp://ftp.ensembl.org/pub/current_fasta/mus_musculus/ncrna/Mus_musculus.GRCm38.ncrna.fa.gz>

However, later on in my analysis I realized that I had multiple Ensembl gene IDs pointing to the same gene. For example, I was gettign results for both ENSMUSG00000026012 and ENSMUSG00000102412 which both map to Cd28. I realized that the reason for this error was due to the fact that the annotations I was using contained haplotypes.

I would like to remove these haplotypes, and to do this I believe that I need to rerun my analysis using a primary assembly. However, Ensembl doesn't have annotated cDNA and ncRNA FASTA files of the primary assembly. How can I filter these files to contain only genes present in the primary assembly? Is there a better way for me to solve this issue?

**Tags:** ensembl, filtering
> **Comments:**
> **username_1**: Both Ensembl and GenBank databases have their own ideas about what constitutes a gen, and the mapping of Ensembl genes to RefSeq genes is not one-to-one. There are some RefSeq genes that map to multiple Ensembl genes, some Ensembl genes that map to multiple RefSeq genes, and some genes that are not in the other database.  

---

## 1 answers

### Answer by username_2 on 2018-04-17. Score: 1

The simplest method is to download the GTF file for GRCm38 and filter that. You can then use one of the many tools out there ([bedtools getfasta](http://bedtools.readthedocs.io/en/latest/content/tools/getfasta.html) (make sure to enforce strandedness and possibly use the `--split` option, if you happen to use a BED12 file), [gtf\_to\_fasta](https://ccb.jhu.edu/software/tophat/index.shtml) from tophat2 (it's the only reason to keep tophat2 installed), etc.) to make a transcriptomic fasta file.

Alternatively, [Ensembl BioMart](https://www.ensembl.org/biomart/martview) can be used to directly download a transcriptomic fasta file using a filter to select only those transcripts on pre-defined chromosomes. Other filters can be applied as well. If you don't already have a GTF file downloaded and one of the previously mentioned packages installed, then this may be the simplest way to get what you want.


---

