Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. def all_uni_present(uni_list, uniprot_folder):
  2. uni_missing = []
  3. progress = ProgressBar(
  4. len(uni_list),
  5. start_msg="Verify that UniProt IDs are identical between DataFrames.",
  6. end_msg="Verification complete."
  7. )
  8. for uni in uni_list:
  9. uni_path = os.path.join(uniprot_folder, uni + '.fasta')
  10. if not os.path.exists(uni_path):
  11. uni_missing.append(uni)
  12. else:
  13. try:
  14. with open(uni_path, 'r', encoding='utf-8') as uni_fh:
  15. _ = SeqIO.read(uni_fh, "fasta").seq
  16. except ValueError:
  17. os.remove(uni_path)
  18. uni_missing.append(uni)
  19. progress.inc()
  20. return uni_missing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement