Created
September 28, 2018 13:16
-
-
Save ctb/94b811dccacbe559dd8d5241fa74cb19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" | |
Usage: | |
python -m screed db <sequencefile> | |
python extract-screed.py <list of names> <sequencefile> | |
""" | |
import argparse, screed, sys | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('names') | |
parser.add_argument('dbfile') | |
args = parser.parse_args() | |
names = set([ x.strip() for x in open(args.names) ]) | |
found = set() | |
db = screed.ScreedDB(args.dbfile) | |
for name in names: | |
record = db.get(name) | |
if record: | |
print('>{}\n{}'.format(record.name, record.sequence)) | |
else: | |
sys.stderr.write('key "{}" not in database\n'.format(name)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment