001、
(base) [b20223040323@admin1 test]$ ls SRR1770413_1.fastq test.py (base) [b20223040323@admin1 test]$ cat test.py ## 脚本 #!/usr/bin/env python # -*- coding:utf-8 -*-in_file = open("SRR1770413_1.fastq", "r") out_file = open("result.txt", "w")gc_count = 0 total_base = 0lines = 0 for i in in_file:lines += 1if lines % 4 == 2:i = i.strip().upper()gc_count += i.count("G") + i.count("C")total_base += len(i)gc_percent = gc_count/total_base out_file.write("SRR1770413_1.fastq: " + str(gc_percent) + "\n")in_file.close() out_file.close() (base) [b20223040323@admin1 test]$ python test.py (base) [b20223040323@admin1 test]$ ls result.txt SRR1770413_1.fastq test.py (base) [b20223040323@admin1 test]$ cat result.txt ## 结果文件 SRR1770413_1.fastq: 0.5009478013778936
。