{"id":19397,"date":"2022-11-06T14:01:27","date_gmt":"2022-11-06T08:31:27","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/"},"modified":"2022-11-06T14:01:27","modified_gmt":"2022-11-06T08:31:27","slug":"solved-creating-a-list-of-lists-for-three-reading-frames-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/","title":{"rendered":"[Solved] Creating a List of Lists for Three Reading Frames [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-23710477\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"23710477\" data-parentid=\"23708460\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>I suppose you have a sequence of nucleotides from DNA and you want to know if there is any gen there in any of the three frames of the sequence. I recommend to use Biopython to do it but there are other ways to make it without using the &#8220;standard&#8221; solution. Here I present one of my own solution.<\/p>\n<p>The main problem is how to get the position of the methionine and the stop codons (The length is just a rest between where are they found.). To do that we need to know how are they:<\/p>\n<pre><code>start=\"AUG\"\nstop = ('UAA', 'UGA', 'UAG')\n<\/code><\/pre>\n<p>The start of the ORF is the codon that codifies for the methionine and the stop can be any of the amber, ochre or opal codons.<\/p>\n<p>Now we could get a list of where are they:<\/p>\n<pre><code>sequence = \"ATATAGACATCGAATACTAATAGCATACAGTCCAAATTCGGAGCCCGACATTCTTCGATAACGACCGCTGATTATATGGGGCTCCGTCTACTCTAGGAGTTCTTGGCTGAGCCCTTCTAATTACCCACCGGGTGGCACACCAAGGACCGAAAAACCGTGGCCCGTGGGGAAAGTATCAGAACGGTACGGACCGTTTTTCCACCTCAAGGGACACCTTTGTCCCCGCCAATTATGCCAACCTCTCATAGTATTATATCTCCTCAATTTCTATGTGCGCAGTGTCTGTATGTTAGGACGCGCATGCACTGAAATGGCGATAGTGTGAATACATAGGTCATCTTGTGCCAGTGGCTGACTGATCGTCTACAAGTGACAATGCTGTGAATAACAAGATTGTGCACATGTCTAACCCGTGAGCTGGAGCTCCATAGCTATGGAGCTCCAGCTCACGGGTTAGACATTTTACAGTAGCGTACATTTCTGGCCGACCAACAGTGCATGGAGTTCAAGGCACATCCTTACTAAATTCTCCGTGTCCAGATTTAACAGCGAAGACGCTTTCCACGGACACAAGTATGAAAAGCGGCCGAAGGGGTCATTTGGACCAATGGACTGTTAGCGATACGCAAGAGTGAAAGGCGGGCGATCCACATTACAAATCCCTATCAGGACTGCGAATAAGATTTTCCTGAATATGAGTGGTGTGGACAGAGCTATGTTTTTCGAATTCCGCACACTCGAGTGCGCGGCCTTCTCAGAGTTTTAAACTTTGCCTGGGTACTGATTATTATAGTCCAAGTAGAATAGTCACTCTATATTTTTAATAGAATGCGGGTGACACCGGCAAGAGAACCGAGCATTT\"\n\nstart=\"ATG\"\nstop = ('TAA', 'TGA', 'TAG')\nstop_positions = []\nstart_positions = []\n\n# Normal direction\nfor i in range(len(sequence)): # Create the index value\n    if sequence[i:].startswith(start): # Check if there is a methionine in this position.\n        start_positions.append(i)\n    else:\n        for stop_codon in stop:\n            if sequence[i::].startswith(stop_codon): # Check if there is a stop in this position.\n                stop_positions.append(i)\n                break\n<\/code><\/pre>\n<p>To invert them we can do <code>sequence = sequence[::-1]<\/code> and then repeat the above code. (Note that if you do that you will obtain the index reversed)<br \/>\nNow we need to get which are a ORF and which not. We can do so with a couple of loops:<\/p>\n<pre><code>for start_ in start_positions:\n    for  stop_ in stop_positions:\n        if stop_ &lt;= start_:\n            continue\n        else:\n            print(\"{}...{}\".format(start_, stop_))\n            break\n<\/code><\/pre>\n<p>To get the name of the frame is simple, divide by 3 the start and the modulus is the -1 is the frame. <\/p>\n<p>Here is the output of the above code, as you can see I didn&#8217;t implement everything you need but it is not much complicate to add it.<\/p>\n<pre><code>75...93\n231...245\n269...290\n286...290\n300...306\n310...317\n375...381\n401...406\n433...454\n498...522\n575...576\n607...616\n694...695\n715...763\n828...835\nReversed sequence\n# Note that the indexes start from 1, to get the real index do len(sequence) -index\n61...62 \n82...101\n286...287\n387...393\n392...393\n575...582\n612...613\n676...688\n687...688\n<\/code><\/pre>\n<p>Some notes:<\/p>\n<p>Check that the length is more than 1 nucleotide. One faster way is translate the sequence and get everything between a methionine and a stop code. This code works fine for python 3 if you have other versions you might need to change something.<\/p>\n<p>There is much to improve on this code to get the exact result you want if you can&#8217;t adapt this code to get it, you don&#8217;t really understand how it works comment below, or if you have advanced or you have a <strong>major<\/strong> problem with this start a new question and wait. (I don&#8217;t want to provide a direct answer to a Rosalind&#8217;s problem)<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">3<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Creating a List of Lists for Three Reading Frames [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] I suppose you have a sequence of nucleotides from DNA and you want to know if there is any gen there in any of the three frames of the sequence. I recommend to use Biopython to do it but there are other ways to make it without using the &#8220;standard&#8221; solution. Here I present &#8230; <a title=\"[Solved] Creating a List of Lists for Three Reading Frames [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/\" aria-label=\"More on [Solved] Creating a List of Lists for Three Reading Frames [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[969,349],"class_list":["post-19397","post","type-post","status-publish","format-standard","hentry","category-solved","tag-bioinformatics","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] I suppose you have a sequence of nucleotides from DNA and you want to know if there is any gen there in any of the three frames of the sequence. I recommend to use Biopython to do it but there are other ways to make it without using the &#8220;standard&#8221; solution. Here I present ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-06T08:31:27+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Creating a List of Lists for Three Reading Frames [closed]\",\"datePublished\":\"2022-11-06T08:31:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/\"},\"wordCount\":363,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"bioinformatics\",\"python\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/\",\"name\":\"[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-11-06T08:31:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Creating a List of Lists for Three Reading Frames [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb","og_description":"[ad_1] I suppose you have a sequence of nucleotides from DNA and you want to know if there is any gen there in any of the three frames of the sequence. I recommend to use Biopython to do it but there are other ways to make it without using the &#8220;standard&#8221; solution. Here I present ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/","og_site_name":"JassWeb","article_published_time":"2022-11-06T08:31:27+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Creating a List of Lists for Three Reading Frames [closed]","datePublished":"2022-11-06T08:31:27+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/"},"wordCount":363,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["bioinformatics","python"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/","name":"[Solved] Creating a List of Lists for Three Reading Frames [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-11-06T08:31:27+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-creating-a-list-of-lists-for-three-reading-frames-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Creating a List of Lists for Three Reading Frames [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1778218008","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/19397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=19397"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/19397\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=19397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=19397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=19397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}