{"id":174,"date":"2024-01-18T19:43:47","date_gmt":"2024-01-18T11:43:47","guid":{"rendered":"https:\/\/www.kz-hub.tech\/?p=174"},"modified":"2024-01-18T19:43:47","modified_gmt":"2024-01-18T11:43:47","slug":"linux%e4%b8%ad%e5%b0%86%e6%96%87%e4%bb%b6%e5%a4%b9%e4%b8%8b%e6%9f%90%e5%89%8d%e7%bc%80%e7%9a%84%e6%96%87%e4%bb%b6%e8%bf%9b%e8%a1%8c%e6%96%87%e4%bb%b6%e5%90%8d%e7%bb%9f%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/www.kz-hub.tech\/index.php\/2024\/01\/18\/linux%e4%b8%ad%e5%b0%86%e6%96%87%e4%bb%b6%e5%a4%b9%e4%b8%8b%e6%9f%90%e5%89%8d%e7%bc%80%e7%9a%84%e6%96%87%e4%bb%b6%e8%bf%9b%e8%a1%8c%e6%96%87%e4%bb%b6%e5%90%8d%e7%bb%9f%e8%ae%a1\/","title":{"rendered":"Linux\u4e2d\u5c06\u6587\u4ef6\u5939\u4e0b\u67d0\u524d\u7f00\u7684\u6587\u4ef6\u8fdb\u884c\u6587\u4ef6\u540d\u7edf\u8ba1"},"content":{"rendered":"<pre><code class=\"language-python\">import os\n\n# \u83b7\u53d6\u5f53\u524d\u76ee\u5f55\u4e2d\u6240\u6709\u7684.fastq.gz\u6587\u4ef6\nfile_names = [f for f in os.listdir(&#039;.&#039;) if f.endswith(&#039;.fastq.gz&#039;)]\n\n# \u4f7f\u7528\u5b57\u5178\u5b58\u50a8\u5206\u7c7b\nfile_dict = {}\n\n# \u5bf9\u6587\u4ef6\u540d\u8fdb\u884c\u5206\u7c7b\nfor file in file_names:\n    prefix = file.split(&#039;_&#039;)[0]\n    if prefix in file_dict:\n        file_dict[prefix].append(file)\n    else:\n        file_dict[prefix] = [file]\n\n# \u5c06\u7ed3\u679c\u5199\u5165\u6587\u4ef6\nwith open(&#039;sample_filenames.txt&#039;, &#039;w&#039;) as output_file:\n    for prefix, files in file_dict.items():\n        output_file.write(f&quot;{prefix}\\t{&#039;; &#039;.join(files)}\\n&quot;)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>import os # \u83b7\u53d6\u5f53\u524d\u76ee\u5f55\u4e2d\u6240\u6709\u7684.fastq.gz\u6587\u4ef6 file_names = [f for f&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":1,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":175,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/174\/revisions\/175"}],"wp:attachment":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}