Skip to content

Commit

Permalink
fix bug for jcvi
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangrengang committed Sep 19, 2023
1 parent 632777f commit f0e6764
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion evolution_example
Submodule evolution_example updated 1 files
+7 −7 README.md
10 changes: 6 additions & 4 deletions soi/mcscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -326,28 +327,29 @@ def __str__(self):
def __repr__(self):
return '<MCSCANX Collinearity parser>'
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
Expand Down

0 comments on commit f0e6764

Please sign in to comment.