How to save output from python like tsv

前端 未结 5 1208
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 02:10

I am using biopython package and I would like to save result like tsv file. This output from print to tsv.

for record in SeqIO.parse(\"/home/fil/Desktop/420_         


        
5条回答
  •  悲哀的现实
    2021-01-02 03:05

    I prefer using join() in this type of code:

    for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"):
        print ( '\t'.join((str(record.id), str(record.seq), str(record.format("qual"))) )
    

    The 'tab' character is \t and the join function takes the (3) arguments and prints them with a tab in between.

提交回复
热议问题