Answers.Body: <p>The UniProt page apparently only lets you download fasta sequences for the representative protein in each UniRef group:</p>
  <p><a href="https://i.sstatic.net/QmOT6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QmOT6.png" alt="screenshot of uniprot downlad page showing that only representative fasta is available" /></a></p>
  <p>So you can't get all the fasta sequences from there. However, once you get the list of UniProt IDs, you can get the sequences from those. To get the IDs, first select TSV output:</p>
  <p><a href="https://i.sstatic.net/zPWsD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zPWsD.png" alt="screenshot of the uniprot download page with TSV selected" /></a></p>
  <p>Then remove everything and add &quot;cluster members&quot; from the &quot;Miscellaneous&quot; section:</p>
  <p><a href="https://i.sstatic.net/u37ha.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/u37ha.png" alt="screenshot of the uniprot website with TSV selected and only &quot;clustyer members&quot;" /></a></p>
  <p>This will give you a file that looks like this:</p>
  <pre><code>$ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz 
  Cluster ID  Cluster members
  UniRef50_A0A0F6EQC6 A0A0F6EQC6; E3E6D7; A0A3G8RAV1; A0A2K1EFR7; A0A2S6NYI6; A0A7H0Y5M1; A0A2N9YZ66; A0A853Q3J3; A0A8I2C241; A0A0K2FC93
  UniRef50_A0A0T6A5I5 A0A0T6A5I5; A0A2V7BZB0; A0A2V6XWF2
  UniRef50_A0A2H4TXU1 A0A2H4TXU1
  UniRef50_A0A6C2YI31 A0A6C2YI31
  UniRef50_B1KXG0 B1KXG0; UPI001F3F1379
  </code></pre>
  <p>It's a tab separated file, and the second field is a <code>;</code>-separated list of cluster members. Get those into a new file, one per line:</p>
  <pre><code>$ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | 
      tail -n +2 | cut -f2 | sed 's/; /\n/g'
  A0A0F6EQC6
  E3E6D7
  A0A3G8RAV1
  A0A2K1EFR7
  A0A2S6NYI6
  A0A7H0Y5M1
  A0A2N9YZ66
  A0A853Q3J3
  A0A8I2C241
  A0A0K2FC93
  A0A0T6A5I5
  A0A2V7BZB0
  A0A2V6XWF2
  A0A2H4TXU1
  A0A6C2YI31
  B1KXG0
  UPI001F3F1379
  </code></pre>
  <p>Save to a file with</p>
  <pre><code>$ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | 
      tail -n +2 | cut -f2 | sed 's/; /\n/g &gt; newfile
  </code></pre>
  <p>It may be possible for the same protein to belong to multiple clusters, I don't know UniRef well enough to be sure if this is the case. So, to be on the safe side, make the IDs unique:</p>
  <pre><code>zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | tail -n +2 | cut -f2 | sed 's/; /\n/g' | sort -u
  </code></pre>
  <p>That assumes GNU <code>sort</code>, the default on Linux. If yours doesn't have a <code>-u</code> option, use this instead:</p>
  <pre><code>zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | tail -n +2 | cut -f2 | sed 's/; /\n/g' | sort | uniq
  </code></pre>
  <p>Now, you can use these IDs and UniProt's ID mapping tool to get their sequences. Go to the <a href="https://www.uniprot.org/id-mapping" rel="nofollow noreferrer">mapping tool</a> and paste in your IDs (this assumes you have no more than 100000 IDs. If you have more, do this in multiple steps.</p>
  <p><a href="https://i.sstatic.net/bTTzO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bTTzO.png" alt="screenshot of the ID mapping tool" /></a></p>
  <p>Click on &quot;Map N IDs&quot; and that will take you to <a href="https://www.uniprot.org/id-mapping/uniprotkb/bb5c9c4ede74975062a9973483b64bca6c2f275c/overview" rel="nofollow noreferrer">a page</a> like this, where you can now click on &quot;Download&quot; to retrieve the sequences:</p>
  <p><a href="https://i.sstatic.net/YWNfW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YWNfW.png" alt="screenshot of the results page and download link" /></a>
  <a href="https://i.sstatic.net/sUuEo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sUuEo.png" alt="this is what you see after clicking on download" /></a></p>
  <p>The result of all this is a fasta file like this:</p>
  <pre><code>$ zcat foo.fa.gz | head
  &gt;tr|A0A0F6EQC6|A0A0F6EQC6_PAEPO Membrane protease regulatory membrane protein OS=Paenibacillus polymyxa OX=1406 GN=yuaF PE=4 SV=1
  METLFWWLLAGGAIFTVVSVLIGDVLGSWLDGALELPGLDWFRPVVLLGAMTAFGGAGVL
  LTKYTGLTMGWVVVLALGIALVIGVLVFFAFIKPMANSEVSSGFSMRELTGRIGEVTIPV
  PEVGYGEVMIRLGAGNTIHTASSFDHKPLAAGTRIVVVEVAEGVVRVAYLDT
  &gt;tr|A0A0K2FC93|A0A0K2FC93_9BACL Membrane protease regulatory membrane protein OS=Paenibacillus peoriae OX=59893 GN=ABE82_18870 PE=4 SV=1
  METIFWWLLAGGAIFTVVSVLIGDVLGGWLDGALELPGLDWFRPVVLLGAMTAFGGAGVL
  LTKYTGLSMGWVVVLALGIAFVIGILVFFAFIKPMANSEVSSGFSMRELTGRIGEVTIPV
  PEVGYGEVMIRLGAGNTIHTASSFDHKPLAAGTRIVVVEVAEGVVRVAYLDT
  &gt;tr|A0A0T6A5I5|A0A0T6A5I5_9BACT Membrane protein, putative membrane protein OS=candidate division NC10 bacterium CSP1-5 OX=1640516 GN=XU15_C0006G0101 PE=4 SV=1
  MDSFVQLVVGTVVLRPYVVAFLLLYLFAAVADMGWRRTLLFTVVAWSVAFTAESLSIRFG
  </code></pre>
  <p>However, I would urge you to think if this is really the best way for what you want to do. If you are trying to find orthologous groups, there are better ways.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-01T18:32:55.773Z
