Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kyclark committed Jan 26, 2021
1 parent 5aaf2c9 commit bb8659d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 7 additions & 6 deletions 19_blastomatic/solution1_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ def main():
if info := annots.get(seq_id):
num_written += 1
args.outfile.write(
args.delimiter.join([
seq_id,
hit.get('pident'),
info.get('depth'),
'"{}"'.format(info.get('lat_lon')),
]) + '\n')
args.delimiter.join(
map(lambda s: f'"{s}"', [
seq_id,
hit.get('pident'),
info.get('depth'),
info.get('lat_lon')
])) + '\n')

args.outfile.close()
print(f'Exported {num_written:,} to "{args.outfile.name}".')
Expand Down
7 changes: 4 additions & 3 deletions 19_blastomatic/solution4_pandas_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main():
""" Make a jazz noise here """

args = get_args()
annots = pd.read_csv(args.annotations)
annots = pd.read_csv(args.annotations, index_col='seq_id')
hits = pd.read_csv(args.hits,
delimiter=',',
names=[
Expand All @@ -82,8 +82,9 @@ def main():
'evalue', 'bitscore'
])

joined = hits[hits['pident'] >= args.pctid].join(
annots.set_index('seq_id'), on='qseqid', how='inner')
joined = hits[hits['pident'] >= args.pctid].join(annots,
on='qseqid',
how='inner')

# joined = pd.merge(hits[hits['pident'] >= args.pctid],
# annots,
Expand Down

0 comments on commit bb8659d

Please sign in to comment.