美文网首页
fastq长度计算

fastq长度计算

作者: 浩瀚之宇 | 来源:发表于2018-12-23 16:08 被阅读0次
    1. python
    from collections import Counter
    with open('srg1.r1.paired.fq','r') as Fileout, open('srg1.r1.paired.results.txt','w') as Filein:
      i = 4
      dic, arr = {}, []
      while True:
          line = Fileout.readline()
          i += 1
          if i%4 == 2:
              arr.append(len(str(line)))
          if not line:
              break
    
    1. shell
    awk 'NR%4 == 2 {lengths[length($0)]++} END {for (l in lengths) {print l, lengths[l]}}' file.fastq
    

    And

    awk 'NR%4 == 2 {lengths[length($0)]++ ; counter++} END {for (l in lengths) {print l, lengths[l]}; print "total reads: " counter}' file.fastq
    

    相关文章

      网友评论

          本文标题:fastq长度计算

          本文链接:https://www.haomeiwen.com/subject/ansnkqtx.html