def fetch_genome(genome_id):
    '''Acquire a genome from Entrez

    '''
    # TODO: Can strandedness by found in fetched genome attributes?
    # TODO: skip read/write step?
    # Using a dummy email for now - does this violate NCBI guidelines?
    email = 'loremipsum@gmail.com'
    Entrez.email = email

    print 'Downloading Genome...'
    handle = Entrez.efetch(db='nucleotide', id=str(genome_id), rettype='gb',
                           retmode='text')
    print 'Genome Downloaded...'
    tmpfile = os.path.join(mkdtemp(), 'tmp.gb')
    with open(tmpfile, 'w') as f:
        f.write(handle.read())
    genome = coral.seqio.read_dna(tmpfile)

    return genome
def fetch_genome ( genome_id ) : email = 'loremipsum@gmail.com' Entrez . email = email print 'Downloading Genome...' handle = Entrez . efetch ( db = 'nucleotide' , id = str ( genome_id ) , rettype = 'gb' , retmode = 'text' ) print 'Genome Downloaded...' tmpfile = os . path . join ( mkdtemp ( ) , 'tmp.gb' ) with open ( tmpfile , 'w' ) as f : f . write ( handle . read ( ) ) genome = coral . seqio . read_dna ( tmpfile ) return genome
Acquire a genome from Entrez