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