seqsearch.databases.download

Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio

 1#!/usr/bin/env python3
 2# -*- coding: utf-8 -*-
 3
 4"""
 5Written by Lucas Sinclair.
 6MIT Licensed.
 7Contact at www.sinclair.bio
 8"""
 9
10# Built-in modules #
11
12# Internal modules #
13
14# Third party modules #
15
16###############################################################################
17def acc_to_fasta(accessions):
18    """
19    Pass a list of accessions IDs as argument and a string representing
20    a FASTA is returned.
21    """
22    from Bio import Entrez
23    Entrez.email = "I don't know who will be running this script"
24    entries = Entrez.efetch(db      = "nuccore",
25                            id      = accessions,
26                            rettype = "fasta",
27                            retmode = "xml")
28    records = Entrez.read(entries)
29    return records
def acc_to_fasta(accessions):
18def acc_to_fasta(accessions):
19    """
20    Pass a list of accessions IDs as argument and a string representing
21    a FASTA is returned.
22    """
23    from Bio import Entrez
24    Entrez.email = "I don't know who will be running this script"
25    entries = Entrez.efetch(db      = "nuccore",
26                            id      = accessions,
27                            rettype = "fasta",
28                            retmode = "xml")
29    records = Entrez.read(entries)
30    return records

Pass a list of accessions IDs as argument and a string representing a FASTA is returned.