Skip to content

Commit

Permalink
removed outdated newline chars
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyunzhu committed Apr 24, 2020
1 parent 865c194 commit eaa6077
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hgtector/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def read_search_results(file, maxhits=None):
data = []
with read_file(file) as f:
for line in f:
line = line.rstrip('\r\n')
line = line.rstrip()
m = p.match(line)
if m:
if m.group(1) == 'ID':
Expand Down
4 changes: 2 additions & 2 deletions hgtector/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def write_prot():
fin = gzip.open(file, 'r')
cp = None
for line in fin:
line = line.rstrip('\r\n')
line = line.rstrip()
if line.startswith('>'):
write_prot()
p, name = line[1:].split(None, 1)
Expand Down Expand Up @@ -708,7 +708,7 @@ def build_taxdump(self):
fo = open(join(dir_, fname), 'w')
fi = open(join(self.tmpdir, fname), 'r')
for line in fi:
x = line.rstrip('\r\n').replace('\t|', '').split('\t')
x = line.rstrip().replace('\t|', '').split('\t')
if x[0] in ancs:
if key == 'nodes' or 'scientific name' in x:
fo.write(line)
Expand Down
12 changes: 6 additions & 6 deletions hgtector/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def input_wf(self):
scores = {}
with open(file, 'r') as f:
for line in f:
line = line.rstrip('\r\n')
line = line.rstrip()
if not line or line.startswith('#'):
continue
id_, score = line.split('\t')
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def parse_prev_results(fp, prots):
with open(fp, 'r') as f:
for line in f:
if line.startswith('# ID: '):
done.append(line[6:].rstrip('\r\n'))
done.append(line[6:].rstrip())
doneset = set(done)
for prot in prots:
if prot['id'] in doneset:
Expand Down Expand Up @@ -1684,7 +1684,7 @@ def parse_hit_table(self, file, lenmap=None):
lines = []
with open(file, 'r') as f:
for line in f:
line = line.rstrip('\r\n')
line = line.rstrip()
if line and not line.startswith('#'):
lines.append(line)
if ism8 is None:
Expand All @@ -1711,7 +1711,7 @@ def parse_def_table(self, lines):
ths = {x: getattr(self, x, 0) for x in (
'evalue', 'identity', 'coverage', 'maxhits')}
for line in lines:
line = line.rstrip('\r\n')
line = line.rstrip()
if not line or line.startswith('#'):
continue
x = line.split('\t')
Expand Down Expand Up @@ -1765,7 +1765,7 @@ def parse_m8_table(self, lines, lenmap):
ths = {x: getattr(self, x, 0) for x in (
'evalue', 'identity', 'coverage', 'maxhits')}
for line in lines:
line = line.rstrip('\r\n')
line = line.rstrip()
if not line or line.startswith('#'):
continue
x = line.split('\t')
Expand Down Expand Up @@ -2235,7 +2235,7 @@ def parse_self_m8(lines):
res = []
used = set()
for line in lines:
x = line.rstrip('\r\n').split('\t')
x = line.rstrip().split('\t')
if x[0].startswith('#'):
continue
if len(x) < 12:
Expand Down
10 changes: 5 additions & 5 deletions hgtector/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def read_input_prots(fp):
lines = []
with read_file(fp) as f:
for line in f:
line = line.rstrip('\r\n')
line = line.rstrip()
if not line or line.startswith('#'):
continue

Expand Down Expand Up @@ -360,7 +360,7 @@ def read_fasta(lines):
"""
seqs = []
for line in lines:
line = line.rstrip('\r\n')
line = line.rstrip()
if line.startswith('>'):
x = line[1:].split(None, 1)
seqs.append([x[0], get_product(x[1]) if len(x) > 1 else '', ''])
Expand Down Expand Up @@ -564,11 +564,11 @@ def read_taxdump(dir_):
taxdump = {}
with open(join(dir_, 'nodes.dmp'), 'r') as f:
for line in f:
x = line.rstrip('\r\n').replace('\t|', '').split('\t')
x = line.rstrip().replace('\t|', '').split('\t')
taxdump[x[0]] = {'parent': x[1], 'rank': x[2]}
with open(join(dir_, 'names.dmp'), 'r') as f:
for line in f:
x = line.rstrip('\r\n').replace('\t|', '').split('\t')
x = line.rstrip().replace('\t|', '').split('\t')
if len(x) < 4 or x[3] == 'scientific name':
try:
taxdump[x[0]]['name'] = x[1]
Expand Down Expand Up @@ -600,7 +600,7 @@ def read_prot2taxid(file):
res = {}
with read_file(file) as f:
for line in f:
x = line.rstrip('\r\n').split()
x = line.rstrip().split()
if len(x) == 1:
continue
if isncbi is None:
Expand Down

0 comments on commit eaa6077

Please sign in to comment.