Guest User

Untitled

a guest
Oct 21st, 2019
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import argparse
  2.  
  3. from . import parse
  4.  
  5. from . import analysis
  6.  
  7.  
  8. LOC="uniprot_receptor.xml.gz"
  9.  
  10. def dump(args):
  11. for record in parse.uniprot_seqrecords(LOC):
  12. print(record)
  13.  
  14.  
  15.  
  16. def names(args):
  17. for record in parse.uniprot_seqrecords(LOC):
  18. print(record.name)
  19.  
  20.  
  21.  
  22. def average(args):
  23. print("Average Length is {}".format(
  24. analysis.average_len(parse.uniprot_seqrecords(LOC))))
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. def cli():
  32.  
  33. # create a new parser
  34.  
  35. parser = argparse.ArgumentParser(prog="uniplot")
  36.  
  37. subparsers = parser.add_subparsers(help="Sub Command Help")
  38.  
  39. ## add subparsers
  40.  
  41. subparsers.add_parser("dump").set_defaults(func=dump)
  42. subparsers.add_parser("list").set_defaults(func=names)
  43. subparsers.add_parser("average").set_defaults(func=average)
RAW Paste Data