• <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输出

        How to save output from python like tsv(如何保存像tsv这样的python输出)
        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输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                  Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                  Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                  How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                  Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                  Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)
                • <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>

                          <tbody id='2v1Vu'></tbody>
                        • <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>