<p>I can suggest two ways to batch-download aligned sequences for the species of interest. Both ways are integral to the Ensembl database and toolsets.</p>
<p>But before that, I suggest FBgn0085802 (which is rRNA) instead of FBgn0085813 and FBgn0267521 (which are pseudogenes). You may check FlyBase database.</p>
<ol>
<li>Metazoa Ensembl is preferable Since you are interested in Fruit fly 18S rRNA homologs. You query Ensembl ID in the Ensembl search box (at <a href="http://www.metazoa.ensembl.org" rel="nofollow noreferrer">www.metazoa.ensembl.org</a>) and click the popping link. 18SrRNA:CR41548 comes for FBgn0085802. On the left-hand side, Gene-based displays, select Sequence. under the Marked-up sequence, pick &quot;BLAST this sequence&quot;.</li>
</ol>
<p>Opening the BLAST/BLAT search automatically sets a DNA alignment query. You may search against the species of interest and add &quot;18S&quot; as Description. Later, run without changing any other parameter. It may take several minutes. Then, view results for hits found. You can investigate Sequence/s with the best alignment and closest genomic locations, then export data in FASTA or other formats.</p>
<p>While this assures you of the alignment and lets you investigate in detail the homologs, you may not batch-download particularly in this way.</p>
<ol start="2">
<li>As mentioned, BioMart Restful API is a way to batch-download sequences that you want. The website does only allow one search at a moment but editing the Perl script, which is generated according to your query, you may get sequences for multiple datasets. For setup, you should follow BioMart Perl API guideline cautiosly.</li>
</ol>
<p>For your example query, set proper datasets, filters and attributes. Again for fruit fly, you may refer to:</p>
<p><a href="https://www.metazoa.ensembl.org/info/data/biomart/biomart_perl_api.html" rel="nofollow noreferrer">https://www.metazoa.ensembl.org/info/data/biomart/biomart_perl_api.html</a></p>
<p>My example query seems like below in popping Perl script:</p>
<pre><code><span class="math-container">$query-&gt;setDataset("dyakuba_eg_gene"); 
$</span>query-&gt;addFilter(&quot;with_dmelanogaster_eg_homolog&quot;, [&quot;Only&quot;]);
<span class="math-container">$query-&gt;addFilter("biotype", ["rRNA"]);
$</span>query-&gt;addFilter(&quot;transcript_biotype&quot;, [&quot;rRNA&quot;]);
<span class="math-container">$query-&gt;addAttribute("ensembl_gene_id");
$</span>query-&gt;addAttribute(&quot;ensembl_transcript_id&quot;);
<span class="math-container">$query-&gt;addAttribute("gene_biotype");
$</span>query-&gt;addAttribute(&quot;description&quot;);
$query-&gt;addAttribute(&quot;transcript_biotype&quot;);
</code></pre>