Answers.LastActivityDate: 2024-03-01T18:32:55.773Z
Answers.UserDisplayName: terdon
Body: <p>We are trying to download multiple UniRef clusters in one batch on the website. However, it seems the members are not downloaded... Could you guide me a way to the solution? Many thanks!</p>
  <p>For example, see <a href="https://www.uniprot.org/uniref?query=membrane+protein&amp;facets=identity%3A0.5" rel="nofollow noreferrer">this link</a>. We would like to download all these clusters including their members. But when selected these clusters, only the representative sequences (one sequence per cluster) were downloaded.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T11:27:55.313Z
Comments.Text: Please [edit] your question and give us some context. What website? How are you doing this? Which clusters? What do you want to download exactly, the protein sequence?
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T14:10:04.367Z
Comments.Text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comments.UserDisplayName: Community
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T14:58:18.577Z
Comments.Text: Please see the link below. We would like to download all these clusters including their members. But when selected these clusters, only the representative sequences (one sequence per cluster) were downloaded...
  https://www.uniprot.org/uniref?query=membrane+protein&facets=identity%3A0.5
Comments.UserDisplayName: user20028
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T17:51:22.827Z
Comments.Text: Can you explain why you want this? Are you sure UniRef is the right tool for what you are trying to do? How will the sequences be used? The whole point of UniRef is to give one representative sequence so it seems strange that you want to do something else. Please [edit] your question and explain what the final objective here is. Perhaps you are trying to get orthologous sequence groups?
Comments.UserDisplayName: terdon
Tags: <data-download>
Title: How to download multiple UniRef clusters with all their members?
ThreadText: # How to download multiple UniRef clusters with all their members?
  
  (Asked by: username_0 on 2024-03-01)
  
  We are trying to download multiple UniRef clusters in one batch on the website. However, it seems the members are not downloaded... Could you guide me a way to the solution? Many thanks!
  
  For example, see [this link](https://www.uniprot.org/uniref?query=membrane+protein&facets=identity%3A0.5). We would like to download all these clusters including their members. But when selected these clusters, only the representative sequences (one sequence per cluster) were downloaded.
  
  **Tags:** data-download
  
  > **Comments:**
  > **username_1**: Please [edit] your question and give us some context. What website? How are you doing this? Which clusters? What do you want to download exactly, the protein sequence?  
  > **username_2**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
  > **username_0**: Please see the link below. We would like to download all these clusters including their members. But when selected these clusters, only the representative sequences (one sequence per cluster) were downloaded... https://www.uniprot.org/uniref?query=membrane+protein&facets=identity%3A0.5  
  > **username_1**: Can you explain why you want this? Are you sure UniRef is the right tool for what you are trying to do? How will the sequences be used? The whole point of UniRef is to give one representative sequence so it seems strange that you want to do something else. Please [edit] your question and explain what the final objective here is. Perhaps you are trying to get orthologous sequence groups?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-03-01. Score: 0
  
  The UniProt page apparently only lets you download fasta sequences for the representative protein in each UniRef group:
  
  [![screenshot of uniprot downlad page showing that only representative fasta is available](https://i.sstatic.net/QmOT6.png)](https://i.sstatic.net/QmOT6.png)
  
  So you can't get all the fasta sequences from there. However, once you get the list of UniProt IDs, you can get the sequences from those. To get the IDs, first select TSV output:
  
  [![screenshot of the uniprot download page with TSV selected](https://i.sstatic.net/zPWsD.png)](https://i.sstatic.net/zPWsD.png)
  
  Then remove everything and add "cluster members" from the "Miscellaneous" section:
  
  [![screenshot of the uniprot website with TSV selected and only "clustyer members"](https://i.sstatic.net/u37ha.png)](https://i.sstatic.net/u37ha.png)
  
  This will give you a file that looks like this:
  
  ```
  $ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz 
  Cluster ID  Cluster members
  UniRef50_A0A0F6EQC6 A0A0F6EQC6; E3E6D7; A0A3G8RAV1; A0A2K1EFR7; A0A2S6NYI6; A0A7H0Y5M1; A0A2N9YZ66; A0A853Q3J3; A0A8I2C241; A0A0K2FC93
  UniRef50_A0A0T6A5I5 A0A0T6A5I5; A0A2V7BZB0; A0A2V6XWF2
  UniRef50_A0A2H4TXU1 A0A2H4TXU1
  UniRef50_A0A6C2YI31 A0A6C2YI31
  UniRef50_B1KXG0 B1KXG0; UPI001F3F1379
  
  ```
  
  It's a tab separated file, and the second field is a `;`-separated list of cluster members. Get those into a new file, one per line:
  
  ```
  $ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | 
      tail -n +2 | cut -f2 | sed 's/; /\n/g'
  A0A0F6EQC6
  E3E6D7
  A0A3G8RAV1
  A0A2K1EFR7
  A0A2S6NYI6
  A0A7H0Y5M1
  A0A2N9YZ66
  A0A853Q3J3
  A0A8I2C241
  A0A0K2FC93
  A0A0T6A5I5
  A0A2V7BZB0
  A0A2V6XWF2
  A0A2H4TXU1
  A0A6C2YI31
  B1KXG0
  UPI001F3F1379
  
  ```
  
  Save to a file with
  
  ```
  $ zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | 
      tail -n +2 | cut -f2 | sed 's/; /\n/g > newfile
  
  ```
  
  It may be possible for the same protein to belong to multiple clusters, I don't know UniRef well enough to be sure if this is the case. So, to be on the safe side, make the IDs unique:
  
  ```
  zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | tail -n +2 | cut -f2 | sed 's/; /\n/g' | sort -u
  
  ```
  
  That assumes GNU `sort`, the default on Linux. If yours doesn't have a `-u` option, use this instead:
  
  ```
  zcat uniref_id_UniRef50_A0A0F6EQC6_OR_id_U_2024_03_01.tsv.gz | tail -n +2 | cut -f2 | sed 's/; /\n/g' | sort | uniq
  
  ```
  
  Now, you can use these IDs and UniProt's ID mapping tool to get their sequences. Go to the [mapping tool](https://www.uniprot.org/id-mapping) and paste in your IDs (this assumes you have no more than 100000 IDs. If you have more, do this in multiple steps.
  
  [![screenshot of the ID mapping tool](https://i.sstatic.net/bTTzO.png)](https://i.sstatic.net/bTTzO.png)
  
  Click on "Map N IDs" and that will take you to [a page](https://www.uniprot.org/id-mapping/uniprotkb/bb5c9c4ede74975062a9973483b64bca6c2f275c/overview) like this, where you can now click on "Download" to retrieve the sequences:
  
  [![screenshot of the results page and download link](https://i.sstatic.net/YWNfW.png)](https://i.sstatic.net/YWNfW.png)
  [![this is what you see after clicking on download](https://i.sstatic.net/sUuEo.png)](https://i.sstatic.net/sUuEo.png)
  
  The result of all this is a fasta file like this:
  
  ```
  $ zcat foo.fa.gz | head
  >tr|A0A0F6EQC6|A0A0F6EQC6_PAEPO Membrane protease regulatory membrane protein OS=Paenibacillus polymyxa OX=1406 GN=yuaF PE=4 SV=1
  METLFWWLLAGGAIFTVVSVLIGDVLGSWLDGALELPGLDWFRPVVLLGAMTAFGGAGVL
  LTKYTGLTMGWVVVLALGIALVIGVLVFFAFIKPMANSEVSSGFSMRELTGRIGEVTIPV
  PEVGYGEVMIRLGAGNTIHTASSFDHKPLAAGTRIVVVEVAEGVVRVAYLDT
  >tr|A0A0K2FC93|A0A0K2FC93_9BACL Membrane protease regulatory membrane protein OS=Paenibacillus peoriae OX=59893 GN=ABE82_18870 PE=4 SV=1
  METIFWWLLAGGAIFTVVSVLIGDVLGGWLDGALELPGLDWFRPVVLLGAMTAFGGAGVL
  LTKYTGLSMGWVVVLALGIAFVIGILVFFAFIKPMANSEVSSGFSMRELTGRIGEVTIPV
  PEVGYGEVMIRLGAGNTIHTASSFDHKPLAAGTRIVVVEVAEGVVRVAYLDT
  >tr|A0A0T6A5I5|A0A0T6A5I5_9BACT Membrane protein, putative membrane protein OS=candidate division NC10 bacterium CSP1-5 OX=1640516 GN=XU15_C0006G0101 PE=4 SV=1
  MDSFVQLVVGTVVLRPYVVAFLLLYLFAAVADMGWRRTLLFTVVAWSVAFTAESLSIRFG
  
  ```
  
  However, I would urge you to think if this is really the best way for what you want to do. If you are trying to find orthologous groups, there are better ways.
  
  
  ---
  
  