Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. g = 0
  2. c = 0
  3. a = 0
  4. t = 0
  5.  
  6. class ProcessData(threading.Thread):
  7. def __init__(self, batch):
  8. threading.Thread.__init__(self)
  9. self.batch = batch
  10. self.g = 0
  11. self.c = 0
  12. self.a = 0
  13. self.t = 0
  14. def run(self):
  15. global g, c, a, t
  16. threadLock.acquire()
  17. for line in self.batch:
  18. line = line.lower()
  19. for nucleotide in line:
  20. if nucleotide == "g":
  21. self.g += 1
  22. if nucleotide == "c":
  23. self.c += 1
  24. if nucleotide == "a":
  25. self.a += 1
  26. if nucleotide == "t":
  27. self.t += 1
  28. g += self.g
  29. c += self.c
  30. a += self.a
  31. t += self.t
  32. print(g+c+a+t)
  33. threadLock.release()
  34.  
  35. File "gc_threaded.py", line 49, in run t += self.t
  36. TypeError: unsupported operand type(s) for +=: 'ProcessData' and 'int'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement