Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/bf97a2bc9d08
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 08:09:59 2012
Кодировка:

# HG changeset patch
# User Andrei
# Date 1309961151 -14400
# Node ID bf97a2bc9d082fb17ddec61e73e9a89dc16fadba
# Parent 29eccc26343c81b06c9ca0b6388d4937d33a8fd5
In homology 'residue' changed to 'monomer' everywhere

diff -r 29eccc26343c -r bf97a2bc9d08 allpy/homology.py
--- a/allpy/homology.py Wed Jul 06 18:04:58 2011 +0400
+++ b/allpy/homology.py Wed Jul 06 18:05:51 2011 +0400
@@ -1,11 +1,11 @@
-class ResidueHomology(object):
- """ Essentially, alignment is a set of residue homology classes
- Object of type ResidueHomology desribes an alignment in terms of residue homology
- Currently, identifies of monomers and residue homology classes are used
+class MonomerHomology(object):
+ """ Essentially, alignment is a set of monomer homology classes
+ Object of type MonomerHomology desribes an alignment in terms of monomer homology
+ Currently, identifies of monomers and monomer homology classes are used

Each monomer of any sequence from an alignment must be contained in a homology class

- Homology of nonequal residues of the same sequence is allowed (formally),
+ Homology of nonequal monomers of the same sequence is allowed (formally),
but there is no implemented methods to deal with

DATA:
@@ -19,8 +19,8 @@

METHODS:
+ .read(file_name)
- + .wright_monomer(file,monomer_id,residue_homology_class_id)
- + .write_class(file,list_of_monomer_ids,residue_homology_class_id)
+ + .wright_monomer(file,monomer_id,monomer_homology_class_id)
+ + .write_class(file,list_of_monomer_ids,monomer_homology_class_id)
+ .write_block(file, block)
+ .compare_with(class)
"""
@@ -34,7 +34,7 @@

def read(self, file_name, columns = False):
"""
- Residue_homology file format is as follows
+ Monomer_homology file format is as follows
One line corresponds to one monomer.
Thus, number of lines with information is equal to the sum of all sequences lengths
Three obligatory fields are in each line:
@@ -137,21 +137,21 @@


def compare_with(self,other):
- """Compares two residue homology classes made on the same set of sequences: self and other
+ """Compares two monomer homology classes made on the same set of sequences: self and other
Both sets of classes MUST contain isomorfic sets of monomer_ids

RETURN two weighted averege number of mistakes: other vs self and self vs other
Number of mistakes other vs self in a homology class of self is
number of classes of other intersecting with the class of self minus one
In other words, one mistake of other is splitting a class of self
- (believed to be true residue homology class) into two classes
+ (believed to be true monomer homology class) into two classes
Wieght of a class of self is size of the class divided by total number of monomeres.

Different mesures and outputs may be implemented later.
"""

- mistakes_two_vs_one = ResidueHomology.two_vs_one(self, other) # mistakes are splitting self by intersections with other
- mistakes_one_vs_two = ResidueHomology.two_vs_one(other, self) # mistakes are splitting other by intersections with self
+ mistakes_two_vs_one = MonomerHomology.two_vs_one(self, other) # mistakes are splitting self by intersections with other
+ mistakes_one_vs_two = MonomerHomology.two_vs_one(other, self) # mistakes are splitting other by intersections with self

return (mistakes_two_vs_one, mistakes_one_vs_two)

@@ -160,7 +160,7 @@
""" Write a line "class_id sequence_id monome number \n" into file
"""
if len(monomer_id) != 2:
- raise Exception("wrong parameters given for Residue_homology.write_monomer: len(monomer_id) is not 2!")
+ raise Exception("wrong parameters given for Monomer_homology.write_monomer: len(monomer_id) is not 2!")
exit()
try:
if column_number:
@@ -178,13 +178,13 @@
""" Writes list of monomer_ids forming one homology_class
"""
for monomer_id in monomer_ids:
- ResidueHomology.write_monomer(file,monomer_id,class_id, column_number = column_number)
+ MonomerHomology.write_monomer(file,monomer_id,class_id, column_number = column_number)

#######################3#
def write_block(self,file,block,markedup = False):
""" Writes each block column into as one homology class
WARRNINGS:
- (1) method works in object of class ResidueHomology
+ (1) method works in object of class MonomerHomology
(2) all sequences MUST BE MARKED UP with resudue NUMBERS!
(3) automatic class ids (actually, numbers) are assigned to homology classes
(4) if markedup, then block MUST be marked up by column numbers
@@ -210,7 +210,7 @@
except:
raise Exception("Monomer has no number! Sequences must be marked up by numbers before .writ_block")
exit()
- ResidueHomology.write_monomer(file,monomer_id,self.next_class_id, column_number = column_number)
+ MonomerHomology.write_monomer(file,monomer_id,self.next_class_id, column_number = column_number)

self.next_class_id +=1

@@ -231,7 +231,7 @@


def highest_blocks(self):
- """ Makes blocks of maximal possible heights from residue homology classes
+ """ Makes blocks of maximal possible heights from monomer homology classes
block = set of homology classes with the same set of sequences
block MUST BE marked up by column numbers