<div dir="ltr">Uniprot has several APIs to access it: <a href="http://www.uniprot.org/help/programmatic_access">http://www.uniprot.org/help/programmatic_access</a> but I am not sure there is a module in biopython that accesses that. But it should be easy to do, just use a script to retrieve this generic URL:<div><br></div><div><pre style="font-weight:400;font-style:normal;text-decoration:none;text-align:left;text-indent:0px;font-family:monospace,monospace;font-size:14.04px;white-space:pre-wrap;word-wrap:break-word;padding:0.75em 46.7812px;border-width:1px;border-style:dotted;overflow:auto;margin-left:1em;margin-right:1em;background-color:rgb(241,241,241);color:rgb(34,34,34);font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-transform:none;word-spacing:0px"><a href="https://www.uniprot.org/uniprot/P12345.fasta">https://www.uniprot.org/uniprot/P12345.fasta</a></pre>where "P12345" is replaced by whatever UniprotID you have.<br><div><br></div><div><br></div><div>Then you can upload your concatenated FASTA file to the HMMER site, I am not sure what their size limitation is.</div><div><br></div><div>If it's only swissprot you are interested in, and you have the disk space, I suggest you download it, download HMMER and whatever reference databases you wish to run against, and do it all locally. Especially if you have a large number of sequences to process. Biopython can read swissprot or XML uniprot files via SeqIO.</div><div><br></div><div>To download uniprot: <a href="http://www.uniprot.org/downloads">http://www.uniprot.org/downloads</a></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 1:11 PM, Ahmad Abdelzaher <span dir="ltr"><<a href="mailto:underoath006@gmail.com" target="_blank">underoath006@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you for the reply. The accession numbers that I want to fetch the fasta sequences for are uniprot accession numbers. I want to search for homologs for these sequences on HMMR: <a href="https://www.ebi.ac.uk/Tools/hmmer/" target="_blank">https://www.ebi.ac.uk/Tools/<wbr>hmmer/</a><div><br></div><div>Any suggestions on how to do so? </div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 10:16 AM, Iddo Friedberg <span dir="ltr"><<a href="mailto:idoerg@gmail.com" target="_blank">idoerg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">There is an example here for downloading multiple GenBank entries: </span><a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc131" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://biopython.org/<wbr>DIST/docs/tutorial/Tutorial.ht<wbr>ml#htoc131</a><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">Depending on the actual database you are downloading from, you can use rettype="fasta" or convert a genbank file to fasta as in here: <a href="http://biopython.org/wiki/Converting_sequence_files" style="color:rgb(17,85,204)" target="_blank">http://biopython.org/wik<wbr>i/Converting_sequence_files</a></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">The possible rettype and retmode  are  dependent on the database you are fetching from, and determined of the efetch API . More about that here:  <a href="https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch" style="color:rgb(17,85,204)" target="_blank">https://www.ncbi.nlm.ni<wbr>h.gov/books/NBK25499/#chapter4<wbr>.EFetch</a></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">HTH,</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">Iddo</div><br></div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Fri, Apr 20, 2018 at 6:25 AM, Ahmad Abdelzaher <span dir="ltr"><<a href="mailto:underoath006@gmail.com" target="_blank">underoath006@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div dir="ltr">How can I batch download fasta sequences by accession number? Is there a Biopython method that can do that? Any other suggestions or alternatives? <div><br></div><div>Regards. </div></div>
<br></span>______________________________<wbr>_________________<br>
Biopython mailing list  -  <a href="mailto:Biopython@mailman.open-bio.org" target="_blank">Biopython@mailman.open-bio.org</a><br>
<a href="http://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" target="_blank">http://mailman.open-bio.org/ma<wbr>ilman/listinfo/biopython</a><span class="m_-5997707468107650149HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="m_-5997707468107650149HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-5997707468107650149m_5465107011556782259gmail_signature" data-smartmail="gmail_signature">Iddo Friedberg<br><a href="http://iddo-friedberg.net/contact.html" target="_blank">http://iddo-friedberg.net/cont<wbr>act.html</a><br>++++++++++[>+++>++++++>+++++++<wbr>+>++++++++++>+++++++++++<<<<<-<wbr>]>>>>++++.><br>++++++..----.<<<<+++++++++++++<wbr>+++++++++++++++.-----------..><wbr>>>+.-----.<br>.>-.<<<<--.>>>++.>+++.<+++.---<wbr>-.-.<++++++++++++++++++.>+.>.<<wbr>++.<<<+.>><br>>>----.<--.>++++++.<<<<-------<wbr>-----------------------------.<br></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Iddo Friedberg<br><a href="http://iddo-friedberg.net/contact.html" target="_blank">http://iddo-friedberg.net/contact.html</a><br>++++++++++[>+++>++++++>++++++++>++++++++++>+++++++++++<<<<<-]>>>>++++.><br>++++++..----.<<<<++++++++++++++++++++++++++++.-----------..>>>+.-----.<br>.>-.<<<<--.>>>++.>+++.<+++.----.-.<++++++++++++++++++.>+.>.<++.<<<+.>><br>>>----.<--.>++++++.<<<<------------------------------------.<br></div>
</div>