allpy
changeset 725:0a7917b4ca71
create_monomer_homology once tested to return (not sure, whether the answer is perfect). allpy.base is essentially like dendik's one now (Column now doesn't know its alignment).
author | Boris Burkov <BurkovBA@gmail.com> |
---|---|
date | Fri, 08 Jul 2011 18:30:04 +0400 |
parents | fd531580b9af |
children | dc3e9ff89ab5 |
files | allpy/base.py sequence_based_blocks_search/blocks_finder.py |
diffstat | 2 files changed, 6 insertions(+), 20 deletions(-) [+] |
line diff
1.1 --- a/allpy/base.py Fri Jul 08 16:20:20 2011 +0400 1.2 +++ b/allpy/base.py Fri Jul 08 18:30:04 2011 +0400 1.3 @@ -446,25 +446,10 @@ 1.4 types = base 1.5 """Mapping of related types. SHOULD be redefined in subclasses.""" 1.6 1.7 - def __init__(self, alignment): 1.8 - self.alignment = alignment 1.9 - super(Column, self).__init__() 1.10 - 1.11 def __hash__(self): 1.12 """Return hash by identity.""" 1.13 return id(self) 1.14 1.15 - def MyIndex(self): 1.16 - for index, column in enumerate(self.alignment.columns): 1.17 - if column is self: return index 1.18 - raise ValueException 1.19 - 1.20 - def __repr__(self): 1.21 - #!!!!!!!!! READ HOW index OF LIST COMPARES OBJECTS AND BASIC TYPES 1.22 - return "<Column %s>"%(str(self.MyIndex())) 1.23 - 1.24 - 1.25 - 1.26 1.27 class Block(Alignment): 1.28 """Block of alignment.
2.1 --- a/sequence_based_blocks_search/blocks_finder.py Fri Jul 08 16:20:20 2011 +0400 2.2 +++ b/sequence_based_blocks_search/blocks_finder.py Fri Jul 08 18:30:04 2011 +0400 2.3 @@ -3,7 +3,8 @@ 2.4 import sys 2.5 sys.path.append("../") 2.6 from allpy import protein 2.7 -from allpy markups import * 2.8 +from allpy.markups import * 2.9 +from allpy.homology import * 2.10 import copy 2.11 import math 2.12 from functional_groups import functional_groups 2.13 @@ -340,17 +341,17 @@ 2.14 """returns MonomerHomology object, given alignment 2.15 with links created by create_links function""" 2.16 #creating markup 2.17 - for sequence in alignment: 2.18 + for sequence in alignment.sequences: 2.19 sim=SequenceIndexMarkup(sequence) 2.20 sim.refresh() 2.21 #inferring classes_of_equivalence = homologous monomers = connected_components from links 2.22 output = MonomerHomology() 2.23 class_number = 0 2.24 for column in alignment.columns: 2.25 - remaining_sequences = copy.copy(column.sequences) 2.26 - while remaining_sequences!=0: 2.27 + remaining_sequences = copy.copy(column.keys()) 2.28 + while remaining_sequences!=[]: 2.29 connected_component = find_connected_component(remaining_sequences, column) 2.30 - if connected_component = []: 2.31 + if connected_component == []: 2.32 #create class for each of the remaining monomers 2.33 for sequence in remaining_sequences: 2.34 subset_of_sequences_in_column2monomer_homology_data(output, class_number, [sequence], column)