From f0e6764d8c5c73f59ccfd75215c689e60817bab8 Mon Sep 17 00:00:00 2001 From: zhangrengang Date: Tue, 19 Sep 2023 15:36:31 +0800 Subject: [PATCH] fix bug for jcvi --- evolution_example | 2 +- soi/mcscan.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/evolution_example b/evolution_example index beebb98..495753a 160000 --- a/evolution_example +++ b/evolution_example @@ -1 +1 @@ -Subproject commit beebb98418676b2488202ab878d2193fbb8fc46c +Subproject commit 495753af50d019e4b2599b95963fc78b09d7a571 diff --git a/soi/mcscan.py b/soi/mcscan.py index 94489b0..d08e690 100644 --- a/soi/mcscan.py +++ b/soi/mcscan.py @@ -284,6 +284,7 @@ def identify_orthologous_blocks(collinearities=None, orthologs=None, fout=sys.st total_oi += rc.oi * rc.N # info = rc.info + [ratio] # print >> sys.stderr, '\t'.join(map(str, info)) +# print(rc.source, rc.head, file=sys.stderr) rc.write(fout) if homo_class: substract = pairs - ortholog_pairs @@ -326,28 +327,29 @@ def __str__(self): def __repr__(self): return '' def write(self, f, ): - if self.head: + if self.has_head: f.write(self.header) f.write(self.block) def parse(self): if not self.homology: lines = [] head = [] - self.head = 1 + self.has_head = 1 for line in open(self.collinearity): line = lazy_decode(line) if re.compile(r'#+ Alignment').match(line): # mcscanx or wgdi if self.source is None and re.compile(r'# Alignment').match(line): self.source = 'wgdi' - self.head = 0 + self.has_head = 0 self.header = ''.join(head) if lines: self.parse_lines(lines) yield self lines = [] lines.append(line) - elif re.compile(r'####$').match(line): # jcvi + elif re.compile(r'###$').match(line): # jcvi self.source = 'jcvi' + self.has_head = 0 if lines: self.parse_lines(lines) yield self