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

# HG changeset patch
# User Boris Burkov
# Date 1332507114 -14400
# Node ID 370678689947f7ee66ac516a2e1022ac8981c929
# Parent 116f5bfc39b8907b5629cfc4eec8eb62cad86b2c
optparse added to blocks_finder

diff -r 116f5bfc39b8 -r 370678689947 sequence_based_blocks_search/blocks_finder.py
--- a/sequence_based_blocks_search/blocks_finder.py Tue Mar 20 22:08:55 2012 +0400
+++ b/sequence_based_blocks_search/blocks_finder.py Fri Mar 23 16:51:54 2012 +0400
@@ -10,6 +10,8 @@
import math
from functional_groups import functional_groups
from allpy.util import *
+from optparse import OptionParser
+

class SbbsProteinMonomer(protein.Monomer):
def __eq__(self, other):
@@ -418,8 +420,16 @@
sys.exit()
#creating markups
for sequence in alignment.sequences:
- sequence.add_markup('index')
- aim = alignment.add_markup('index')
+ if 'markups' in sequence.__dict__:
+ if 'index' in sequence.markups:
+ pass
+ else:
+ sequence.add_markup('index')
+ if 'markups' in alignment.__dict__:
+ if 'index' in alignment.markups:
+ aim = alignment.markups['index']
+ else:
+ aim = alignment.add_markup('index')
#inferring classes_of_equivalence = homologous monomers = connected_components from links
class_number = 0
for column in alignment.columns:
@@ -446,7 +456,11 @@


if __name__== '__main__':
- input_file = open(sys.argv[1])
+ usage = "usage: %prog [options] arg"
+ parser = OptionParser(usage)
+ parser.add_option("-c", "--classes", dest="output_classes", help="Name of optional output file with homology classes")
+ (options, args) = parser.parse_args()
+ input_file = open(args[0])
blocks = main(input_file)
if blocks == []:
sys.exit()
@@ -454,13 +468,15 @@
file_content=""
for index, block in enumerate(blocks):
for sequence in block.sequences:
- file_content+=str(str(sys.argv[1]))+"\t"+str(index)+"\t"+str(sequence.name)+"\t"
+ file_content+=str(str(args[1]))+"\t"+str(index)+"\t"+str(sequence.name)+"\t"
buffer=""
for column in block.columns:
buffer+=str(aim[column])+" "
if (len(buffer)!=0): buffer=buffer[:-1]
file_content+=buffer+"\n"

- output_file = open(sys.argv[2], 'w')
+ output_file = open(args[1], 'w')
output_file.write(file_content)

+ if options.output_classes:
+ create_file_with_monomer_homology(blocks[0].alignment, options.output_classes)