CC BY-SA 4.0
2024-03-24T16:04:14.987Z
2024-09-02T10:47:16.420Z
2024-09-02T10:47:16.420Z
44Pasha
<ul>
<li>How do I know which sequence I should use to make an alignment with other species?</li>
</ul>
<p>Use both. For fruit flies there should thousands of 18S sequences.</p>
<ul>
<li>How can I batch download the same region for all the species of interest?</li>
</ul>
<p>Using Blast (below)</p>
<ul>
<li>Do you know any protocol/guide that goes into detail of how to download and select sequences to make phylogenies?</li>
</ul>
<p>Sure - Blast ... align via muscle -super5 and build via IQ-TREE</p>
<p>EMBL I don't know - using REST API via a CLI is possible. The problem is that you could potentially 1000s of 18S genes but a simple search term can ignore everything that isn't part of a genome explicitly labelled &quot;18S&quot;. Thats where a Blast style approach is useful.</p>
<p>However, for NCBI Blast they intentionally block access to CLI with &gt;100 hits requested. This is a complete pain and really, really limits using Blast to extract out a gene remotely using a remote request script.</p>
<p>Basically the way to do it is to ditch the API and run this via the Blast NCBI web interface, or download the entire eukaryotic database and perform local Blast, MMseqs2 or Minimap2.</p>
<p>It's a bit bizarre I know, NCBI just doesn't like bots running its Blast service, but it gives more permission to use its web-service. The central advantage is that Blast will nicely remove the 18S gene from any given genome which can be downloaded as a single locus, without needing to download loads of genome stuff thats not needed. NCBI still does impose a limit on how much can be blasted via the web which sadly now is only 5000 (I'm sure it was much more like 50000) and its really not cool.</p>
<p>What you can do is use the Blast search &quot;exclude/include&quot; parameters to target the taxa of interest within the 5000 limit and using a tree of relevant eukaryotic evolution navigate the data sets. I assume you are looking for around 100000 sequences. Basically, once you've blasted you have the option of downloading just the region blasted and nothing else ... or the whole genome (avoid this option)... you will then have 5000 nicely 18S genes excised <em>in silico</em></p>
<p>You can also set a lot other blast parameters, in particular only considering full length hits.</p>

CC BY-SA 4.0
2024-03-23T22:46:18.313Z
2024-03-23T22:46:18.313Z
M__
<p>I need 18S rRNA gene sequences for a wide variety of eukaryotic species.<br />
I know that Ensembl has this gene sequence, but I don't understand what is the correct protocol to download the sequences. I already know  the basics of Ensembl's Rest API, but there are still a few things that I don't understand.</p>
<p>I only know the gene name (18S rRNA) and the list of taxa I want to select it from. But I do not know the region of the gene.</p>
<p>For example: I tried looking for '18srrna' on the Ensembl browser and I noticed that for the Fruit fly there are 2 sequences corresponding to this gene (Ensembl IDs: FBgn0085813 and FBgn0267521).</p>
<ol>
<li>How do I know which sequence I should use to make an alignment with other species?</li>
<li>How can I batch download the same region for all the species of interest?</li>
<li>Do you know any protocol/guide that goes into detail of how to download and select sequences to make phylogenies?</li>
</ol>
<p>I don't have a solution for question (1) but for question (2) I am planning on requesting from the API the output of the endpoint <code>GET sequence/region/:species/:region</code>. But then again the problem is that I would need the position of the region for each species, and it sounds unfeasible to do for more than a dozen of species.</p>

CC BY-SA 4.0
2024-03-20T15:56:22.440Z
Hi @Mirk. I'll answer over the weekend if no-one else does. You wrote, "eucariotic" do you mean eukaryotes?
M__
CC BY-SA 4.0
2024-03-20T16:22:38.277Z
Yes, sorry I did a spelling mistake but now I corrected it. Thanks for pointing it out.
Mirk
<phylogenetics><ensembl><multiple-sequence-alignment><dna>
How to download the same 18S rRNA gene region for multiple species?
# How to download the same 18S rRNA gene region for multiple species?

(Asked by: username_0 on 2024-03-20)

I need 18S rRNA gene sequences for a wide variety of eukaryotic species.  
I know that Ensembl has this gene sequence, but I don't understand what is the correct protocol to download the sequences. I already know the basics of Ensembl's Rest API, but there are still a few things that I don't understand.

I only know the gene name (18S rRNA) and the list of taxa I want to select it from. But I do not know the region of the gene.

For example: I tried looking for '18srrna' on the Ensembl browser and I noticed that for the Fruit fly there are 2 sequences corresponding to this gene (Ensembl IDs: FBgn0085813 and FBgn0267521).

1. How do I know which sequence I should use to make an alignment with other species?
2. How can I batch download the same region for all the species of interest?
3. Do you know any protocol/guide that goes into detail of how to download and select sequences to make phylogenies?

I don't have a solution for question (1) but for question (2) I am planning on requesting from the API the output of the endpoint `GET sequence/region/:species/:region`. But then again the problem is that I would need the position of the region for each species, and it sounds unfeasible to do for more than a dozen of species.

**Tags:** phylogenetics, ensembl, multiple-sequence-alignment, dna
> **Comments:**
> **username_1**: Hi @Mirk. I'll answer over the weekend if no-one else does. You wrote, "eucariotic" do you mean eukaryotes?  
> **username_0**: Yes, sorry I did a spelling mistake but now I corrected it. Thanks for pointing it out.  

---

## 2 answers

### Answer by username_2 on 2024-03-24. Score: 2

I can suggest two ways to batch-download aligned sequences for the species of interest. Both ways are integral to the Ensembl database and toolsets.
But before that, I suggest FBgn0085802 (which is rRNA) instead of FBgn0085813 and FBgn0267521 (which are pseudogenes). You may check FlyBase database.

Metazoa Ensembl is preferable Since you are interested in Fruit fly 18S rRNA homologs. You query Ensembl ID in the Ensembl search box (at www.metazoa.ensembl.org) and click the popping link. 18SrRNA:CR41548 comes for FBgn0085802. On the left-hand side, Gene-based displays, select Sequence. under the Marked-up sequence, pick "BLAST this sequence".

Opening the BLAST/BLAT search automatically sets a DNA alignment query. You may search against the species of interest and add "18S" as Description. Later, run without changing any other parameter. It may take several minutes. Then, view results for hits found. You can investigate Sequence/s with the best alignment and closest genomic locations, then export data in FASTA or other formats.
While this assures you of the alignment and lets you investigate in detail the homologs, you may not batch-download particularly in this way.

As mentioned, BioMart Restful API is a way to batch-download sequences that you want. The website does only allow one search at a moment but editing the Perl script, which is generated according to your query, you may get sequences for multiple datasets. For setup, you should follow BioMart Perl API guideline cautiosly.

For your example query, set proper datasets, filters and attributes. Again for fruit fly, you may refer to:
https://www.metazoa.ensembl.org/info/data/biomart/biomart_perl_api.html
My example query seems like below in popping Perl script:
$query->setDataset("dyakuba_eg_gene"); 
$query->addFilter("with_dmelanogaster_eg_homolog", ["Only"]);
$query->addFilter("biotype", ["rRNA"]);
$query->addFilter("transcript_biotype", ["rRNA"]);
$query->addAttribute("ensembl_gene_id");
$query->addAttribute("ensembl_transcript_id");
$query->addAttribute("gene_biotype");
$query->addAttribute("description");
$query->addAttribute("transcript_biotype");


---

### Answer by username_1 on 2024-03-23. Score: 1

* How do I know which sequence I should use to make an alignment with other species?

Use both. For fruit flies there should thousands of 18S sequences.

* How can I batch download the same region for all the species of interest?

Using Blast (below)

* Do you know any protocol/guide that goes into detail of how to download and select sequences to make phylogenies?

Sure - Blast ... align via muscle -super5 and build via IQ-TREE

EMBL I don't know - using REST API via a CLI is possible. The problem is that you could potentially 1000s of 18S genes but a simple search term can ignore everything that isn't part of a genome explicitly labelled "18S". Thats where a Blast style approach is useful.

However, for NCBI Blast they intentionally block access to CLI with >100 hits requested. This is a complete pain and really, really limits using Blast to extract out a gene remotely using a remote request script.

Basically the way to do it is to ditch the API and run this via the Blast NCBI web interface, or download the entire eukaryotic database and perform local Blast, MMseqs2 or Minimap2.

It's a bit bizarre I know, NCBI just doesn't like bots running its Blast service, but it gives more permission to use its web-service. The central advantage is that Blast will nicely remove the 18S gene from any given genome which can be downloaded as a single locus, without needing to download loads of genome stuff thats not needed. NCBI still does impose a limit on how much can be blasted via the web which sadly now is only 5000 (I'm sure it was much more like 50000) and its really not cool.

What you can do is use the Blast search "exclude/include" parameters to target the taxa of interest within the 5000 limit and using a tree of relevant eukaryotic evolution navigate the data sets. I assume you are looking for around 100000 sequences. Basically, once you've blasted you have the option of downloading just the region blasted and nothing else ... or the whole genome (avoid this option)... you will then have 5000 nicely 18S genes excised *in silico*

You can also set a lot other blast parameters, in particular only considering full length hits.


---

