{"id":3683,"date":"2020-09-06T16:56:01","date_gmt":"2020-09-06T07:56:01","guid":{"rendered":"https:\/\/analysis-navi.com\/?p=3683"},"modified":"2025-06-08T15:16:48","modified_gmt":"2025-06-08T06:16:48","slug":"biopython%e3%81%ab%e3%82%88%e3%82%8b%e3%83%90%e3%82%a4%e3%82%aa%e3%83%87%e3%83%bc%e3%82%bf%e5%88%86%e6%9e%90%e5%85%a5%e9%96%80","status":"publish","type":"post","link":"https:\/\/analysis-navi.com\/?p=3683","title":{"rendered":"BioPython\u306b\u3088\u308b\u30d0\u30a4\u30aa\u30c7\u30fc\u30bf\u5206\u6790\u5165\u9580"},"content":{"rendered":"<p>BioPython\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046\u3068\u3001Python\u3067\u751f\u7269\u5b66\u95a2\u9023\u306e\u30c7\u30fc\u30bf\u5206\u6790\u3092\u7c21\u5358\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u3053\u306e\u8a18\u4e8b\u3067\u306f\u305d\u306e\u5165\u9580\u7de8\u3068\u3057\u3066\u3001BioPython\u3092\u7528\u3044\u305fDNA\u914d\u5217\u30c7\u30fc\u30bf\u306e\u57fa\u672c\u64cd\u4f5c\u306b\u3064\u3044\u3066\u6574\u7406\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>BioPython\u3068\u306f<\/h2>\n<p>\u30c7\u30fc\u30bf\u5206\u6790\u3092\u76ee\u7684\u3068\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u306fPython\u304c\u5e83\u304f\u6d3b\u7528\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\nBioPython\u306f\u3001<strong><span style=\"background-color: #87cefa;\">\u751f\u7269\u30c7\u30fc\u30bf\u306e\u5206\u6790\u3092Python\u3067\u5bb9\u6613\u306b\u884c\u3046\u305f\u3081\u306b\u958b\u767a\u3055\u308c\u305f\u30d1\u30c3\u30b1\u30fc\u30b8<\/span><\/strong>\u3067\u3059\u3002<\/p>\n<p>\u4f7f\u7528\u3059\u308b\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306bPython\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u5f8c\u3001pip\u30b3\u30de\u30f3\u30c9\u306a\u3069\u3067\u7121\u6599\u3067\u7c21\u5358\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u9069\u3059\u308b\u958b\u767a\u74b0\u5883\u306f\u4eba\u305d\u308c\u305e\u308c\u3067\u3059\u304c\u3001Jupyter notebook \/ JupyterLab\u3067\u306e\u5b9f\u884c\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/analysis-navi.com\/?p=1550\"><\/a><\/p>\n<h2>DNA\u914d\u5217\u306e\u5b9a\u7fa9<\/h2>\n<p>\u4eca\u56de\u306f\u3001\u9069\u5f53\u306a\u5869\u57fa\u914d\u5217\u30c7\u30fc\u30bf\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u305d\u308c\u3092\u8272\u3005\u3068\u7de8\u96c6\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">import Bio\nfrom Bio.Seq import Seq\ntest_seq = Seq(\"ATGCATGCAAAAAAA\")<\/pre>\n<p>\u307e\u305a\u306fBioPython\u3092import\u3057\u305f\u3089\u3001Seq\u95a2\u6570\u3067\u62ec\u3063\u3066\u6307\u5b9a\u3059\u308b\u6587\u5b57\u5217\u304c\u907a\u4f1d\u5b50\u914d\u5217\u3067\u3042\u308b\u3053\u3068\u3092\u5ba3\u8a00\u3057\u307e\u3059\u3002<br \/>\n\u305d\u308c\u3092\u4eca\u56de\u306ftest_seq\u3068\u3044\u3046\u5909\u6570\u306b\u683c\u7d0d\u3057\u307e\u3057\u305f\u3002\u3053\u306etest_seq\u3092\u8272\u3005\u3068\u3044\u3058\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>DNA\u914d\u5217\u306e\u64cd\u4f5c<\/h2>\n<h3>\u914d\u5217\u306e\u9577\u3055\u306e\u53d6\u5f97<\/h3>\n<p>\u914d\u5217\u306e\u9577\u3055\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u3001Python\u306e\u30ea\u30b9\u30c8\u64cd\u4f5c\u3068\u540c\u69d8\u306blen\u3092\u7528\u3044\u308c\u3070\u4e00\u77ac\u3067\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">len(test_seq)<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">15<\/pre>\n<h3>\u914d\u5217\u306e\u4e00\u90e8\u5206\u306e\u53d6\u5f97<\/h3>\n<p>\u914d\u5217\u306e\u4e00\u90e8\u5206\u3092\u53d6\u308a\u51fa\u3059\u65b9\u6cd5\u3082Python\u306e\u30ea\u30b9\u30c8\u64cd\u4f5c\u3068\u540c\u4e00\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u30013\u6587\u5b57\u76ee\u304b\u30896\u6587\u5b57\u76ee\u3092\u53d6\u308a\u51fa\u3057\u305f\u304b\u3063\u305f\u3089\u3001<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq[3:6]<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('CAT')<\/pre>\n<p>\u521d\u3081\u304b\u30896\u6587\u5b57\u3092\u53d6\u308a\u51fa\u3057\u305f\u304b\u3063\u305f\u3089\u3001<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq[:6]<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('ATGCAT')<\/pre>\n<p>\u304a\u5c3b\u304b\u30899\u6587\u5b57\u3092\u53d6\u308a\u51fa\u3057\u305f\u304b\u3063\u305f\u3089\u3001<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq[-9:]<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('GCAAAAAAA')<\/pre>\n<p>\u3068\u3044\u3046\u3088\u3046\u306b\u66f8\u3051\u3070\u3001\u914d\u5217\u306e\u4efb\u610f\u306e\u7b87\u6240\u3092\u5f15\u3063\u5f35\u3063\u3066\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u9006\u65b9\u5411\u914d\u5217\u306e\u53d6\u5f97<\/h3>\n<p>\u9006\u65b9\u5411\u306e\u914d\u5217\u3082Python\u306e\u30ea\u30b9\u30c8\u64cd\u4f5c\u3068\u540c\u69d8\u306e\u66f8\u304d\u65b9\u3092\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq[::-1]<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('AAAAAAACGTACGTA')<\/pre>\n<h3>\u76f8\u88dc\u5dee\u914d\u5217\u306e\u53d6\u5f97<\/h3>\n<p>BioPython\u306b\u306f\u76f8\u88dc\u9396\u914d\u5217\u3092\u53d6\u5f97\u3059\u308b\u72ec\u81ea\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq.complement()<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('TACGTACGTTTTTTT')<\/pre>\n<p>\u307e\u305f\u3001\u4e0a\u8a18\u306e\u7d50\u679c\u3092\u53cd\u8ee2\u3055\u305b\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u9006\u76f8\u88dc\u9396\u3082\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq.reverse_complement()<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('TTTTTTTGCATGCAT')<\/pre>\n<h3>\u8ee2\u5199\u3055\u308c\u305fRNA\u914d\u5217\u306e\u53d6\u5f97<\/h3>\n<p>RNA\u306b\u8ee2\u5199\u3055\u308c\u305f\u914d\u5217\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq.transcribe()<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('AUGCAUGCAAAAAAA', RNAAlphabet())<\/pre>\n<p>T(\u30c1\u30df\u30f3)\u304cU(\u30a6\u30e9\u30b7\u30eb)\u306b\u7f6e\u304d\u63db\u308f\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<br \/>\nSeq\u95a2\u6570\u306e\u7b2c2\u5f15\u6570\u306bRNA\u3067\u3042\u308b\u3053\u3068\u304c\u660e\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u7279\u306b\u6c17\u306b\u3059\u308b\u4e8b\u306a\u304f\u3053\u306e\u5909\u6570\u306f\u6271\u3063\u3066\u3044\u3051\u307e\u3059\u3002<\/p>\n<h3>\u7ffb\u8a33\u3055\u308c\u305f\u30a2\u30df\u30ce\u9178\u914d\u5217\u306e\u53d6\u5f97<\/h3>\n<p>\u30bf\u30f3\u30d1\u30af\u8cea\uff08\u30a2\u30df\u30ce\u9178\u914d\u5217\uff09\u306b\u7ffb\u8a33\u3055\u308c\u305f\u914d\u5217\u3082\u7c21\u5358\u306b\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq.translate()<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Seq('MHAKK', ExtendedIUPACProtein())<\/pre>\n<p>\u30a2\u30df\u30ce\u9178\u306e\u6163\u7528\u540d\u306fIUPAC\u547d\u540d\u6cd5\u306b\u5f93\u3063\u3066\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c81\u6587\u5b57\u3067\u8868\u73fe\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>GC\u542b\u6709\u91cf\u306e\u8a08\u7b97<\/h3>\n<p>GC\u542b\u6709\u91cf\u3092\u8a08\u7b97\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306b\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<strong>SeqUtils<\/strong>\u3068\u3044\u3046\u30af\u30e9\u30b9\u3092import\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">from Bio.SeqUtils import *\nGC(test_seq)<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">26.666666666666668<\/pre>\n<p>test_seq\u306eGC\u542b\u6709\u91cf\u306f\u7d0426.7%\u3060\u3068\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u30b3\u30c9\u30f3\u306e\u5834\u6240\u3054\u3068\u306eGC\u542b\u6709\u91cf\u3092\u8a08\u7b97\u3059\u308bGC123\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">GC123(test_seq)<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">(26.666666666666668, 40.0, 20.0, 20.0)<\/pre>\n<p>\u6570\u5024\u304c4\u3064\u51fa\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u3089\u306f\u305d\u308c\u305e\u308c\u3001<br \/>\n\u30fb\u914d\u5217\u5168\u4f53\u306eGC\u542b\u6709\u91cf<br \/>\n\u30fb\u5869\u57fa\u306e\u7b2c1\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u306eGC\u542b\u6709\u91cf<br \/>\n\u30fb\u5869\u57fa\u306e\u7b2c2\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u306eGC\u542b\u6709\u91cf<br \/>\n\u30fb\u5869\u57fa\u306e\u7b2c3\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u306eGC\u542b\u6709\u91cf<br \/>\n\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u69cb\u6210\u6bd4\u7387\u306e\u8a08\u7b97<\/h3>\n<p>\u3055\u3089\u306b\u7d30\u304b\u304f\u914d\u5217\u306e\u69cb\u6210\u60c5\u5831\u3092\u898b\u305f\u3044\u5834\u5408\u306f\u3001Python\u81ea\u4f53\u306e\u69d8\u3005\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u6d3b\u7528\u3059\u308c\u3070\u8272\u3005\u3068\u8abf\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001G\u3060\u3051\u306e\u6570\u3092\u77e5\u308a\u305f\u3044\u306a\u3089\u3001<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">test_seq.count(\"G\")<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">2<\/pre>\n<p>\u3068\u3057\u307e\u3059\u3002\u4e0a\u8ff0\u3057\u305flen\u3068\u7d44\u307f\u5408\u308f\u305b\u308c\u3070\u542b\u6709\u5272\u5408\u306e\u8a08\u7b97\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e00\u6c17\u306b\u3059\u3079\u3066\u306e\u8981\u7d20\u6570\u3092\u77e5\u308a\u305f\u3051\u308c\u3070\u3001<strong>collections<\/strong>\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"scroll:true font-size:15 line-height:18 lang:python decode:true \" title=\"Source Code\">from collections import Counter\nCounter(test_seq)<\/pre>\n<pre class=\"scroll:true theme:dark-terminal font-size:15 line-height:18 nums:false lang:sh decode:true\" title=\"Result\">Counter({'A': 9, 'T': 2, 'G': 2, 'C': 2})<\/pre>\n<p>4\u3064\u304f\u3089\u3044\u306a\u3089count\u30924\u56de\u4f7f\u3063\u3066\u3082\u5927\u3057\u305f\u624b\u9593\u3067\u306f\u7121\u3044\u3067\u3059\u304c\u3001\u6271\u3046\u914d\u5217\u304c\u30a2\u30df\u30ce\u9178\u914d\u5217\u306a\u3089\u3070\u3053\u3061\u3089\u306e\u65b9\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u306e\u3088\u3046\u306b\u3001DNA\u60c5\u5831\u306e\u57fa\u672c\u7684\u306a\u64cd\u4f5c\u30fb\u8a08\u7b97\u306f\u5168\u3066\u30b7\u30f3\u30d7\u30eb\u306b\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u751f\u7269\u30c7\u30fc\u30bf\u306e\u5206\u6790\u3092\u884c\u3046\u306a\u3089\u3070\u3001\u307e\u305a\u4f55\u306f\u3068\u3082\u3042\u308cBioPython\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BioPython\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046\u3068\u3001Python\u3067\u751f\u7269\u5b66\u95a2\u9023\u306e\u30c7\u30fc\u30bf\u5206\u6790\u3092\u7c21\u5358\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u3067\u306f\u305d\u306e\u5165\u9580\u7de8\u3068\u3057\u3066\u3001BioPython\u3092\u7528\u3044\u305fDNA\u914d\u5217\u30c7\u30fc\u30bf\u306e\u57fa\u672c\u64cd\u4f5c\u306b\u3064\u3044\u3066\u6574\u7406\u3057\u307e\u3057\u305f\u3002 BioPy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4974,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"swell_btn_cv_data":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[129],"tags":[132,134],"class_list":["post-3683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-study","tag-bio","tag-python"],"_links":{"self":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3683"}],"version-history":[{"count":9,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3683\/revisions"}],"predecessor-version":[{"id":5005,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3683\/revisions\/5005"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/media\/4974"}],"wp:attachment":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}