def get_sequence_from_location(species, coords): """Get sequence from a genomic location in an ensembl species genome.""" from cogent.db.ensembl import HostAccount, Genome, Compara, Species genome = Genome(Species=species, Release='87', account=None) chrom, start, end, strand = coords #print coords r = genome.getRegion(CoordName=str(chrom), Start=start, End=end, Strand=strand) return r.Seq
def get_chrom_seqs(species, release, account=None, debug=False): """yields sequence objects for the indicated chromosomes from Ensembl""" genome = Genome(species, Release=release, account=account) for chrom in chroms[species]: region = genome.getRegion(CoordName=chrom) seq = region.Seq name = 'chr_%s' % chrom seq.Name = name if debug: print name print repr(seq) yield seq