按_1 _2 排序fqlist 递归去空格
# -*- coding: utf-8 -*- # @Time : 2022/2/10 上午10:08 # @Author : lizhichao # @Email : 13652030758@163.com # @File : sort_Fqfile.py # @Software: PyCharm import sys def removeblank(fqlist): fqlist.remove("") if "" in fqlist: removeblank(fqlist) def sort_fqseq(fqpath,output): with open(fqpath,"r") as fqp,open(output,"w") as ot: content=fqp.readline() for line in fqp: linelist=line.strip().split(",") headdomain=linelist[:4] rawfqlist=linelist[4:] if "" in rawfqlist: removeblank(rawfqlist) fqlist=sorted(rawfqlist) content+="%s\n"%(",".join(headdomain+fqlist)) ot.write(content) if __name__=="__main__": fqpath=sys.argv[1] output=sys.argv[2] sort_fqseq(fqpath,output)
本文来自博客园,作者:BioinformaticsMaster,转载请注明原文链接:https://www.cnblogs.com/koujiaodahan/p/15878478.html
posted on 2022-02-10 11:51 BioinformaticsMaster 阅读(23) 评论(0) 编辑 收藏 举报