Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/866af8d04b7f
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:28:26 2012
Кодировка:
allpy: 866af8d04b7f

allpy

changeset 234:866af8d04b7f

repeats: fix bug with same lines in output file
author boris <bnagaev@gmail.com>
date Sun, 28 Nov 2010 17:40:11 +0300
parents b952465b3105
children 346a6cd4fc1d
files repeats/repeat_joiner.py repeats/test.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/repeats/repeat_joiner.py	Sat Nov 27 22:42:36 2010 +0300
     1.2 +++ b/repeats/repeat_joiner.py	Sun Nov 28 17:40:11 2010 +0300
     1.3 @@ -67,6 +67,9 @@
     1.4  
     1.5      def __ne__(self, other):
     1.6          return not (self == other)
     1.7 +    
     1.8 +    def tuple(self):
     1.9 +        return (self.start, self.end, self.ori, self.chromosome)
    1.10  
    1.11      def thin_edges(self, min_intersection=config.min_intersection):
    1.12          """ return all thin edges (intersected intervals) """
     2.1 --- a/repeats/test.py	Sat Nov 27 22:42:36 2010 +0300
     2.2 +++ b/repeats/test.py	Sun Nov 28 17:40:11 2010 +0300
     2.3 @@ -29,10 +29,10 @@
     2.4  print "group\tchr\tchr_from\tchr_to\tgroup_from\tgroup_to\tori\tgroup_ori"
     2.5  for i, interval_group in enumerate(rj.interval_groups):
     2.6      interval_group.sort(key=lambda i: i.group_start)
     2.7 -    prev = None
     2.8 +    prev = set()
     2.9      for interval in interval_group:
    2.10 -        if prev and interval == prev:
    2.11 +        if interval.tuple() in prev:
    2.12              continue
    2.13 -        prev = interval
    2.14 +        prev.add(interval.tuple())
    2.15          print "%i\t%s" % (i, str(interval).replace(' ', '\t')) 
    2.16