allpy
diff allpy/base.py @ 276:4466baf642df
Removed base.Sequence.from_slice
This function is typical case of premature optimization.
The current workaround is:
Sequence(Sequence.from_file(...)[begin:end])
It would be best (though not implemented yet) if all slice operations on
Sequence return Sequence objects immediately.
author | Daniil Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Wed, 15 Dec 2010 20:10:03 +0300 |
parents | 4a2341bc90b1 |
children | 327ef1c21aab |
line diff
1.1 --- a/allpy/base.py Wed Dec 15 20:06:27 2010 +0300 1.2 +++ b/allpy/base.py Wed Dec 15 20:10:03 2010 +0300 1.3 @@ -169,25 +169,6 @@ 1.4 monomers = [monomer(letter) for letter in string] 1.5 return cls(monomers, name, description) 1.6 1.7 - @classmethod 1.8 - def file_slice(cls, file, n_from, n_to, fasta_name='', name='', description=''): 1.9 - """ Build and return sequence, consisting of part of sequence from file 1.10 - 1.11 - Does not control gaps 1.12 - """ 1.13 - inside = False 1.14 - number_used = 0 1.15 - s = '' 1.16 - for line in file: 1.17 - line = line.split() 1.18 - if not inside: 1.19 - if line.startswith('>%s' % fasta_name): 1.20 - inside = True 1.21 - else: 1.22 - n = len(line) 1.23 - s += line[(n_from - number_user):(n_to - number_user)] 1.24 - return cls.from_string(s, name, description) 1.25 - 1.26 class Alignment(dict): 1.27 """ Alignment 1.28