• <small id='28WpK'></small><noframes id='28WpK'>

  • <tfoot id='28WpK'></tfoot>
    <i id='28WpK'><tr id='28WpK'><dt id='28WpK'><q id='28WpK'><span id='28WpK'><b id='28WpK'><form id='28WpK'><ins id='28WpK'></ins><ul id='28WpK'></ul><sub id='28WpK'></sub></form><legend id='28WpK'></legend><bdo id='28WpK'><pre id='28WpK'><center id='28WpK'></center></pre></bdo></b><th id='28WpK'></th></span></q></dt></tr></i><div id='28WpK'><tfoot id='28WpK'></tfoot><dl id='28WpK'><fieldset id='28WpK'></fieldset></dl></div>

      <legend id='28WpK'><style id='28WpK'><dir id='28WpK'><q id='28WpK'></q></dir></style></legend>
        <bdo id='28WpK'></bdo><ul id='28WpK'></ul>

        如何保存像tsv这样的python输出

        时间:2023-10-19
        1. <small id='Gz2kM'></small><noframes id='Gz2kM'>

          <i id='Gz2kM'><tr id='Gz2kM'><dt id='Gz2kM'><q id='Gz2kM'><span id='Gz2kM'><b id='Gz2kM'><form id='Gz2kM'><ins id='Gz2kM'></ins><ul id='Gz2kM'></ul><sub id='Gz2kM'></sub></form><legend id='Gz2kM'></legend><bdo id='Gz2kM'><pre id='Gz2kM'><center id='Gz2kM'></center></pre></bdo></b><th id='Gz2kM'></th></span></q></dt></tr></i><div id='Gz2kM'><tfoot id='Gz2kM'></tfoot><dl id='Gz2kM'><fieldset id='Gz2kM'></fieldset></dl></div>
          <tfoot id='Gz2kM'></tfoot>

          • <legend id='Gz2kM'><style id='Gz2kM'><dir id='Gz2kM'><q id='Gz2kM'></q></dir></style></legend>

                  <bdo id='Gz2kM'></bdo><ul id='Gz2kM'></ul>
                    <tbody id='Gz2kM'></tbody>

                  本文介绍了如何保存像tsv这样的python输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  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_2_03_074.fastq", "fastq"):
                      print ("%s %s %s" % (record.id,record.seq, record.format("qual")))
                  

                  Thank you.

                  解决方案

                  That is fairly simple , instead of printing it you need to write that to a file.

                  with open("records.tsv", "w") as record_file:
                      for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"):
                          record_file.write("%s %s %s
                  " % (record.id,record.seq, record.format("qual")))
                  

                  And if you want to name the various columns in the file then you can use:

                  record_file.write("Record_Id    Record_Seq    Record_Qal
                  ")
                  

                  So the complete code may look like:

                  with open("records.tsv", "w") as record_file:
                      record_file.write("Record_Id    Record_Seq    Record_Qal
                  ")
                      for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"):
                          record_file.write(str(record.id)+"  "+str(record.seq)+"  "+ str(record.format("qual"))+"
                  ")
                  

                  这篇关于如何保存像tsv这样的python输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:TypeError: 数组 dtype ('object') 和格式说明符 ('%.18e 下一篇:在 NetworkX 中无法将图形保存为 jpg 或 png 文件

                  相关文章

                • <legend id='2v1Vu'><style id='2v1Vu'><dir id='2v1Vu'><q id='2v1Vu'></q></dir></style></legend>
                    <tfoot id='2v1Vu'></tfoot>
                      <bdo id='2v1Vu'></bdo><ul id='2v1Vu'></ul>

                  1. <small id='2v1Vu'></small><noframes id='2v1Vu'>

                      <i id='2v1Vu'><tr id='2v1Vu'><dt id='2v1Vu'><q id='2v1Vu'><span id='2v1Vu'><b id='2v1Vu'><form id='2v1Vu'><ins id='2v1Vu'></ins><ul id='2v1Vu'></ul><sub id='2v1Vu'></sub></form><legend id='2v1Vu'></legend><bdo id='2v1Vu'><pre id='2v1Vu'><center id='2v1Vu'></center></pre></bdo></b><th id='2v1Vu'></th></span></q></dt></tr></i><div id='2v1Vu'><tfoot id='2v1Vu'></tfoot><dl id='2v1Vu'><fieldset id='2v1Vu'></fieldset></dl></div>