001、 fasta序列迭代
(base) [email protected]:/home/test2# cat a.fasta ## 测试fasta文件 >gene1 myc AGCTGCCTAAGC GGCATAGCTAATCG >gene2 jun ACCGAATCGGAGCGATG GGCATTAAAGATCTAGCT >gene3 malat1 AGGCTAGCGAG GCGCGAG GATTAGGCG >>> import pyfastx ## 导入包 >>> fa = pyfastx.Fastx('a.fasta') ## 读取fasta文件 >>> type(fa) <class 'Fastx'> >>> for i,j,k in fa: ## 迭代, i默认那么; j序列; k注释。 ... print(i) ... print(j) ... print(k) ... gene1 AGCTGCCTAAGCGGCATAGCTAATCG myc gene2 ACCGAATCGGAGCGATGGGCATTAAAGATCTAGCT jun gene3 AGGCTAGCGAGGCGCGAGGATTAGGCG malat1
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/280079.html