hinagawa

3_HW_BioInfa

Nov 10th, 2020 (edited)
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import re
  2.  
  3. if __name__ == '__main__':
  4.     f = open("reads1.fastq", "r")
  5.     k = 0
  6.     i = 0
  7.     let = 0
  8.     q_score = 0
  9.     for line in f:
  10.         line = line.strip()
  11.         if line.isalpha() and "D" not in line:
  12.             k += len(line)
  13.             for letter in line:
  14.                 let += 1
  15.         if line[0] == "@":
  16.             i += 1
  17.         if line == '+':
  18.             next_line = f.readline()
  19.             for l in next_line:
  20.                 if ord(l) - 33 >= 30:
  21.                     q_score += 1
  22.  
  23.     print(i)
  24.     print(k)
  25.     print(round(k / i, 2))
  26.     print(round(q_score / let * 100, 2))
  27.  
Add Comment
Please, Sign In to add comment