Skip to content

Commit

Permalink
fixing bug with reduce_to_genus that ignored first couple of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
transcript committed Feb 25, 2020
1 parent 2174648 commit 77cc4d0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions python_scripts/RefSeq_reduce_to_genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,16 @@ def string_find(usage_term):
# reading through input file
for line in input_file:
line_counter += 1
if line_counter > 6: #specified to avoid summary info in first 6 lines of file
splitline = line.split("\t")
Species_name = splitline[2].strip()
splitname = Species_name.split()
familyName = splitname[0]
if familyName in db.keys():
db[familyName] += int(splitline[1])
else:
db[familyName] = int(splitline[1])

total_entries += int(splitline[1])
splitline = line.split("\t")
Species_name = splitline[2].strip()
splitname = Species_name.split()
familyName = splitname[0]
if familyName in db.keys():
db[familyName] += int(splitline[1])
else:
db[familyName] = int(splitline[1])

total_entries += int(splitline[1])

# sorting the results from largest to smallest, writing to output file
for k, v in sorted(db.items(), key=lambda (k,v): -v):
Expand Down

0 comments on commit 77cc4d0

Please sign in to comment.