{"id":5626,"date":"2020-01-10T17:27:50","date_gmt":"2020-01-10T17:27:50","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=5626"},"modified":"2020-01-10T17:27:57","modified_gmt":"2020-01-10T17:27:57","slug":"logomaker-quick-example","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2020\/01\/logomaker-quick-example\/","title":{"rendered":"Logomaker quick example"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"250\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2020\/01\/logo-1.png\" alt=\"\" class=\"wp-image-5628\"\/><\/figure>\n\n\n\n<p>I wanted to use Logomaker to make a sequence logo. While the <a href=\"https:\/\/logomaker.readthedocs.io\/en\/latest\/examples.html\">documentation<\/a> is pretty good there wasn&#8217;t an example that showed exactly what I wanted. Most likely this is obvious if you&#8217;re familiar with Pandas.<\/p>\n\n\n\n<p>The code below will load sequence probabilities from a tsv file, create a sequence logo and save it to logo.png<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nimport logomaker\n\nss_df = pd.read_csv('all.tsv', sep=&quot;\\t&quot;, index_col=0)\n\n# create Logo object\nss_logo = logomaker.Logo(ss_df,\n                         width=.8,\n                         color_scheme='NajafabadiEtAl2017',\n                         vpad=.05)\n\nss_logo.ax.set_ylabel('probability')\n\nplt.savefig('logo.png')\n\n<\/pre><\/div>\n\n\n<p> all.tsv contains the following:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npos     A       T       G       C\n0       0.1     0.2     0.3     0.4\n1       0.1     0.2     0.3     0.4\n2       0.1     0.2     0.3     0.4\n3       0.1     0.2     0.3     0.4\n4       0.1     0.2     0.3     0.4\n5       0.1     0.2     0.3     0.4\n6       0.1     0.2     0.3     0.4\n7       0.1     0.2     0.3     0.4\n8       0.1     0.2     0.3     0.4\n9       0.1     0.2     0.3     0.4\n\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>I wanted to use Logomaker to make a sequence logo. While the documentation is pretty good there wasn&#8217;t an example that showed exactly what I wanted. Most likely this is obvious if you&#8217;re familiar with Pandas. The code below will load sequence probabilities from a tsv file, create a sequence logo and save it to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-5626","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-1sK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=5626"}],"version-history":[{"count":1,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5626\/revisions"}],"predecessor-version":[{"id":5629,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5626\/revisions\/5629"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=5626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=5626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=5626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}