Mercurial > repos > johnheap > vapper
changeset 16:c4e87b277576 draft
Uploaded
author | johnheap |
---|---|
date | Mon, 03 Jun 2019 15:58:48 -0400 |
parents | 597fe882966e |
children | 5e346d75ccf3 |
files | Tryp_G.py |
diffstat | 1 files changed, 367 insertions(+), 2489 deletions(-) [+] |
line wrap: on
line diff
--- a/Tryp_G.py Mon Jun 03 15:57:59 2019 -0400 +++ b/Tryp_G.py Mon Jun 03 15:58:48 2019 -0400 @@ -1,2528 +1,406 @@ - +""" + * Copyright 2018 University of Liverpool + * Author: John Heap, Computational Biology Facility, UoL + * Based on original scripts of Sara Silva Pereira, Institute of Infection and Global Health, UoL + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + """ +import subprocess +import re +import os +import sys +import shutil +import pandas as pd +import numpy as np +import matplotlib as mpl +mpl.use('Agg') +import matplotlib.pyplot as plt +from matplotlib.mlab import PCA +import seaborn as sns +# some globals for convenience +pList = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9', 'P10', 'P11', 'P12', 'P13', 'P14', 'P15'] + +quietString = "" #" >>"+os.path.dirname(os.path.realpath(__file__))+"/log/Vap_log.txt 2>&1" + +def assembleWithVelvet(name, kmers, inslen, covcut, fastq1name,fastq2name): + #argString = "velveth " + name + "_k65 65 -shortPaired -fastq " + name + "_R1.fastq " + name + "_R2.fastq" + argString = "velveth " + name + "_k"+ kmers+" "+ kmers + " -shortPaired -fastq " + fastq1name+" "+fastq2name+quietString + print(argString) + returncode = subprocess.call(argString, shell=True) + if returncode != 0: + return "Error in velveth" + argString = "velvetg " + name + "_k"+kmers+" -exp_cov auto -ins_length "+inslen+" -cov_cutoff "+covcut+" -clean yes -ins_length_sd 50 -min_pair_count 20"+quietString + #argString = "velvetg " + name + "_k65 -exp_cov auto -ins_length 400 -cov_cutoff 5 -clean yes -ins_length_sd 50 -min_pair_count 20"+quietString + print(argString) + returncode = subprocess.call(argString, shell = True) + if returncode != 0: + return "Error in velvetg" + shutil.copyfile(name + "_k"+kmers+"//contigs.fa",name + ".fa") # my $namechange = "mv ".$input."_k65/contigs.fa ".$input.".fa"; + return "ok" + +def contigTranslation(name): + argString = "transeq " + name + ".fa " + name + "_6frame.fas -frame=6 " #+quietString + print(argString) + returncode = subprocess.call(argString, shell=True) -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <link rel="dns-prefetch" href="https://github.githubassets.com"> - <link rel="dns-prefetch" href="https://avatars0.githubusercontent.com"> - <link rel="dns-prefetch" href="https://avatars1.githubusercontent.com"> - <link rel="dns-prefetch" href="https://avatars2.githubusercontent.com"> - <link rel="dns-prefetch" href="https://avatars3.githubusercontent.com"> - <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> - <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> +def HMMerMotifSearch(name): + motifs = ['1', '2a', '2b', '3', '4a', '4b', '4c', '5', '6', '7', '8a', '8b', '9a', '9b', + '9c', '10a', '10b', '11a', '11b', '12', '13a', '13b', '13c', '13d', '14', '15a', '15b', '15c'] + lineCounts = [] + compoundList = [] + dir_path = os.path.dirname(os.path.realpath(__file__)) + phylopath = dir_path + "/data/Motifs/Phylotype" + for m in motifs: + argString = "hmmsearch " + phylopath + m + ".hmm " + name + "_6frame.fas > Phy" + m + ".out" # +quietString + # argString = "hmmsearch "+phylopath + m + ".hmm " + dir_path+"/data/Test_6frame.fas > Phy" + m + ".out" + #print(argString) + subprocess.call(argString, shell=True) + + hmmResult = open("Phy" + m + ".out", 'r') + tempout = open(dir_path + "/data/" + "Phy" + m + ".txt", 'w') + #regex = r"NODE_[0-9]{1,7}_length_[0-9]{1,7}_cov_[0-9]{1,10}.[0-9]{1,7}_[0-9]{1,2}" + n = 0 + outList = [] + for l in range(0,14): + hmmResult.readline() #hacky? miss out the first 14 lines. data we want starts on line 15 + + + for line in hmmResult: + if re.search(r"inclusion", line): + #print("inclusion threshold reached") + break + if len(line) <= 1: + #print("end of data") + break + m = line[60:-1] + #print(m) + #tempout.write(m.group() + "\n") + outList.append("" + m + "\n") + n += 1 + compoundList.append(outList) + lineCounts.append(n) + hmmResult.close() + + + print(lineCounts) + motifGroups = [['1'], ['2a', '2b'], ['3'], ['4a', '4b', '4c'], ['5'], ['6'], ['7'], ['8a', '8b'], ['9a', '9b', + '9c'], + ['10a', '10b'], ['11a', '11b'], ['12'], ['13a', '13b', '13c', '13d'], ['14'], ['15a', '15b', '15c']] + concatGroups = [1, 2, 1, 3, 1, 1, 1, 2, 3, 2, 2, 1, 4, 1, 3] + countList = [] + countIndex = 0 + totalCount = 0 + + for c in concatGroups: + a = [] + for n in range(0, c): + a = a + compoundList.pop(0) + t = set(a) + countList.append(len(t)) + totalCount += len(t) + countList.append(totalCount) + #print(countList) + #print("--------") + return countList - <link crossorigin="anonymous" media="all" integrity="sha512-3+HOqCwtQal5hOJQ+mdxiq5zmGOTjF6RhjDsPLxbKDYgGlLFeCwzoIanb7j5IiCuXKUqyC2q8FdkC4nmx2P2rA==" rel="stylesheet" href="https://github.githubassets.com/assets/frameworks-a2fba223d5af91496cac70d4ec3624df.css" /> - <link crossorigin="anonymous" media="all" integrity="sha512-MRlTIqIyb8caK5+o8llXVntXovciHyAM4qE3kWU2S7SIjAPDxYp4mE0jQp4kP5UYegy+lG9y1I6VlsdzEjb5Qw==" rel="stylesheet" href="https://github.githubassets.com/assets/site-294181adec18ed639e160b96b45d17ac.css" /> - <link crossorigin="anonymous" media="all" integrity="sha512-XjvAy/mMWN5aOA+pyb/FgAgcVgJkPkwTCwvFK07Ez/H44lvl55ZLGwtpyL4MaMrwDE8QYO+1VYljKFjqr4/iJA==" rel="stylesheet" href="https://github.githubassets.com/assets/github-5b066aa36cc405c9cbcbadf1bde399ed.css" /> - - - - - - <meta name="viewport" content="width=device-width"> - - <title>VAPPER-Galaxy/Tryp_G.py at master · johnheap/VAPPER-Galaxy · GitHub</title> - <meta name="description" content="Contribute to johnheap/VAPPER-Galaxy development by creating an account on GitHub."> - <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> - <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> - <meta property="fb:app_id" content="1401488693436528"> - - <meta name="twitter:image:src" content="https://avatars0.githubusercontent.com/u/24318980?s=400&v=4" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary" /><meta name="twitter:title" content="johnheap/VAPPER-Galaxy" /><meta name="twitter:description" content="Contribute to johnheap/VAPPER-Galaxy development by creating an account on GitHub." /> - <meta property="og:image" content="https://avatars0.githubusercontent.com/u/24318980?s=400&v=4" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="johnheap/VAPPER-Galaxy" /><meta property="og:url" content="https://github.com/johnheap/VAPPER-Galaxy" /><meta property="og:description" content="Contribute to johnheap/VAPPER-Galaxy development by creating an account on GitHub." /> - - <link rel="assets" href="https://github.githubassets.com/"> - - <meta name="pjax-timeout" content="1000"> - - <meta name="request-id" content="A689:5C3D:C6144:14D916:5CF5617A" data-pjax-transient> - - - - - <meta name="selected-link" value="repo_source" data-pjax-transient> - - <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> - <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> - <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> - - <meta name="octolytics-host" content="collector.githubapp.com" /><meta name="octolytics-app-id" content="github" /><meta name="octolytics-event-url" content="https://collector.githubapp.com/github-external/browser_event" /><meta name="octolytics-dimension-request_id" content="A689:5C3D:C6144:14D916:5CF5617A" /><meta name="octolytics-dimension-region_edge" content="iad" /><meta name="octolytics-dimension-region_render" content="iad" /> -<meta name="analytics-location" content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true" /> - - +def relativeFrequencyTable(countList, name, htmlresource): + relFreqList = [] + c = float(countList[15]) + if c == 0: + return [0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0] + for i in range(0, 15): + relFreqList.append(countList[i] / c) - <meta name="google-analytics" content="UA-3769691-2"> - - -<meta class="js-ga-set" name="dimension1" content="Logged Out"> - - - - - - <meta name="hostname" content="github.com"> - <meta name="user-login" content=""> - - <meta name="expected-hostname" content="github.com"> - <meta name="js-proxy-site-detection-payload" content="MTYzNmJkYWI5MWFjYjU5OWIzMjNlMGQxYjEyNWJiODU0ZmQ2MGY0MmUyYWY1MTI1ZTIwOGEzNDY0Mjc4MDRjMXx7InJlbW90ZV9hZGRyZXNzIjoiMTI4LjExOC4yNTAuNSIsInJlcXVlc3RfaWQiOiJBNjg5OjVDM0Q6QzYxNDQ6MTREOTE2OjVDRjU2MTdBIiwidGltZXN0YW1wIjoxNTU5NTg1MTQ3LCJob3N0IjoiZ2l0aHViLmNvbSJ9"> - - <meta name="enabled-features" content="UNIVERSE_BANNER,MARKETPLACE_INVOICED_BILLING,MARKETPLACE_SOCIAL_PROOF_CUSTOMERS,MARKETPLACE_TRENDING_SOCIAL_PROOF,MARKETPLACE_RECOMMENDATIONS"> - - <meta name="html-safe-nonce" content="2948e5e4e89293d0a3b1401d89108155900da211"> - - <meta http-equiv="x-pjax-version" content="af1499c2254d0582d0a98af1dfd7f11b"> - - - <link href="https://github.com/johnheap/VAPPER-Galaxy/commits/master.atom" rel="alternate" title="Recent Commits to VAPPER-Galaxy:master" type="application/atom+xml"> - - <meta name="go-import" content="github.com/johnheap/VAPPER-Galaxy git https://github.com/johnheap/VAPPER-Galaxy.git"> - - <meta name="octolytics-dimension-user_id" content="24318980" /><meta name="octolytics-dimension-user_login" content="johnheap" /><meta name="octolytics-dimension-repository_id" content="139730674" /><meta name="octolytics-dimension-repository_nwo" content="johnheap/VAPPER-Galaxy" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="139730674" /><meta name="octolytics-dimension-repository_network_root_nwo" content="johnheap/VAPPER-Galaxy" /><meta name="octolytics-dimension-repository_explore_github_marketplace_ci_cta_shown" content="false" /> - - - <link rel="canonical" href="https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py" data-pjax-transient> - - - <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> - - <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> - - <link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> - <link rel="icon" type="image/x-icon" class="js-site-favicon" href="https://github.githubassets.com/favicon.ico"> - -<meta name="theme-color" content="#1e2327"> - + data = {'Phylotype': pList, 'Relative Frequency': relFreqList} + relFreq_df = pd.DataFrame(data) + j_fname = htmlresource+"/" + name + "_relative_frequency.csv" + relFreq_df.to_csv(j_fname) + return relFreqList # 0-14 = p1-p15 counts [15] = total counts - <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials"> - - </head> - - <body class="logged-out env-production page-responsive page-blob"> - - - <div class="position-relative js-header-wrapper "> - <a href="#start-of-content" tabindex="1" class="px-2 py-4 bg-blue text-white show-on-focus js-skip-to-content">Skip to content</a> - <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div> - - - - +def getDeviationFromMean(frequencyList, name, htmlresource): + devList = [] + dir_path = os.path.dirname(os.path.realpath(__file__)) + j_fname = dir_path + "/data/congodata.csv" + #j_fname = r"data/congodata.csv" + congo_df = pd.read_csv(j_fname) # we get the means from congo_df + for p in range(0, 15): + m = congo_df[pList[p]].mean() + dev = -(m - frequencyList[p]) + devList.append(dev) - - <header class="Header-old header-logged-out js-details-container Details position-relative f4 py-2" role="banner"> - <div class="container-lg d-lg-flex flex-items-center p-responsive"> - <div class="d-flex flex-justify-between flex-items-center"> - <a class="mr-4" href="https://github.com/" aria-label="Homepage" data-ga-click="(Logged out) Header, go to homepage, icon:logo-wordmark"> - <svg height="32" class="octicon octicon-mark-github text-white" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> - </a> - - <div class="d-lg-none css-truncate css-truncate-target width-fit p-2"> - - <svg class="octicon octicon-repo" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> - <a class="Header-link" href="/johnheap">johnheap</a> - / - <a class="Header-link" href="/johnheap/VAPPER-Galaxy">VAPPER-Galaxy</a> + data = {'Phylotype': pList, 'Deviation from Mean': devList} + dev_df = pd.DataFrame(data) + j_fname = htmlresource+"/" + name + "_deviation_from_mean.csv" + dev_df.to_csv(j_fname) + return devList - </div> - - <div class="d-flex flex-items-center"> - <a class="d-inline-block d-lg-none f5 text-white no-underline border border-gray-dark rounded-2 px-2 py-1 mr-3 mr-sm-5" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header","repository_id":null,"auth_type":"SIGN_UP","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="4db17299ef1e6914fe50cf1f55d7204f9f9e582ea6e290408c8afc23cff44645" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up" href="/join?source=header-repo"> - Sign up -</a> - <button class="btn-link d-lg-none mt-1 js-details-target" type="button" aria-label="Toggle navigation" aria-expanded="false"> - <svg height="24" class="octicon octicon-three-bars text-white" viewBox="0 0 12 16" version="1.1" width="18" aria-hidden="true"><path fill-rule="evenodd" d="M11.41 9H.59C0 9 0 8.59 0 8c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zm0-4H.59C0 5 0 4.59 0 4c0-.59 0-1 .59-1H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1h.01zM.59 11H11.4c.59 0 .59.41.59 1 0 .59 0 1-.59 1H.59C0 13 0 12.59 0 12c0-.59 0-1 .59-1z"/></svg> - </button> - </div> - </div> - - <div class="HeaderMenu HeaderMenu--logged-out position-fixed top-0 right-0 bottom-0 height-fit position-lg-relative d-lg-flex flex-justify-between flex-items-center flex-auto"> - <div class="d-flex d-lg-none flex-justify-end border-bottom bg-gray-light p-3"> - <button class="btn-link js-details-target" type="button" aria-label="Toggle navigation" aria-expanded="false"> - <svg height="24" class="octicon octicon-x text-gray" viewBox="0 0 12 16" version="1.1" width="18" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg> - </button> - </div> - - <nav class="mt-0 px-3 px-lg-0 mb-5 mb-lg-0" aria-label="Global"> - <ul class="d-lg-flex list-style-none"> - <li class="d-block d-lg-flex flex-lg-nowrap flex-lg-items-center border-bottom border-lg-bottom-0 mr-0 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center "> - <details class="HeaderMenu-details details-overlay details-reset width-full"> - <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> - Why GitHub? - <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> - <path d="M1,1l6.2,6L13,1"></path> - </svg> - </summary> - <div class="dropdown-menu flex-auto rounded-1 bg-white px-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> - <a href="/features" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Features">Features <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a> - <ul class="list-style-none f5 pb-3"> - <li class="edge-item-fix"><a href="/features/code-review/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Code review">Code review</a></li> - <li class="edge-item-fix"><a href="/features/project-management/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Project management">Project management</a></li> - <li class="edge-item-fix"><a href="/features/integrations" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Integrations">Integrations</a></li> - <li class="edge-item-fix"><a href="/features/actions" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Actions">Actions</a> - <li class="edge-item-fix"><a href="/features/package-registry" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Package Registry">Package registry</a> - <li class="edge-item-fix"><a href="/features#team-management" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Team management">Team management</a></li> - <li class="edge-item-fix"><a href="/features#social-coding" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Social coding">Social coding</a></li> - <li class="edge-item-fix"><a href="/features#documentation" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Documentation">Documentation</a></li> - <li class="edge-item-fix"><a href="/features#code-hosting" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Code hosting">Code hosting</a></li> - </ul> - - <ul class="list-style-none mb-0 border-lg-top pt-lg-3"> - <li class="edge-item-fix"><a href="/customer-stories" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Customer stories">Customer stories <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li> - <li class="edge-item-fix"><a href="/security" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Security">Security <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li> - </ul> - </div> - </details> - </li> - <li class="border-bottom border-lg-bottom-0 mr-0 mr-lg-3"> - <a href="/enterprise" class="HeaderMenu-link no-underline py-3 d-block d-lg-inline-block" data-ga-click="(Logged out) Header, go to Enterprise">Enterprise</a> - </li> - - <li class="d-block d-lg-flex flex-lg-nowrap flex-lg-items-center border-bottom border-lg-bottom-0 mr-0 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center "> - <details class="HeaderMenu-details details-overlay details-reset width-full"> - <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> - Explore - <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> - <path d="M1,1l6.2,6L13,1"></path> - </svg> - </summary> - - <div class="dropdown-menu flex-auto rounded-1 bg-white px-0 pt-2 pb-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> - <ul class="list-style-none mb-3"> - <li class="edge-item-fix"><a href="/explore" class="py-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Explore">Explore GitHub <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li> - </ul> - - <h4 class="text-gray-light text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Learn & contribute</h4> - <ul class="list-style-none mb-3"> - <li class="edge-item-fix"><a href="/topics" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Topics">Topics</a></li> - <li class="edge-item-fix"><a href="/collections" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Collections">Collections</a></li> - <li class="edge-item-fix"><a href="/trending" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Trending">Trending</a></li> - <li class="edge-item-fix"><a href="https://lab.github.com/" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Learning lab">Learning Lab</a></li> - <li class="edge-item-fix"><a href="https://opensource.guide" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Open source guides">Open source guides</a></li> - </ul> - - <h4 class="text-gray-light text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Connect with others</h4> - <ul class="list-style-none mb-0"> - <li class="edge-item-fix"><a href="https://github.com/events" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Events">Events</a></li> - <li class="edge-item-fix"><a href="https://github.community" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Community forum">Community forum</a></li> - <li class="edge-item-fix"><a href="https://education.github.com" class="py-2 pb-0 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to GitHub Education">GitHub Education</a></li> - </ul> - </div> - </details> - </li> - - <li class="border-bottom border-lg-bottom-0 mr-0 mr-lg-3"> - <a href="/marketplace" class="HeaderMenu-link no-underline py-3 d-block d-lg-inline-block" data-ga-click="(Logged out) Header, go to Marketplace">Marketplace</a> - </li> - - <li class="d-block d-lg-flex flex-lg-nowrap flex-lg-items-center border-bottom border-lg-bottom-0 mr-0 mr-lg-3 edge-item-fix position-relative flex-wrap flex-justify-between d-flex flex-items-center "> - <details class="HeaderMenu-details details-overlay details-reset width-full"> - <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> - Pricing - <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> - <path d="M1,1l6.2,6L13,1"></path> - </svg> - </summary> - - <div class="dropdown-menu flex-auto rounded-1 bg-white px-0 pt-2 pb-4 mt-0 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> - <a href="/pricing" class="pb-2 lh-condensed-ultra d-block link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Pricing">Plans <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a> - - <ul class="list-style-none mb-3"> - <li class="edge-item-fix"><a href="/pricing#feature-comparison" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Compare plans">Compare plans</a></li> - <li class="edge-item-fix"><a href="https://enterprise.github.com/contact" class="py-2 lh-condensed-ultra d-block link-gray no-underline f5" data-ga-click="(Logged out) Header, go to Contact Sales">Contact Sales</a></li> - </ul> - - <ul class="list-style-none mb-0 border-lg-top pt-lg-3"> - <li class="edge-item-fix"><a href="/nonprofit" class="py-2 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Nonprofits">Nonprofit <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li> - <li class="edge-item-fix"><a href="https://education.github.com" class="py-2 pb-0 lh-condensed-ultra d-block no-underline link-gray-dark no-underline h5 Bump-link--hover" data-ga-click="(Logged out) Header, go to Education">Education <span class="Bump-link-symbol float-right text-normal text-gray-light">→</span></a></li> - </ul> - </div> - </details> - </li> - </ul> - </nav> +def relativeFrequencyHeatMap(name, freqList, pdf, htmlresource): + localFreqList = freqList[:] + localFreqList.insert(0, name) + dir_path = os.path.dirname(os.path.realpath(__file__)) + j_fname = dir_path+"/data/congodata.csv" + #print(dir_path) + congo_df = pd.read_csv(j_fname) + congo_df.drop('Colour', axis=1, inplace=True) + congo_df.loc[congo_df.index.max() + 1] = localFreqList + ysize = len(congo_df) * 20 / 97.0 # make vertical size equivlanet 20' is ok for 97. - <div class="d-lg-flex flex-items-center px-3 px-lg-0 text-center text-lg-left"> - <div class="d-lg-flex mb-3 mb-lg-0"> - <div class="header-search flex-self-stretch flex-lg-self-auto mr-0 mr-lg-3 mb-3 mb-lg-0 scoped-search site-scoped-search js-site-search position-relative js-jump-to" - role="combobox" - aria-owns="jump-to-results" - aria-label="Search or jump to" - aria-haspopup="listbox" - aria-expanded="false" -> - <div class="position-relative"> - <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="139730674" data-scoped-search-url="/johnheap/VAPPER-Galaxy/search" data-unscoped-search-url="/search" action="/johnheap/VAPPER-Galaxy/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓" /> - <label class="form-control input-sm header-search-wrapper p-0 header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center js-chromeless-input-container"> - <input type="text" - class="form-control input-sm header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable" - data-hotkey="s,/" - name="q" - value="" - placeholder="Search" - data-unscoped-placeholder="Search GitHub" - data-scoped-placeholder="Search" - autocapitalize="off" - aria-autocomplete="list" - aria-controls="jump-to-results" - aria-label="Search" - data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations#csrf-token=9nFC/TA6FDAKMuNXw3enOJF6Z5i01AOdbn0jyVKtcamwMA8oxN0iwjwD6g/Gk0mUkRYceloKa1EiDDQCCe/w6g==" - spellcheck="false" - autocomplete="off" - > - <input type="hidden" class="js-site-search-type-field" name="type" > - <img src="https://github.githubassets.com/images/search-key-slash.svg" alt="" class="mr-2 header-search-key-slash"> - - <div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container"> - -<ul class="d-none js-jump-to-suggestions-template-container"> - - -<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-suggestion" role="option"> - <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href=""> - <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> - <svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> - <svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> - <svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg> - </div> - - <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28"> - - <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> - </div> - - <div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search"> - <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository"> - In this repository - </span> - <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub"> - All GitHub - </span> - <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - - <div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> - Jump to - <span class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - </a> -</li> - -</ul> - -<ul class="d-none js-jump-to-no-results-template-container"> - <li class="d-flex flex-justify-center flex-items-center f5 d-none js-jump-to-suggestion p-2"> - <span class="text-gray">No suggested jump to results</span> - </li> -</ul> - -<ul id="jump-to-results" role="listbox" class="p-0 m-0 js-navigation-container jump-to-suggestions-results-container js-jump-to-suggestions-results-container"> - - -<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-scoped-search d-none" role="option"> - <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href=""> - <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> - <svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> - <svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> - <svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg> - </div> - - <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28"> - - <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> - </div> - - <div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search"> - <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository"> - In this repository - </span> - <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub"> - All GitHub - </span> - <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - - <div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> - Jump to - <span class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - </a> -</li> - - - -<li class="d-flex flex-justify-start flex-items-center p-0 f5 navigation-item js-navigation-item js-jump-to-global-search d-none" role="option"> - <a tabindex="-1" class="no-underline d-flex flex-auto flex-items-center jump-to-suggestions-path js-jump-to-suggestion-path js-navigation-open p-2" href=""> - <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> - <svg height="16" width="16" class="octicon octicon-repo flex-shrink-0 js-jump-to-octicon-repo d-none" title="Repository" aria-label="Repository" viewBox="0 0 12 16" version="1.1" role="img"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> - <svg height="16" width="16" class="octicon octicon-project flex-shrink-0 js-jump-to-octicon-project d-none" title="Project" aria-label="Project" viewBox="0 0 15 16" version="1.1" role="img"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> - <svg height="16" width="16" class="octicon octicon-search flex-shrink-0 js-jump-to-octicon-search d-none" title="Search" aria-label="Search" viewBox="0 0 16 16" version="1.1" role="img"><path fill-rule="evenodd" d="M15.7 13.3l-3.81-3.83A5.93 5.93 0 0 0 13 6c0-3.31-2.69-6-6-6S1 2.69 1 6s2.69 6 6 6c1.3 0 2.48-.41 3.47-1.11l3.83 3.81c.19.2.45.3.7.3.25 0 .52-.09.7-.3a.996.996 0 0 0 0-1.41v.01zM7 10.7c-2.59 0-4.7-2.11-4.7-4.7 0-2.59 2.11-4.7 4.7-4.7 2.59 0 4.7 2.11 4.7 4.7 0 2.59-2.11 4.7-4.7 4.7z"/></svg> - </div> - - <img class="avatar mr-2 flex-shrink-0 js-jump-to-suggestion-avatar d-none" alt="" aria-label="Team" src="" width="28" height="28"> - - <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> - </div> - - <div class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none js-jump-to-badge-search"> - <span class="js-jump-to-badge-search-text-default d-none" aria-label="in this repository"> - In this repository - </span> - <span class="js-jump-to-badge-search-text-global d-none" aria-label="in all of GitHub"> - All GitHub - </span> - <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - - <div aria-hidden="true" class="border rounded-1 flex-shrink-0 bg-gray px-1 text-gray-light ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> - Jump to - <span class="d-inline-block ml-1 v-align-middle">↵</span> - </div> - </a> -</li> - - -</ul> - - </div> - </label> -</form> </div> -</div> - - </div> + congo_df.set_index('Strain', inplace=True) - <a class="HeaderMenu-link no-underline mr-3" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"LOG_IN","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="7fd1ed56b1c18a397e503e29aacaabdeee72055191ae165b50c2653e1b12dcee" data-ga-click="(Logged out) Header, clicked Sign in, text:sign-in" href="/login?return_to=%2Fjohnheap%2FVAPPER-Galaxy%2Fblob%2Fmaster%2FTryp_G.py"> - Sign in -</a> <a class="HeaderMenu-link d-inline-block no-underline border border-gray-dark rounded-1 px-2 py-1" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="c4ee822af15b8dc3e9aea42a32a712ba97b5159e47607cd4b7025cbaf04cede5" data-ga-click="(Logged out) Header, clicked Sign up, text:sign-up" href="/join?source=header-repo"> - Sign up -</a> </div> - </div> - </div> -</header> - - </div> - - <div id="start-of-content" class="show-on-focus"></div> - - - <div id="js-flash-container"> - -</div> - - - - <div class="application-main " data-commit-hovercards-enabled> - <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> - <main > - - - - - - - - - - - <div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav pt-0 pt-lg-4 "> - <div class="repohead-details-container clearfix container-lg p-responsive d-none d-lg-block"> - - <ul class="pagehead-actions"> - - - - - <li> - - <a class="tooltipped tooltipped-s btn btn-sm btn-with-count" aria-label="You must be signed in to watch a repository" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"notification subscription menu watch","repository_id":null,"auth_type":"LOG_IN","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="d368ea9efe1c5a2dcfce963197a8e1728bece5fbf672873089afee1360fc84b5" href="/login?return_to=%2Fjohnheap%2FVAPPER-Galaxy"> - <svg class="octicon octicon-eye v-align-text-bottom" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg> - Watch -</a> <a class="social-count" href="/johnheap/VAPPER-Galaxy/watchers" - aria-label="0 users are watching this repository"> - 0 - </a> - - </li> - - <li> - <a class="btn btn-sm btn-with-count tooltipped tooltipped-s" aria-label="You must be signed in to star a repository" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"star button","repository_id":139730674,"auth_type":"LOG_IN","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="ceea5226d4ab4d8521c883a628e33ec62a103b3de2b2586316b9ee1c827f8e8f" href="/login?return_to=%2Fjohnheap%2FVAPPER-Galaxy"> - <svg class="octicon octicon-star v-align-text-bottom" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"/></svg> - Star -</a> - <a class="social-count js-social-count" href="/johnheap/VAPPER-Galaxy/stargazers" - aria-label="0 users starred this repository"> - 0 - </a> - - </li> - - <li> - <a class="btn btn-sm btn-with-count tooltipped tooltipped-s" aria-label="You must be signed in to fork a repository" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"repo details fork button","repository_id":139730674,"auth_type":"LOG_IN","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="76fdcda7eb696b02b75ff43b473d377db9f594433e4409293c92f7c0238fba60" href="/login?return_to=%2Fjohnheap%2FVAPPER-Galaxy"> - <svg class="octicon octicon-repo-forked v-align-text-bottom" viewBox="0 0 10 16" version="1.1" width="10" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> - Fork -</a> - <a href="/johnheap/VAPPER-Galaxy/network/members" class="social-count" - aria-label="0 users forked this repository"> - 0 - </a> - </li> -</ul> - - <h1 class="public "> - <svg class="octicon octicon-repo" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"/></svg> - <span class="author" itemprop="author"><a class="url fn" rel="author" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=24318980" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/johnheap">johnheap</a></span><!-- ---><span class="path-divider">/</span><!-- ---><strong itemprop="name"><a data-pjax="#js-repo-pjax-container" href="/johnheap/VAPPER-Galaxy">VAPPER-Galaxy</a></strong> - - -</h1> - - </div> - -<nav class="hx_reponav reponav js-repo-nav js-sidenav-container-pjax container-lg p-responsive d-none d-lg-block" - itemscope - itemtype="http://schema.org/BreadcrumbList" - aria-label="Repository" - data-pjax="#js-repo-pjax-container"> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a class="js-selected-navigation-item selected reponav-item" itemprop="url" data-hotkey="g c" aria-current="page" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages /johnheap/VAPPER-Galaxy" href="/johnheap/VAPPER-Galaxy"> - <svg class="octicon octicon-code" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg> - <span itemprop="name">Code</span> - <meta itemprop="position" content="1"> -</a> </span> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a itemprop="url" data-hotkey="g i" class="js-selected-navigation-item reponav-item" data-selected-links="repo_issues repo_labels repo_milestones /johnheap/VAPPER-Galaxy/issues" href="/johnheap/VAPPER-Galaxy/issues"> - <svg class="octicon octicon-issue-opened" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg> - <span itemprop="name">Issues</span> - <span class="Counter">0</span> - <meta itemprop="position" content="2"> -</a> </span> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a data-hotkey="g p" itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="repo_pulls checks /johnheap/VAPPER-Galaxy/pulls" href="/johnheap/VAPPER-Galaxy/pulls"> - <svg class="octicon octicon-git-pull-request" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg> - <span itemprop="name">Pull requests</span> - <span class="Counter">0</span> - <meta itemprop="position" content="3"> -</a> </span> - - - <a data-hotkey="g b" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /johnheap/VAPPER-Galaxy/projects" href="/johnheap/VAPPER-Galaxy/projects"> - <svg class="octicon octicon-project" viewBox="0 0 15 16" version="1.1" width="15" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg> - Projects - <span class="Counter" >0</span> -</a> - - - <a data-skip-pjax="true" class="js-selected-navigation-item reponav-item" data-selected-links="security alerts policy /johnheap/VAPPER-Galaxy/security/advisories" href="/johnheap/VAPPER-Galaxy/security/advisories"> - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="octicon" height="16px" width="16px"> - <path fill-rule="evenodd" clip-rule="evenodd" d="M1 2l7-2 7 2v6.02C15 12.69 9.69 16 8 16c-1.69 0-7-3.31-7-7.98V2zm1 .75L8 1l6 1.75v5.268C14 12.104 9.45 15 8 15c-1.45 0-6-2.896-6-6.982V2.75z"></path> - <path d="M3 3.5L8 2v12c-1.207 0-5-2.482-5-5.985V3.5z"></path> -</svg> + cg = sns.clustermap(congo_df, method='ward', cmap = "RdBu_r", col_cluster=False, yticklabels = congo_df.index.values,figsize = (10,ysize)) + plt.setp(cg.ax_heatmap.yaxis.get_ticklabels(), rotation=0, fontsize=8) # get y labels printed horizontally + ax=cg.ax_heatmap + title = "Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$ estimated as the phylotype proportion across the\nsample cohort. " + title += "Dendrogram reflects the relationships amongst the VSG repertoires of each strain. " + title += "Strains\nwere isolated from multiple African countries as described in Silva Pereira et al. (2018)." + title += "\nData was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019)." - Security -</a> - <a class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors dependency_graph pulse people /johnheap/VAPPER-Galaxy/pulse" href="/johnheap/VAPPER-Galaxy/pulse"> - <svg class="octicon octicon-graph" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"/></svg> - Insights -</a> - -</nav> - - <div class="reponav-wrapper reponav-small d-lg-none"> - <nav class="reponav js-reponav text-center no-wrap" - itemscope - itemtype="http://schema.org/BreadcrumbList"> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a class="js-selected-navigation-item selected reponav-item" itemprop="url" aria-current="page" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages /johnheap/VAPPER-Galaxy" href="/johnheap/VAPPER-Galaxy"> - <span itemprop="name">Code</span> - <meta itemprop="position" content="1"> -</a> </span> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="repo_issues repo_labels repo_milestones /johnheap/VAPPER-Galaxy/issues" href="/johnheap/VAPPER-Galaxy/issues"> - <span itemprop="name">Issues</span> - <span class="Counter">0</span> - <meta itemprop="position" content="2"> -</a> </span> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="repo_pulls checks /johnheap/VAPPER-Galaxy/pulls" href="/johnheap/VAPPER-Galaxy/pulls"> - <span itemprop="name">Pull requests</span> - <span class="Counter">0</span> - <meta itemprop="position" content="3"> -</a> </span> - - <span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement"> - <a itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /johnheap/VAPPER-Galaxy/projects" href="/johnheap/VAPPER-Galaxy/projects"> - <span itemprop="name">Projects</span> - <span class="Counter">0</span> - <meta itemprop="position" content="4"> -</a> </span> - - - <a itemprop="url" class="js-selected-navigation-item reponav-item" data-selected-links="security alerts policy /johnheap/VAPPER-Galaxy/security/advisories" href="/johnheap/VAPPER-Galaxy/security/advisories"> - <span itemprop="name">Security</span> - <meta itemprop="position" content="6"> -</a> - <a class="js-selected-navigation-item reponav-item" data-selected-links="pulse /johnheap/VAPPER-Galaxy/pulse" href="/johnheap/VAPPER-Galaxy/pulse"> - Pulse -</a> - - </nav> -</div> - - - </div> -<div class="container-lg new-discussion-timeline experiment-repo-nav p-responsive"> - <div class="repository-content "> - - - - - - - - <a class="d-none js-permalink-shortcut" data-hotkey="y" href="/johnheap/VAPPER-Galaxy/blob/a4e16d71fe985f389930c02f94354b87d3aabadb/Tryp_G.py">Permalink</a> - - <!-- blob contrib key: blob_contributors:v21:2e1bab5e249bd4f439027dfdd07ba21c --> - <div class="signup-prompt-bg rounded-1"> - <div class="signup-prompt p-4 text-center mb-4 rounded-1"> - <div class="position-relative"> - <!-- '"` --><!-- </textarea></xmp> --></option></form><form action="/prompt_dismissals/signup" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="_method" value="put" /><input type="hidden" name="authenticity_token" value="rUlVltDIRxFtmVLWOALSaTw3jYYQnAkgOZNaBXl4TyU548taK3+va3xk4HBc3npM+B/jMCQq7vMKkG2ORne9cQ==" /> - <button type="submit" class="position-absolute top-0 right-0 btn-link link-gray" data-ga-click="(Logged out) Sign up prompt, clicked Dismiss, text:dismiss"> - Dismiss - </button> -</form> <h3 class="pt-2">Join GitHub today</h3> - <p class="col-6 mx-auto">GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.</p> - <a class="btn btn-primary" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"files signup prompt","repository_id":null,"auth_type":"SIGN_UP","client_id":null,"originating_request_id":"A689:5C3D:C6144:14D916:5CF5617A","originating_url":"https://github.com/johnheap/VAPPER-Galaxy/blob/master/Tryp_G.py","referrer":null,"user_id":null}}" data-hydro-click-hmac="93e6383cc468287e90a1abe17ee3e6216b82b1b7d4ae0b4a616d22c192163882" data-ga-click="(Logged out) Sign up prompt, clicked Sign up, text:sign-up" href="/join?source=prompt-blob-show">Sign up</a> - </div> - </div> - </div> - - - <div class="d-flex flex-items-start flex-shrink-0 mb-2 flex-column flex-md-row"> - <span class="d-flex flex-justify-between width-full width-md-auto"> - -<details class="details-reset details-overlay select-menu branch-select-menu hx_rsm" id="branch-select-menu"> - <summary class="btn btn-sm select-menu-button css-truncate" - data-hotkey="w" - - title="Switch branches or tags"> - <i>Branch:</i> - <span class="css-truncate-target">master</span> - </summary> - - <details-menu class="select-menu-modal hx_rsm-modal position-absolute" style="z-index: 99;" src="/johnheap/VAPPER-Galaxy/ref-list/master/Tryp_G.py?source_action=show&source_controller=blob" preload> - <include-fragment class="select-menu-loading-overlay anim-pulse"> - <svg height="32" class="octicon octicon-octoface" viewBox="0 0 16 16" version="1.1" width="32" aria-hidden="true"><path fill-rule="evenodd" d="M14.7 5.34c.13-.32.55-1.59-.13-3.31 0 0-1.05-.33-3.44 1.3-1-.28-2.07-.32-3.13-.32s-2.13.04-3.13.32c-2.39-1.64-3.44-1.3-3.44-1.3-.68 1.72-.26 2.99-.13 3.31C.49 6.21 0 7.33 0 8.69 0 13.84 3.33 15 7.98 15S16 13.84 16 8.69c0-1.36-.49-2.48-1.3-3.35zM8 14.02c-3.3 0-5.98-.15-5.98-3.35 0-.76.38-1.48 1.02-2.07 1.07-.98 2.9-.46 4.96-.46 2.07 0 3.88-.52 4.96.46.65.59 1.02 1.3 1.02 2.07 0 3.19-2.68 3.35-5.98 3.35zM5.49 9.01c-.66 0-1.2.8-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.54-1.78-1.2-1.78zm5.02 0c-.66 0-1.2.79-1.2 1.78s.54 1.79 1.2 1.79c.66 0 1.2-.8 1.2-1.79s-.53-1.78-1.2-1.78z"/></svg> - </include-fragment> - </details-menu> -</details> - - <div class="BtnGroup flex-shrink-0 d-md-none"> - <a href="/johnheap/VAPPER-Galaxy/find/master" - class="js-pjax-capture-input btn btn-sm BtnGroup-item" - data-pjax - data-hotkey="t"> - Find file - </a> - <clipboard-copy value="Tryp_G.py" class="btn btn-sm BtnGroup-item"> - Copy path - </clipboard-copy> - </div> - </span> - <h2 id="blob-path" class="breadcrumb flex-auto min-width-0 text-normal flex-md-self-center ml-md-2 mr-md-3 my-2 my-md-0"> - <span class="js-repo-root text-bold"><span class="js-path-segment"><a data-pjax="true" href="/johnheap/VAPPER-Galaxy"><span>VAPPER-Galaxy</span></a></span></span><span class="separator">/</span><strong class="final-path">Tryp_G.py</strong> - </h2> - - <div class="BtnGroup flex-shrink-0 d-none d-md-inline-block"> - <a href="/johnheap/VAPPER-Galaxy/find/master" - class="js-pjax-capture-input btn btn-sm BtnGroup-item" - data-pjax - data-hotkey="t"> - Find file - </a> - <clipboard-copy value="Tryp_G.py" class="btn btn-sm BtnGroup-item"> - Copy path - </clipboard-copy> - </div> - </div> - - - - <include-fragment src="/johnheap/VAPPER-Galaxy/contributors/master/Tryp_G.py" class="Box Box--condensed commit-loader"> - <div class="Box-body bg-blue-light f6"> - Fetching contributors… - </div> - - <div class="Box-body d-flex flex-items-center" > - <img alt="" class="loader-loading mr-2" src="https://github.githubassets.com/images/spinners/octocat-spinner-32-EAF2F5.gif" width="16" height="16" /> - <span class="text-red h6 loader-error">Cannot retrieve contributors at this time</span> - </div> -</include-fragment> - + #title = "Variant Antigen Profiles of Trypanosoma congolense estimated as the phylotype proportion across the sample cohort. Dendrogram reflects the relationships amongst the VSG repertoires of each strain. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018). Data was produced with the 'Variant Antigen Profiler' (Silva Pereira and Jackson, 2018)." + #ax.set_title(title, ha = "center", va = "bottom",wrap = "True") + #title = "Where is this!" + ax.text(-0.15,-0.05, title,va = "top",wrap = "True", transform = ax.transAxes ) - <div class="Box mt-3 position-relative"> - -<div class="Box-header py-2 d-flex flex-column flex-shrink-0 flex-md-row flex-md-items-center"> + # cg.dendrogram_col.linkage # linkage matrix for columns + # cg.dendrogram_row.linkage # linkage matrix for rows + #plt.savefig(r"results/" + name + "_heatmap.png") + plt.savefig(htmlresource+"/heatmap.png",bbox_inches='tight') + if pdf == 'PDF_Yes': + plt.savefig(htmlresource+"/heatmap.pdf", bbox_inches='tight') + #shutil.copyfile("heatmap.pdf",heatmapfn) # + #plt.show() - <div class="text-mono f6 flex-auto pr-3 flex-order-2 flex-md-order-1 mt-2 mt-md-0"> - 407 lines (338 sloc) - <span class="file-info-divider"></span> - 20.2 KB - </div> - - <div class="d-flex py-1 py-md-0 flex-auto flex-order-1 flex-md-order-2 flex-sm-grow-0 flex-justify-between"> - - <div class="BtnGroup"> - <a id="raw-url" class="btn btn-sm BtnGroup-item" href="/johnheap/VAPPER-Galaxy/raw/master/Tryp_G.py">Raw</a> - <a class="btn btn-sm js-update-url-with-hash BtnGroup-item" data-hotkey="b" href="/johnheap/VAPPER-Galaxy/blame/master/Tryp_G.py">Blame</a> - <a rel="nofollow" class="btn btn-sm BtnGroup-item" href="/johnheap/VAPPER-Galaxy/commits/master/Tryp_G.py">History</a> - </div> +def deviationFromMeanHeatMap(name,devList, pdf, htmlresource): + localDevList = devList[:] + localDevList.insert(0, name) + dir_path = os.path.dirname(os.path.realpath(__file__)) + j_fname = dir_path+ "/data/congodata_deviationfromthemean.csv" + #j_fname = r"data/congodata_deviationfromthemean.csv" + congo_df = pd.read_csv(j_fname) + congo_df.drop('Colour', axis=1, inplace=True) + congo_df.loc[congo_df.index.max() + 1] = localDevList + ysize = len(congo_df) * 20 / 97.0 # make vertical size equivlanet 20' is ok for 97. + congo_df.set_index('Strain', inplace=True) + cg = sns.clustermap(congo_df, method='ward',cmap = "RdBu_r", col_cluster=False, yticklabels = congo_df.index.values,figsize = (10,ysize)) + plt.setp(cg.ax_heatmap.yaxis.get_majorticklabels(), rotation=0, fontsize=8) # get y labels printed horizontally + ax = cg.ax_heatmap + title = "Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$ expressed as the deviation from the mean phylotypes " + title +="\nproportions of the sample cohort. Dendrogram reflects the relationships amongst the VSG repertoires of " + title +="each \nstrain. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018)." + title +="\nData was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019)." + #ax.set_title(title,ha = "center", va = "bottom",wrap = "True") + ax.text(-0.2, -0.05, title, va="top", transform=ax.transAxes, wrap="True") + plt.savefig(htmlresource+"/dheatmap.png",bbox_inches='tight') + if pdf == 'PDF_Yes': + plt.savefig(htmlresource+"/dheatmap.pdf", bbox_inches='tight') + #shutil.copyfile("dheatmap.pdf",dhmapfn) + #plt.show() - <div> +def plotPCA(name, freqList, pdf, htmlresource): + localFreqList = freqList[:] + localFreqList.insert(0, name) + localFreqList.append(name) + dir_path = os.path.dirname(os.path.realpath(__file__)) + j_fname = dir_path + "/data/congodata.csv" + #j_fname = r"data/congodata.csv" + congo_df = pd.read_csv(j_fname) + congo_df.loc[congo_df.index.max() + 1] = localFreqList + # print(congo_df.tail(2)) + myColours = congo_df['Colour'] + myCountries = congo_df.drop_duplicates('Colour')['Colour'].tolist() + # print(myCountries) + congo_df.drop('Colour', axis=1, inplace=True) + congo_df.set_index('Strain', inplace=True) + dataArray = congo_df.as_matrix() + pcaResult = PCA(dataArray) + # pcaResult.center(0) + # can't seem to find a simple way of prooducing a decent legend. + # going to seperate items in to different countires. + compoundList = [] + for i in myCountries: + compoundList.append([]) - <button type="button" class="btn-octicon disabled tooltipped tooltipped-nw" - aria-label="You must be signed in to make or propose changes"> - <svg class="octicon octicon-pencil" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"/></svg> - </button> - <button type="button" class="btn-octicon btn-octicon-danger disabled tooltipped tooltipped-nw" - aria-label="You must be signed in to make or propose changes"> - <svg class="octicon octicon-trashcan" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"/></svg> - </button> - </div> - </div> -</div> + i = 0 + for item in pcaResult.Y: + col = myCountries.index(myColours[i]) + compoundList[col].append(-item[0]) + compoundList[col].append(item[1]) + i = i + 1 + colormap = plt.cm.tab20 # nipy_spectral, Set1,Paired + cols = [colormap(i) for i in np.linspace(0, 1, 20)] + fig, ax = plt.subplots(figsize=(9, 6)) + #plt.figure(num=1,figsize=(12, 6)) + i = 0 + for d in myCountries: + a = compoundList[i] + b = a[::2] + c = a[1::2] + ax.scatter(b, c, color=cols[i], label=myCountries[i]) + i = i + 1 + leg = ax.legend( bbox_to_anchor=(1.02,1.02), loc = "upper left") #move legend out of plot + title = "Principal Component Analysis of the Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$. " \ + "The plot reflects the\nrelationships amongst the VSG repertoires of each strain. Strains are color-coded " \ + "by location of collection according\nto key. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018)." + title +="\nData was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019)." + #plt.title(title, ha = "center", va = "bottom",wrap = "True") + tx = ax.text(-0.1, -0.07, title, va="top", transform=ax.transAxes, wrap="True") + #fig.add_axes([0,0.05,1.05,1.05]) + #fig.tight_layout(rect=[0, 0.03, 1, 0.95]) + fig.subplots_adjust(bottom = 0.3) - + fig.savefig(htmlresource+"/vapPCA.png", bbox_extra_artists=(leg,tx), bbox_inches='tight') + #fig.savefig(htmlresource+"/vapPCA.png", bbox_extra_artists=(leg,)) + if pdf == 'PDF_Yes': + fig.savefig(htmlresource+"/vapPCA.pdf",bbox_extra_artists=(leg,tx), bbox_inches='tight') + #shutil.copyfile("vapPCA.pdf",PCAfn) # my $namechange = "mv ".$input."_k65/contigs.fa ".$input.".fa"; + #plt.show() + +def createHTML(name,htmlfn,freqList,devList): + #assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource + htmlString = r"<html><title>T.congolense VAP</title><body><div style='text-align:center'><h2><i>Trypanosoma congolense</i> Variant Antigen Profile</h2><h3>" + htmlString += name + htmlString += r"<br/>Genomic Analysis</h3>" + htmlString += "<p style = 'margin-left:23%; margin-right:23%'>Table Legend: Variant Antigen Profiles of <i>Trypanosoma congolense</i> estimated as the phylotype proportion and as the deviation from the mean across the sample cohort.<br>" \ + "Data was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019).</p>" + htmlString += r"<style> table, th, tr, td {border: 1px solid black; border-collapse: collapse;}</style>" + + htmlString += r"<table style='width:50%;margin-left:25%;text-align:center'><tr><th>Phylotype</th><th>Relative Frequency</th><th>Deviation from Mean</th></tr>" + tabString = "" + # flush out table with correct values + for i in range(0, 15): + f= format(freqList[i],'.4f') + d= format(devList[i],'.4f') + tabString += "<tr><td>phy" + str(i + 1) + "</td><td>" + f + "</td><td>" + d + "</td></tr>" + #tabString += "<tr><td>phy" + str(i + 1) + "</td><td>" + str(freqList[i]) + "</td><td>" + str(devList[i]) + "</td></tr>" + htmlString += tabString + "</table><br><br><br><br><br>" - <div itemprop="text" class="Box-body p-0 blob-wrapper data type-python "> - -<table class="highlight tab-size js-file-line-container" data-tab-size="8"> - <tr> - <td id="L1" class="blob-num js-line-number" data-line-number="1"></td> - <td id="LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-s"><span class="pl-pds">"""</span></span></td> - </tr> - <tr> - <td id="L2" class="blob-num js-line-number" data-line-number="2"></td> - <td id="LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * Copyright 2018 University of Liverpool</span></td> - </tr> - <tr> - <td id="L3" class="blob-num js-line-number" data-line-number="3"></td> - <td id="LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * Author: John Heap, Computational Biology Facility, UoL</span></td> - </tr> - <tr> - <td id="L4" class="blob-num js-line-number" data-line-number="4"></td> - <td id="LC4" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * Based on original scripts of Sara Silva Pereira, Institute of Infection and Global Health, UoL</span></td> - </tr> - <tr> - <td id="L5" class="blob-num js-line-number" data-line-number="5"></td> - <td id="LC5" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> *</span></td> - </tr> - <tr> - <td id="L6" class="blob-num js-line-number" data-line-number="6"></td> - <td id="LC6" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * Licensed under the Apache License, Version 2.0 (the "License");</span></td> - </tr> - <tr> - <td id="L7" class="blob-num js-line-number" data-line-number="7"></td> - <td id="LC7" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * you may not use this file except in compliance with the License.</span></td> - </tr> - <tr> - <td id="L8" class="blob-num js-line-number" data-line-number="8"></td> - <td id="LC8" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * You may obtain a copy of the License at</span></td> - </tr> - <tr> - <td id="L9" class="blob-num js-line-number" data-line-number="9"></td> - <td id="LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> *</span></td> - </tr> - <tr> - <td id="L10" class="blob-num js-line-number" data-line-number="10"></td> - <td id="LC10" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * http://www.apache.org/licenses/LICENSE-2.0</span></td> - </tr> - <tr> - <td id="L11" class="blob-num js-line-number" data-line-number="11"></td> - <td id="LC11" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> *</span></td> - </tr> - <tr> - <td id="L12" class="blob-num js-line-number" data-line-number="12"></td> - <td id="LC12" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * Unless required by applicable law or agreed to in writing, software</span></td> - </tr> - <tr> - <td id="L13" class="blob-num js-line-number" data-line-number="13"></td> - <td id="LC13" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * distributed under the License is distributed on an "AS IS" BASIS,</span></td> - </tr> - <tr> - <td id="L14" class="blob-num js-line-number" data-line-number="14"></td> - <td id="LC14" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></td> - </tr> - <tr> - <td id="L15" class="blob-num js-line-number" data-line-number="15"></td> - <td id="LC15" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * See the License for the specific language governing permissions and</span></td> - </tr> - <tr> - <td id="L16" class="blob-num js-line-number" data-line-number="16"></td> - <td id="LC16" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> * limitations under the License.</span></td> - </tr> - <tr> - <td id="L17" class="blob-num js-line-number" data-line-number="17"></td> - <td id="LC17" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> *</span></td> - </tr> - <tr> - <td id="L18" class="blob-num js-line-number" data-line-number="18"></td> - <td id="LC18" class="blob-code blob-code-inner js-file-line"><span class="pl-s"> <span class="pl-pds">"""</span></span></td> - </tr> - <tr> - <td id="L19" class="blob-num js-line-number" data-line-number="19"></td> - <td id="LC19" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L20" class="blob-num js-line-number" data-line-number="20"></td> - <td id="LC20" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> subprocess</td> - </tr> - <tr> - <td id="L21" class="blob-num js-line-number" data-line-number="21"></td> - <td id="LC21" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> re</td> - </tr> - <tr> - <td id="L22" class="blob-num js-line-number" data-line-number="22"></td> - <td id="LC22" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> os</td> - </tr> - <tr> - <td id="L23" class="blob-num js-line-number" data-line-number="23"></td> - <td id="LC23" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> sys</td> - </tr> - <tr> - <td id="L24" class="blob-num js-line-number" data-line-number="24"></td> - <td id="LC24" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> shutil</td> - </tr> - <tr> - <td id="L25" class="blob-num js-line-number" data-line-number="25"></td> - <td id="LC25" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> pandas <span class="pl-k">as</span> pd</td> - </tr> - <tr> - <td id="L26" class="blob-num js-line-number" data-line-number="26"></td> - <td id="LC26" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> numpy <span class="pl-k">as</span> np</td> - </tr> - <tr> - <td id="L27" class="blob-num js-line-number" data-line-number="27"></td> - <td id="LC27" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> matplotlib <span class="pl-k">as</span> mpl</td> - </tr> - <tr> - <td id="L28" class="blob-num js-line-number" data-line-number="28"></td> - <td id="LC28" class="blob-code blob-code-inner js-file-line">mpl.use(<span class="pl-s"><span class="pl-pds">'</span>Agg<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L29" class="blob-num js-line-number" data-line-number="29"></td> - <td id="LC29" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> matplotlib.pyplot <span class="pl-k">as</span> plt</td> - </tr> - <tr> - <td id="L30" class="blob-num js-line-number" data-line-number="30"></td> - <td id="LC30" class="blob-code blob-code-inner js-file-line"><span class="pl-k">from</span> matplotlib.mlab <span class="pl-k">import</span> <span class="pl-c1">PCA</span></td> - </tr> - <tr> - <td id="L31" class="blob-num js-line-number" data-line-number="31"></td> - <td id="LC31" class="blob-code blob-code-inner js-file-line"><span class="pl-k">import</span> seaborn <span class="pl-k">as</span> sns</td> - </tr> - <tr> - <td id="L32" class="blob-num js-line-number" data-line-number="32"></td> - <td id="LC32" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L33" class="blob-num js-line-number" data-line-number="33"></td> - <td id="LC33" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">#</span> some globals for convenience</span></td> - </tr> - <tr> - <td id="L34" class="blob-num js-line-number" data-line-number="34"></td> - <td id="LC34" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L35" class="blob-num js-line-number" data-line-number="35"></td> - <td id="LC35" class="blob-code blob-code-inner js-file-line">pList <span class="pl-k">=</span> [<span class="pl-s"><span class="pl-pds">'</span>P1<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P2<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P3<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P4<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P5<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P6<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P7<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P8<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P9<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P10<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P11<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P12<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P13<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P14<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>P15<span class="pl-pds">'</span></span>]</td> - </tr> - <tr> - <td id="L36" class="blob-num js-line-number" data-line-number="36"></td> - <td id="LC36" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L37" class="blob-num js-line-number" data-line-number="37"></td> - <td id="LC37" class="blob-code blob-code-inner js-file-line">quietString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span> <span class="pl-c"><span class="pl-c">#</span>" >>"+os.path.dirname(os.path.realpath(__file__))+"/log/Vap_log.txt 2>&1"</span></td> - </tr> - <tr> - <td id="L38" class="blob-num js-line-number" data-line-number="38"></td> - <td id="LC38" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L39" class="blob-num js-line-number" data-line-number="39"></td> - <td id="LC39" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">assembleWithVelvet</span>(<span class="pl-smi">name</span>, <span class="pl-smi">kmers</span>, <span class="pl-smi">inslen</span>, <span class="pl-smi">covcut</span>, <span class="pl-smi">fastq1name</span>,<span class="pl-smi">fastq2name</span>):</td> - </tr> - <tr> - <td id="L40" class="blob-num js-line-number" data-line-number="40"></td> - <td id="LC40" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>argString = "velveth " + name + "_k65 65 -shortPaired -fastq " + name + "_R1.fastq " + name + "_R2.fastq"</span></td> - </tr> - <tr> - <td id="L41" class="blob-num js-line-number" data-line-number="41"></td> - <td id="LC41" class="blob-code blob-code-inner js-file-line"> argString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>velveth <span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_k<span class="pl-pds">"</span></span><span class="pl-k">+</span> kmers<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span><span class="pl-k">+</span> kmers <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span> -shortPaired -fastq <span class="pl-pds">"</span></span> <span class="pl-k">+</span> fastq1name<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span><span class="pl-k">+</span>fastq2name<span class="pl-k">+</span>quietString</td> - </tr> - <tr> - <td id="L42" class="blob-num js-line-number" data-line-number="42"></td> - <td id="LC42" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(argString)</td> - </tr> - <tr> - <td id="L43" class="blob-num js-line-number" data-line-number="43"></td> - <td id="LC43" class="blob-code blob-code-inner js-file-line"> returncode <span class="pl-k">=</span> subprocess.call(argString, <span class="pl-v">shell</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L44" class="blob-num js-line-number" data-line-number="44"></td> - <td id="LC44" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> returncode <span class="pl-k">!=</span> <span class="pl-c1">0</span>:</td> - </tr> - <tr> - <td id="L45" class="blob-num js-line-number" data-line-number="45"></td> - <td id="LC45" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">"</span>Error in velveth<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L46" class="blob-num js-line-number" data-line-number="46"></td> - <td id="LC46" class="blob-code blob-code-inner js-file-line"> argString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>velvetg <span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_k<span class="pl-pds">"</span></span><span class="pl-k">+</span>kmers<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span> -exp_cov auto -ins_length <span class="pl-pds">"</span></span><span class="pl-k">+</span>inslen<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span> -cov_cutoff <span class="pl-pds">"</span></span><span class="pl-k">+</span>covcut<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span> -clean yes -ins_length_sd 50 -min_pair_count 20<span class="pl-pds">"</span></span><span class="pl-k">+</span>quietString</td> - </tr> - <tr> - <td id="L47" class="blob-num js-line-number" data-line-number="47"></td> - <td id="LC47" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>argString = "velvetg " + name + "_k65 -exp_cov auto -ins_length 400 -cov_cutoff 5 -clean yes -ins_length_sd 50 -min_pair_count 20"+quietString</span></td> - </tr> - <tr> - <td id="L48" class="blob-num js-line-number" data-line-number="48"></td> - <td id="LC48" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(argString)</td> - </tr> - <tr> - <td id="L49" class="blob-num js-line-number" data-line-number="49"></td> - <td id="LC49" class="blob-code blob-code-inner js-file-line"> returncode <span class="pl-k">=</span> subprocess.call(argString, <span class="pl-v">shell</span> <span class="pl-k">=</span> <span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L50" class="blob-num js-line-number" data-line-number="50"></td> - <td id="LC50" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> returncode <span class="pl-k">!=</span> <span class="pl-c1">0</span>:</td> - </tr> - <tr> - <td id="L51" class="blob-num js-line-number" data-line-number="51"></td> - <td id="LC51" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">"</span>Error in velvetg<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L52" class="blob-num js-line-number" data-line-number="52"></td> - <td id="LC52" class="blob-code blob-code-inner js-file-line"> shutil.copyfile(name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_k<span class="pl-pds">"</span></span><span class="pl-k">+</span>kmers<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>//contigs.fa<span class="pl-pds">"</span></span>,name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.fa<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">#</span> my $namechange = "mv ".$input."_k65/contigs.fa ".$input.".fa";</span></td> - </tr> - <tr> - <td id="L53" class="blob-num js-line-number" data-line-number="53"></td> - <td id="LC53" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-s"><span class="pl-pds">"</span>ok<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L54" class="blob-num js-line-number" data-line-number="54"></td> - <td id="LC54" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L55" class="blob-num js-line-number" data-line-number="55"></td> - <td id="LC55" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">contigTranslation</span>(<span class="pl-smi">name</span>):</td> - </tr> - <tr> - <td id="L56" class="blob-num js-line-number" data-line-number="56"></td> - <td id="LC56" class="blob-code blob-code-inner js-file-line"> argString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>transeq <span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.fa <span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_6frame.fas -frame=6 <span class="pl-pds">"</span></span> <span class="pl-c"><span class="pl-c">#</span>+quietString</span></td> - </tr> - <tr> - <td id="L57" class="blob-num js-line-number" data-line-number="57"></td> - <td id="LC57" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(argString)</td> - </tr> - <tr> - <td id="L58" class="blob-num js-line-number" data-line-number="58"></td> - <td id="LC58" class="blob-code blob-code-inner js-file-line"> returncode <span class="pl-k">=</span> subprocess.call(argString, <span class="pl-v">shell</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L59" class="blob-num js-line-number" data-line-number="59"></td> - <td id="LC59" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L60" class="blob-num js-line-number" data-line-number="60"></td> - <td id="LC60" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L61" class="blob-num js-line-number" data-line-number="61"></td> - <td id="LC61" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">HMMerMotifSearch</span>(<span class="pl-smi">name</span>):</td> - </tr> - <tr> - <td id="L62" class="blob-num js-line-number" data-line-number="62"></td> - <td id="LC62" class="blob-code blob-code-inner js-file-line"> motifs <span class="pl-k">=</span> [<span class="pl-s"><span class="pl-pds">'</span>1<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>2a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>2b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>3<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>4a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>4b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>4c<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>5<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>6<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>7<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>8a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>8b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>9a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>9b<span class="pl-pds">'</span></span>,</td> - </tr> - <tr> - <td id="L63" class="blob-num js-line-number" data-line-number="63"></td> - <td id="LC63" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">'</span>9c<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>10a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>10b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>11a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>11b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>12<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13c<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13d<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>14<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>15a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>15b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>15c<span class="pl-pds">'</span></span>]</td> - </tr> - <tr> - <td id="L64" class="blob-num js-line-number" data-line-number="64"></td> - <td id="LC64" class="blob-code blob-code-inner js-file-line"> lineCounts <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L65" class="blob-num js-line-number" data-line-number="65"></td> - <td id="LC65" class="blob-code blob-code-inner js-file-line"> compoundList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L66" class="blob-num js-line-number" data-line-number="66"></td> - <td id="LC66" class="blob-code blob-code-inner js-file-line"> dir_path <span class="pl-k">=</span> os.path.dirname(os.path.realpath(<span class="pl-c1">__file__</span>))</td> - </tr> - <tr> - <td id="L67" class="blob-num js-line-number" data-line-number="67"></td> - <td id="LC67" class="blob-code blob-code-inner js-file-line"> phylopath <span class="pl-k">=</span> dir_path <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>/data/Motifs/Phylotype<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L68" class="blob-num js-line-number" data-line-number="68"></td> - <td id="LC68" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> m <span class="pl-k">in</span> motifs:</td> - </tr> - <tr> - <td id="L69" class="blob-num js-line-number" data-line-number="69"></td> - <td id="LC69" class="blob-code blob-code-inner js-file-line"> argString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>hmmsearch <span class="pl-pds">"</span></span> <span class="pl-k">+</span> phylopath <span class="pl-k">+</span> m <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.hmm <span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_6frame.fas > Phy<span class="pl-pds">"</span></span> <span class="pl-k">+</span> m <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.out<span class="pl-pds">"</span></span> <span class="pl-c"><span class="pl-c">#</span> +quietString</span></td> - </tr> - <tr> - <td id="L70" class="blob-num js-line-number" data-line-number="70"></td> - <td id="LC70" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> argString = "hmmsearch "+phylopath + m + ".hmm " + dir_path+"/data/Test_6frame.fas > Phy" + m + ".out"</span></td> - </tr> - <tr> - <td id="L71" class="blob-num js-line-number" data-line-number="71"></td> - <td id="LC71" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print(argString)</span></td> - </tr> - <tr> - <td id="L72" class="blob-num js-line-number" data-line-number="72"></td> - <td id="LC72" class="blob-code blob-code-inner js-file-line"> subprocess.call(argString, <span class="pl-v">shell</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L73" class="blob-num js-line-number" data-line-number="73"></td> - <td id="LC73" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L74" class="blob-num js-line-number" data-line-number="74"></td> - <td id="LC74" class="blob-code blob-code-inner js-file-line"> hmmResult <span class="pl-k">=</span> <span class="pl-c1">open</span>(<span class="pl-s"><span class="pl-pds">"</span>Phy<span class="pl-pds">"</span></span> <span class="pl-k">+</span> m <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.out<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">'</span>r<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L75" class="blob-num js-line-number" data-line-number="75"></td> - <td id="LC75" class="blob-code blob-code-inner js-file-line"> tempout <span class="pl-k">=</span> <span class="pl-c1">open</span>(dir_path <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>/data/<span class="pl-pds">"</span></span> <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>Phy<span class="pl-pds">"</span></span> <span class="pl-k">+</span> m <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>.txt<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">'</span>w<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L76" class="blob-num js-line-number" data-line-number="76"></td> - <td id="LC76" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>regex = r"NODE_[0-9]{1,7}_length_[0-9]{1,7}_cov_[0-9]{1,10}.[0-9]{1,7}_[0-9]{1,2}"</span></td> - </tr> - <tr> - <td id="L77" class="blob-num js-line-number" data-line-number="77"></td> - <td id="LC77" class="blob-code blob-code-inner js-file-line"> n <span class="pl-k">=</span> <span class="pl-c1">0</span></td> - </tr> - <tr> - <td id="L78" class="blob-num js-line-number" data-line-number="78"></td> - <td id="LC78" class="blob-code blob-code-inner js-file-line"> outList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L79" class="blob-num js-line-number" data-line-number="79"></td> - <td id="LC79" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> l <span class="pl-k">in</span> <span class="pl-c1">range</span>(<span class="pl-c1">0</span>,<span class="pl-c1">14</span>):</td> - </tr> - <tr> - <td id="L80" class="blob-num js-line-number" data-line-number="80"></td> - <td id="LC80" class="blob-code blob-code-inner js-file-line"> hmmResult.readline() <span class="pl-c"><span class="pl-c">#</span>hacky? miss out the first 14 lines. data we want starts on line 15</span></td> - </tr> - <tr> - <td id="L81" class="blob-num js-line-number" data-line-number="81"></td> - <td id="LC81" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L82" class="blob-num js-line-number" data-line-number="82"></td> - <td id="LC82" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L83" class="blob-num js-line-number" data-line-number="83"></td> - <td id="LC83" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> line <span class="pl-k">in</span> hmmResult:</td> - </tr> - <tr> - <td id="L84" class="blob-num js-line-number" data-line-number="84"></td> - <td id="LC84" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> re.search(<span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span>inclusion<span class="pl-pds">"</span></span>, line):</td> - </tr> - <tr> - <td id="L85" class="blob-num js-line-number" data-line-number="85"></td> - <td id="LC85" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print("inclusion threshold reached")</span></td> - </tr> - <tr> - <td id="L86" class="blob-num js-line-number" data-line-number="86"></td> - <td id="LC86" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span></td> - </tr> - <tr> - <td id="L87" class="blob-num js-line-number" data-line-number="87"></td> - <td id="LC87" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-c1">len</span>(line) <span class="pl-k"><=</span> <span class="pl-c1">1</span>:</td> - </tr> - <tr> - <td id="L88" class="blob-num js-line-number" data-line-number="88"></td> - <td id="LC88" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print("end of data")</span></td> - </tr> - <tr> - <td id="L89" class="blob-num js-line-number" data-line-number="89"></td> - <td id="LC89" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">break</span></td> - </tr> - <tr> - <td id="L90" class="blob-num js-line-number" data-line-number="90"></td> - <td id="LC90" class="blob-code blob-code-inner js-file-line"> m <span class="pl-k">=</span> line[<span class="pl-c1">60</span>:<span class="pl-k">-</span><span class="pl-c1">1</span>]</td> - </tr> - <tr> - <td id="L91" class="blob-num js-line-number" data-line-number="91"></td> - <td id="LC91" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print(m)</span></td> - </tr> - <tr> - <td id="L92" class="blob-num js-line-number" data-line-number="92"></td> - <td id="LC92" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>tempout.write(m.group() + "\n")</span></td> - </tr> - <tr> - <td id="L93" class="blob-num js-line-number" data-line-number="93"></td> - <td id="LC93" class="blob-code blob-code-inner js-file-line"> outList.append(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span> <span class="pl-k">+</span> m <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span><span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L94" class="blob-num js-line-number" data-line-number="94"></td> - <td id="LC94" class="blob-code blob-code-inner js-file-line"> n <span class="pl-k">+=</span> <span class="pl-c1">1</span></td> - </tr> - <tr> - <td id="L95" class="blob-num js-line-number" data-line-number="95"></td> - <td id="LC95" class="blob-code blob-code-inner js-file-line"> compoundList.append(outList)</td> - </tr> - <tr> - <td id="L96" class="blob-num js-line-number" data-line-number="96"></td> - <td id="LC96" class="blob-code blob-code-inner js-file-line"> lineCounts.append(n)</td> - </tr> - <tr> - <td id="L97" class="blob-num js-line-number" data-line-number="97"></td> - <td id="LC97" class="blob-code blob-code-inner js-file-line"> hmmResult.close()</td> - </tr> - <tr> - <td id="L98" class="blob-num js-line-number" data-line-number="98"></td> - <td id="LC98" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L99" class="blob-num js-line-number" data-line-number="99"></td> - <td id="LC99" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L100" class="blob-num js-line-number" data-line-number="100"></td> - <td id="LC100" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">print</span>(lineCounts)</td> - </tr> - <tr> - <td id="L101" class="blob-num js-line-number" data-line-number="101"></td> - <td id="LC101" class="blob-code blob-code-inner js-file-line"> motifGroups <span class="pl-k">=</span> [[<span class="pl-s"><span class="pl-pds">'</span>1<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>2a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>2b<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>3<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>4a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>4b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>4c<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>5<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>6<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>7<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>8a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>8b<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>9a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>9b<span class="pl-pds">'</span></span>,</td> - </tr> - <tr> - <td id="L102" class="blob-num js-line-number" data-line-number="102"></td> - <td id="LC102" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">'</span>9c<span class="pl-pds">'</span></span>],</td> - </tr> - <tr> - <td id="L103" class="blob-num js-line-number" data-line-number="103"></td> - <td id="LC103" class="blob-code blob-code-inner js-file-line"> [<span class="pl-s"><span class="pl-pds">'</span>10a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>10b<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>11a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>11b<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>12<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>13a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13c<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>13d<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>14<span class="pl-pds">'</span></span>], [<span class="pl-s"><span class="pl-pds">'</span>15a<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>15b<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>15c<span class="pl-pds">'</span></span>]]</td> - </tr> - <tr> - <td id="L104" class="blob-num js-line-number" data-line-number="104"></td> - <td id="LC104" class="blob-code blob-code-inner js-file-line"> concatGroups <span class="pl-k">=</span> [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">1</span>, <span class="pl-c1">3</span>, <span class="pl-c1">1</span>, <span class="pl-c1">1</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">2</span>, <span class="pl-c1">2</span>, <span class="pl-c1">1</span>, <span class="pl-c1">4</span>, <span class="pl-c1">1</span>, <span class="pl-c1">3</span>]</td> - </tr> - <tr> - <td id="L105" class="blob-num js-line-number" data-line-number="105"></td> - <td id="LC105" class="blob-code blob-code-inner js-file-line"> countList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L106" class="blob-num js-line-number" data-line-number="106"></td> - <td id="LC106" class="blob-code blob-code-inner js-file-line"> countIndex <span class="pl-k">=</span> <span class="pl-c1">0</span></td> - </tr> - <tr> - <td id="L107" class="blob-num js-line-number" data-line-number="107"></td> - <td id="LC107" class="blob-code blob-code-inner js-file-line"> totalCount <span class="pl-k">=</span> <span class="pl-c1">0</span></td> - </tr> - <tr> - <td id="L108" class="blob-num js-line-number" data-line-number="108"></td> - <td id="LC108" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L109" class="blob-num js-line-number" data-line-number="109"></td> - <td id="LC109" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> c <span class="pl-k">in</span> concatGroups:</td> - </tr> - <tr> - <td id="L110" class="blob-num js-line-number" data-line-number="110"></td> - <td id="LC110" class="blob-code blob-code-inner js-file-line"> a <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L111" class="blob-num js-line-number" data-line-number="111"></td> - <td id="LC111" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> n <span class="pl-k">in</span> <span class="pl-c1">range</span>(<span class="pl-c1">0</span>, c):</td> - </tr> - <tr> - <td id="L112" class="blob-num js-line-number" data-line-number="112"></td> - <td id="LC112" class="blob-code blob-code-inner js-file-line"> a <span class="pl-k">=</span> a <span class="pl-k">+</span> compoundList.pop(<span class="pl-c1">0</span>)</td> - </tr> - <tr> - <td id="L113" class="blob-num js-line-number" data-line-number="113"></td> - <td id="LC113" class="blob-code blob-code-inner js-file-line"> t <span class="pl-k">=</span> <span class="pl-c1">set</span>(a)</td> - </tr> - <tr> - <td id="L114" class="blob-num js-line-number" data-line-number="114"></td> - <td id="LC114" class="blob-code blob-code-inner js-file-line"> countList.append(<span class="pl-c1">len</span>(t))</td> - </tr> - <tr> - <td id="L115" class="blob-num js-line-number" data-line-number="115"></td> - <td id="LC115" class="blob-code blob-code-inner js-file-line"> totalCount <span class="pl-k">+=</span> <span class="pl-c1">len</span>(t)</td> - </tr> - <tr> - <td id="L116" class="blob-num js-line-number" data-line-number="116"></td> - <td id="LC116" class="blob-code blob-code-inner js-file-line"> countList.append(totalCount)</td> - </tr> - <tr> - <td id="L117" class="blob-num js-line-number" data-line-number="117"></td> - <td id="LC117" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print(countList)</span></td> - </tr> - <tr> - <td id="L118" class="blob-num js-line-number" data-line-number="118"></td> - <td id="LC118" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print("--------")</span></td> - </tr> - <tr> - <td id="L119" class="blob-num js-line-number" data-line-number="119"></td> - <td id="LC119" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> countList</td> - </tr> - <tr> - <td id="L120" class="blob-num js-line-number" data-line-number="120"></td> - <td id="LC120" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L121" class="blob-num js-line-number" data-line-number="121"></td> - <td id="LC121" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L122" class="blob-num js-line-number" data-line-number="122"></td> - <td id="LC122" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L123" class="blob-num js-line-number" data-line-number="123"></td> - <td id="LC123" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">relativeFrequencyTable</span>(<span class="pl-smi">countList</span>, <span class="pl-smi">name</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L124" class="blob-num js-line-number" data-line-number="124"></td> - <td id="LC124" class="blob-code blob-code-inner js-file-line"> relFreqList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L125" class="blob-num js-line-number" data-line-number="125"></td> - <td id="LC125" class="blob-code blob-code-inner js-file-line"> c <span class="pl-k">=</span> <span class="pl-c1">float</span>(countList[<span class="pl-c1">15</span>])</td> - </tr> - <tr> - <td id="L126" class="blob-num js-line-number" data-line-number="126"></td> - <td id="LC126" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> c <span class="pl-k">==</span> <span class="pl-c1">0</span>:</td> - </tr> - <tr> - <td id="L127" class="blob-num js-line-number" data-line-number="127"></td> - <td id="LC127" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> [<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>, <span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>, <span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>,<span class="pl-c1">0</span>]</td> - </tr> - <tr> - <td id="L128" class="blob-num js-line-number" data-line-number="128"></td> - <td id="LC128" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> i <span class="pl-k">in</span> <span class="pl-c1">range</span>(<span class="pl-c1">0</span>, <span class="pl-c1">15</span>):</td> - </tr> - <tr> - <td id="L129" class="blob-num js-line-number" data-line-number="129"></td> - <td id="LC129" class="blob-code blob-code-inner js-file-line"> relFreqList.append(countList[i] <span class="pl-k">/</span> c)</td> - </tr> - <tr> - <td id="L130" class="blob-num js-line-number" data-line-number="130"></td> - <td id="LC130" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L131" class="blob-num js-line-number" data-line-number="131"></td> - <td id="LC131" class="blob-code blob-code-inner js-file-line"> data <span class="pl-k">=</span> {<span class="pl-s"><span class="pl-pds">'</span>Phylotype<span class="pl-pds">'</span></span>: pList, <span class="pl-s"><span class="pl-pds">'</span>Relative Frequency<span class="pl-pds">'</span></span>: relFreqList}</td> - </tr> - <tr> - <td id="L132" class="blob-num js-line-number" data-line-number="132"></td> - <td id="LC132" class="blob-code blob-code-inner js-file-line"> relFreq_df <span class="pl-k">=</span> pd.DataFrame(data)</td> - </tr> - <tr> - <td id="L133" class="blob-num js-line-number" data-line-number="133"></td> - <td id="LC133" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/<span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_relative_frequency.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L134" class="blob-num js-line-number" data-line-number="134"></td> - <td id="LC134" class="blob-code blob-code-inner js-file-line"> relFreq_df.to_csv(j_fname)</td> - </tr> - <tr> - <td id="L135" class="blob-num js-line-number" data-line-number="135"></td> - <td id="LC135" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> relFreqList <span class="pl-c"><span class="pl-c">#</span> 0-14 = p1-p15 counts [15] = total counts</span></td> - </tr> - <tr> - <td id="L136" class="blob-num js-line-number" data-line-number="136"></td> - <td id="LC136" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L137" class="blob-num js-line-number" data-line-number="137"></td> - <td id="LC137" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L138" class="blob-num js-line-number" data-line-number="138"></td> - <td id="LC138" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L139" class="blob-num js-line-number" data-line-number="139"></td> - <td id="LC139" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L140" class="blob-num js-line-number" data-line-number="140"></td> - <td id="LC140" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">getDeviationFromMean</span>(<span class="pl-smi">frequencyList</span>, <span class="pl-smi">name</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L141" class="blob-num js-line-number" data-line-number="141"></td> - <td id="LC141" class="blob-code blob-code-inner js-file-line"> devList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L142" class="blob-num js-line-number" data-line-number="142"></td> - <td id="LC142" class="blob-code blob-code-inner js-file-line"> dir_path <span class="pl-k">=</span> os.path.dirname(os.path.realpath(<span class="pl-c1">__file__</span>))</td> - </tr> - <tr> - <td id="L143" class="blob-num js-line-number" data-line-number="143"></td> - <td id="LC143" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> dir_path <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>/data/congodata.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L144" class="blob-num js-line-number" data-line-number="144"></td> - <td id="LC144" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>j_fname = r"data/congodata.csv"</span></td> - </tr> - <tr> - <td id="L145" class="blob-num js-line-number" data-line-number="145"></td> - <td id="LC145" class="blob-code blob-code-inner js-file-line"> congo_df <span class="pl-k">=</span> pd.read_csv(j_fname) <span class="pl-c"><span class="pl-c">#</span> we get the means from congo_df</span></td> - </tr> - <tr> - <td id="L146" class="blob-num js-line-number" data-line-number="146"></td> - <td id="LC146" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> p <span class="pl-k">in</span> <span class="pl-c1">range</span>(<span class="pl-c1">0</span>, <span class="pl-c1">15</span>):</td> - </tr> - <tr> - <td id="L147" class="blob-num js-line-number" data-line-number="147"></td> - <td id="LC147" class="blob-code blob-code-inner js-file-line"> m <span class="pl-k">=</span> congo_df[pList[p]].mean()</td> - </tr> - <tr> - <td id="L148" class="blob-num js-line-number" data-line-number="148"></td> - <td id="LC148" class="blob-code blob-code-inner js-file-line"> dev <span class="pl-k">=</span> <span class="pl-k">-</span>(m <span class="pl-k">-</span> frequencyList[p])</td> - </tr> - <tr> - <td id="L149" class="blob-num js-line-number" data-line-number="149"></td> - <td id="LC149" class="blob-code blob-code-inner js-file-line"> devList.append(dev)</td> - </tr> - <tr> - <td id="L150" class="blob-num js-line-number" data-line-number="150"></td> - <td id="LC150" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L151" class="blob-num js-line-number" data-line-number="151"></td> - <td id="LC151" class="blob-code blob-code-inner js-file-line"> data <span class="pl-k">=</span> {<span class="pl-s"><span class="pl-pds">'</span>Phylotype<span class="pl-pds">'</span></span>: pList, <span class="pl-s"><span class="pl-pds">'</span>Deviation from Mean<span class="pl-pds">'</span></span>: devList}</td> - </tr> - <tr> - <td id="L152" class="blob-num js-line-number" data-line-number="152"></td> - <td id="LC152" class="blob-code blob-code-inner js-file-line"> dev_df <span class="pl-k">=</span> pd.DataFrame(data)</td> - </tr> - <tr> - <td id="L153" class="blob-num js-line-number" data-line-number="153"></td> - <td id="LC153" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/<span class="pl-pds">"</span></span> <span class="pl-k">+</span> name <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>_deviation_from_mean.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L154" class="blob-num js-line-number" data-line-number="154"></td> - <td id="LC154" class="blob-code blob-code-inner js-file-line"> dev_df.to_csv(j_fname)</td> - </tr> - <tr> - <td id="L155" class="blob-num js-line-number" data-line-number="155"></td> - <td id="LC155" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> devList</td> - </tr> - <tr> - <td id="L156" class="blob-num js-line-number" data-line-number="156"></td> - <td id="LC156" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L157" class="blob-num js-line-number" data-line-number="157"></td> - <td id="LC157" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L158" class="blob-num js-line-number" data-line-number="158"></td> - <td id="LC158" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">relativeFrequencyHeatMap</span>(<span class="pl-smi">name</span>, <span class="pl-smi">freqList</span>, <span class="pl-smi">pdf</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L159" class="blob-num js-line-number" data-line-number="159"></td> - <td id="LC159" class="blob-code blob-code-inner js-file-line"> localFreqList <span class="pl-k">=</span> freqList[:]</td> - </tr> - <tr> - <td id="L160" class="blob-num js-line-number" data-line-number="160"></td> - <td id="LC160" class="blob-code blob-code-inner js-file-line"> localFreqList.insert(<span class="pl-c1">0</span>, name)</td> - </tr> - <tr> - <td id="L161" class="blob-num js-line-number" data-line-number="161"></td> - <td id="LC161" class="blob-code blob-code-inner js-file-line"> dir_path <span class="pl-k">=</span> os.path.dirname(os.path.realpath(<span class="pl-c1">__file__</span>))</td> - </tr> - <tr> - <td id="L162" class="blob-num js-line-number" data-line-number="162"></td> - <td id="LC162" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> dir_path<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/data/congodata.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L163" class="blob-num js-line-number" data-line-number="163"></td> - <td id="LC163" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>print(dir_path)</span></td> - </tr> - <tr> - <td id="L164" class="blob-num js-line-number" data-line-number="164"></td> - <td id="LC164" class="blob-code blob-code-inner js-file-line"> congo_df <span class="pl-k">=</span> pd.read_csv(j_fname)</td> - </tr> - <tr> - <td id="L165" class="blob-num js-line-number" data-line-number="165"></td> - <td id="LC165" class="blob-code blob-code-inner js-file-line"> congo_df.drop(<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>, <span class="pl-v">axis</span><span class="pl-k">=</span><span class="pl-c1">1</span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L166" class="blob-num js-line-number" data-line-number="166"></td> - <td id="LC166" class="blob-code blob-code-inner js-file-line"> congo_df.loc[congo_df.index.max() <span class="pl-k">+</span> <span class="pl-c1">1</span>] <span class="pl-k">=</span> localFreqList</td> - </tr> - <tr> - <td id="L167" class="blob-num js-line-number" data-line-number="167"></td> - <td id="LC167" class="blob-code blob-code-inner js-file-line"> ysize <span class="pl-k">=</span> <span class="pl-c1">len</span>(congo_df) <span class="pl-k">*</span> <span class="pl-c1">20</span> <span class="pl-k">/</span> <span class="pl-c1">97.0</span> <span class="pl-c"><span class="pl-c">#</span> make vertical size equivlanet 20' is ok for 97.</span></td> - </tr> - <tr> - <td id="L168" class="blob-num js-line-number" data-line-number="168"></td> - <td id="LC168" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L169" class="blob-num js-line-number" data-line-number="169"></td> - <td id="LC169" class="blob-code blob-code-inner js-file-line"> congo_df.set_index(<span class="pl-s"><span class="pl-pds">'</span>Strain<span class="pl-pds">'</span></span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L170" class="blob-num js-line-number" data-line-number="170"></td> - <td id="LC170" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L171" class="blob-num js-line-number" data-line-number="171"></td> - <td id="LC171" class="blob-code blob-code-inner js-file-line"> cg <span class="pl-k">=</span> sns.clustermap(congo_df, <span class="pl-v">method</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>ward<span class="pl-pds">'</span></span>, <span class="pl-v">cmap</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>RdBu_r<span class="pl-pds">"</span></span>, <span class="pl-v">col_cluster</span><span class="pl-k">=</span><span class="pl-c1">False</span>, <span class="pl-v">yticklabels</span> <span class="pl-k">=</span> congo_df.index.values,<span class="pl-v">figsize</span> <span class="pl-k">=</span> (<span class="pl-c1">10</span>,ysize))</td> - </tr> - <tr> - <td id="L172" class="blob-num js-line-number" data-line-number="172"></td> - <td id="LC172" class="blob-code blob-code-inner js-file-line"> plt.setp(cg.ax_heatmap.yaxis.get_ticklabels(), <span class="pl-v">rotation</span><span class="pl-k">=</span><span class="pl-c1">0</span>, <span class="pl-v">fontsize</span><span class="pl-k">=</span><span class="pl-c1">8</span>) <span class="pl-c"><span class="pl-c">#</span> get y labels printed horizontally</span></td> - </tr> - <tr> - <td id="L173" class="blob-num js-line-number" data-line-number="173"></td> - <td id="LC173" class="blob-code blob-code-inner js-file-line"> ax<span class="pl-k">=</span>cg.ax_heatmap</td> - </tr> - <tr> - <td id="L174" class="blob-num js-line-number" data-line-number="174"></td> - <td id="LC174" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$ estimated as the phylotype proportion across the<span class="pl-cce">\n</span>sample cohort. <span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L175" class="blob-num js-line-number" data-line-number="175"></td> - <td id="LC175" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">"</span>Dendrogram reflects the relationships amongst the VSG repertoires of each strain. <span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L176" class="blob-num js-line-number" data-line-number="176"></td> - <td id="LC176" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">"</span>Strains<span class="pl-cce">\n</span>were isolated from multiple African countries as described in Silva Pereira et al. (2018).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L177" class="blob-num js-line-number" data-line-number="177"></td> - <td id="LC177" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span>Data was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L178" class="blob-num js-line-number" data-line-number="178"></td> - <td id="LC178" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L179" class="blob-num js-line-number" data-line-number="179"></td> - <td id="LC179" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>title = "Variant Antigen Profiles of Trypanosoma congolense estimated as the phylotype proportion across the sample cohort. Dendrogram reflects the relationships amongst the VSG repertoires of each strain. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018). Data was produced with the 'Variant Antigen Profiler' (Silva Pereira and Jackson, 2018)."</span></td> - </tr> - <tr> - <td id="L180" class="blob-num js-line-number" data-line-number="180"></td> - <td id="LC180" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>ax.set_title(title, ha = "center", va = "bottom",wrap = "True")</span></td> - </tr> - <tr> - <td id="L181" class="blob-num js-line-number" data-line-number="181"></td> - <td id="LC181" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>title = "Where is this!"</span></td> - </tr> - <tr> - <td id="L182" class="blob-num js-line-number" data-line-number="182"></td> - <td id="LC182" class="blob-code blob-code-inner js-file-line"> ax.text(<span class="pl-k">-</span><span class="pl-c1">0.15</span>,<span class="pl-k">-</span><span class="pl-c1">0.05</span>, title,<span class="pl-v">va</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>top<span class="pl-pds">"</span></span>,<span class="pl-v">wrap</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>True<span class="pl-pds">"</span></span>, <span class="pl-v">transform</span> <span class="pl-k">=</span> ax.transAxes )</td> - </tr> - <tr> - <td id="L183" class="blob-num js-line-number" data-line-number="183"></td> - <td id="LC183" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L184" class="blob-num js-line-number" data-line-number="184"></td> - <td id="LC184" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L185" class="blob-num js-line-number" data-line-number="185"></td> - <td id="LC185" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L186" class="blob-num js-line-number" data-line-number="186"></td> - <td id="LC186" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L187" class="blob-num js-line-number" data-line-number="187"></td> - <td id="LC187" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> cg.dendrogram_col.linkage # linkage matrix for columns</span></td> - </tr> - <tr> - <td id="L188" class="blob-num js-line-number" data-line-number="188"></td> - <td id="LC188" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> cg.dendrogram_row.linkage # linkage matrix for rows</span></td> - </tr> - <tr> - <td id="L189" class="blob-num js-line-number" data-line-number="189"></td> - <td id="LC189" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.savefig(r"results/" + name + "_heatmap.png")</span></td> - </tr> - <tr> - <td id="L190" class="blob-num js-line-number" data-line-number="190"></td> - <td id="LC190" class="blob-code blob-code-inner js-file-line"> plt.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/heatmap.png<span class="pl-pds">"</span></span>,<span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L191" class="blob-num js-line-number" data-line-number="191"></td> - <td id="LC191" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> pdf <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">'</span>PDF_Yes<span class="pl-pds">'</span></span>:</td> - </tr> - <tr> - <td id="L192" class="blob-num js-line-number" data-line-number="192"></td> - <td id="LC192" class="blob-code blob-code-inner js-file-line"> plt.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/heatmap.pdf<span class="pl-pds">"</span></span>, <span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L193" class="blob-num js-line-number" data-line-number="193"></td> - <td id="LC193" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>shutil.copyfile("heatmap.pdf",heatmapfn) #</span></td> - </tr> - <tr> - <td id="L194" class="blob-num js-line-number" data-line-number="194"></td> - <td id="LC194" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.show()</span></td> - </tr> - <tr> - <td id="L195" class="blob-num js-line-number" data-line-number="195"></td> - <td id="LC195" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L196" class="blob-num js-line-number" data-line-number="196"></td> - <td id="LC196" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">deviationFromMeanHeatMap</span>(<span class="pl-smi">name</span>,<span class="pl-smi">devList</span>, <span class="pl-smi">pdf</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L197" class="blob-num js-line-number" data-line-number="197"></td> - <td id="LC197" class="blob-code blob-code-inner js-file-line"> localDevList <span class="pl-k">=</span> devList[:]</td> - </tr> - <tr> - <td id="L198" class="blob-num js-line-number" data-line-number="198"></td> - <td id="LC198" class="blob-code blob-code-inner js-file-line"> localDevList.insert(<span class="pl-c1">0</span>, name)</td> - </tr> - <tr> - <td id="L199" class="blob-num js-line-number" data-line-number="199"></td> - <td id="LC199" class="blob-code blob-code-inner js-file-line"> dir_path <span class="pl-k">=</span> os.path.dirname(os.path.realpath(<span class="pl-c1">__file__</span>))</td> - </tr> - <tr> - <td id="L200" class="blob-num js-line-number" data-line-number="200"></td> - <td id="LC200" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> dir_path<span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>/data/congodata_deviationfromthemean.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L201" class="blob-num js-line-number" data-line-number="201"></td> - <td id="LC201" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>j_fname = r"data/congodata_deviationfromthemean.csv"</span></td> - </tr> - <tr> - <td id="L202" class="blob-num js-line-number" data-line-number="202"></td> - <td id="LC202" class="blob-code blob-code-inner js-file-line"> congo_df <span class="pl-k">=</span> pd.read_csv(j_fname)</td> - </tr> - <tr> - <td id="L203" class="blob-num js-line-number" data-line-number="203"></td> - <td id="LC203" class="blob-code blob-code-inner js-file-line"> congo_df.drop(<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>, <span class="pl-v">axis</span><span class="pl-k">=</span><span class="pl-c1">1</span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L204" class="blob-num js-line-number" data-line-number="204"></td> - <td id="LC204" class="blob-code blob-code-inner js-file-line"> congo_df.loc[congo_df.index.max() <span class="pl-k">+</span> <span class="pl-c1">1</span>] <span class="pl-k">=</span> localDevList</td> - </tr> - <tr> - <td id="L205" class="blob-num js-line-number" data-line-number="205"></td> - <td id="LC205" class="blob-code blob-code-inner js-file-line"> ysize <span class="pl-k">=</span> <span class="pl-c1">len</span>(congo_df) <span class="pl-k">*</span> <span class="pl-c1">20</span> <span class="pl-k">/</span> <span class="pl-c1">97.0</span> <span class="pl-c"><span class="pl-c">#</span> make vertical size equivlanet 20' is ok for 97.</span></td> - </tr> - <tr> - <td id="L206" class="blob-num js-line-number" data-line-number="206"></td> - <td id="LC206" class="blob-code blob-code-inner js-file-line"> congo_df.set_index(<span class="pl-s"><span class="pl-pds">'</span>Strain<span class="pl-pds">'</span></span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L207" class="blob-num js-line-number" data-line-number="207"></td> - <td id="LC207" class="blob-code blob-code-inner js-file-line"> cg <span class="pl-k">=</span> sns.clustermap(congo_df, <span class="pl-v">method</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>ward<span class="pl-pds">'</span></span>,<span class="pl-v">cmap</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>RdBu_r<span class="pl-pds">"</span></span>, <span class="pl-v">col_cluster</span><span class="pl-k">=</span><span class="pl-c1">False</span>, <span class="pl-v">yticklabels</span> <span class="pl-k">=</span> congo_df.index.values,<span class="pl-v">figsize</span> <span class="pl-k">=</span> (<span class="pl-c1">10</span>,ysize))</td> - </tr> - <tr> - <td id="L208" class="blob-num js-line-number" data-line-number="208"></td> - <td id="LC208" class="blob-code blob-code-inner js-file-line"> plt.setp(cg.ax_heatmap.yaxis.get_majorticklabels(), <span class="pl-v">rotation</span><span class="pl-k">=</span><span class="pl-c1">0</span>, <span class="pl-v">fontsize</span><span class="pl-k">=</span><span class="pl-c1">8</span>) <span class="pl-c"><span class="pl-c">#</span> get y labels printed horizontally</span></td> - </tr> - <tr> - <td id="L209" class="blob-num js-line-number" data-line-number="209"></td> - <td id="LC209" class="blob-code blob-code-inner js-file-line"> ax <span class="pl-k">=</span> cg.ax_heatmap</td> - </tr> - <tr> - <td id="L210" class="blob-num js-line-number" data-line-number="210"></td> - <td id="LC210" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$ expressed as the deviation from the mean phylotypes <span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L211" class="blob-num js-line-number" data-line-number="211"></td> - <td id="LC211" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span><span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span>proportions of the sample cohort. Dendrogram reflects the relationships amongst the VSG repertoires of <span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L212" class="blob-num js-line-number" data-line-number="212"></td> - <td id="LC212" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span><span class="pl-s"><span class="pl-pds">"</span>each <span class="pl-cce">\n</span>strain. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L213" class="blob-num js-line-number" data-line-number="213"></td> - <td id="LC213" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span><span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span>Data was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L214" class="blob-num js-line-number" data-line-number="214"></td> - <td id="LC214" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>ax.set_title(title,ha = "center", va = "bottom",wrap = "True")</span></td> - </tr> - <tr> - <td id="L215" class="blob-num js-line-number" data-line-number="215"></td> - <td id="LC215" class="blob-code blob-code-inner js-file-line"> ax.text(<span class="pl-k">-</span><span class="pl-c1">0.2</span>, <span class="pl-k">-</span><span class="pl-c1">0.05</span>, title, <span class="pl-v">va</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>top<span class="pl-pds">"</span></span>, <span class="pl-v">transform</span><span class="pl-k">=</span>ax.transAxes, <span class="pl-v">wrap</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>True<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L216" class="blob-num js-line-number" data-line-number="216"></td> - <td id="LC216" class="blob-code blob-code-inner js-file-line"> plt.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/dheatmap.png<span class="pl-pds">"</span></span>,<span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L217" class="blob-num js-line-number" data-line-number="217"></td> - <td id="LC217" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> pdf <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">'</span>PDF_Yes<span class="pl-pds">'</span></span>:</td> - </tr> - <tr> - <td id="L218" class="blob-num js-line-number" data-line-number="218"></td> - <td id="LC218" class="blob-code blob-code-inner js-file-line"> plt.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/dheatmap.pdf<span class="pl-pds">"</span></span>, <span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L219" class="blob-num js-line-number" data-line-number="219"></td> - <td id="LC219" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>shutil.copyfile("dheatmap.pdf",dhmapfn)</span></td> - </tr> - <tr> - <td id="L220" class="blob-num js-line-number" data-line-number="220"></td> - <td id="LC220" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.show()</span></td> - </tr> - <tr> - <td id="L221" class="blob-num js-line-number" data-line-number="221"></td> - <td id="LC221" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L222" class="blob-num js-line-number" data-line-number="222"></td> - <td id="LC222" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L223" class="blob-num js-line-number" data-line-number="223"></td> - <td id="LC223" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">plotPCA</span>(<span class="pl-smi">name</span>, <span class="pl-smi">freqList</span>, <span class="pl-smi">pdf</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L224" class="blob-num js-line-number" data-line-number="224"></td> - <td id="LC224" class="blob-code blob-code-inner js-file-line"> localFreqList <span class="pl-k">=</span> freqList[:]</td> - </tr> - <tr> - <td id="L225" class="blob-num js-line-number" data-line-number="225"></td> - <td id="LC225" class="blob-code blob-code-inner js-file-line"> localFreqList.insert(<span class="pl-c1">0</span>, name)</td> - </tr> - <tr> - <td id="L226" class="blob-num js-line-number" data-line-number="226"></td> - <td id="LC226" class="blob-code blob-code-inner js-file-line"> localFreqList.append(name)</td> - </tr> - <tr> - <td id="L227" class="blob-num js-line-number" data-line-number="227"></td> - <td id="LC227" class="blob-code blob-code-inner js-file-line"> dir_path <span class="pl-k">=</span> os.path.dirname(os.path.realpath(<span class="pl-c1">__file__</span>))</td> - </tr> - <tr> - <td id="L228" class="blob-num js-line-number" data-line-number="228"></td> - <td id="LC228" class="blob-code blob-code-inner js-file-line"> j_fname <span class="pl-k">=</span> dir_path <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span>/data/congodata.csv<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L229" class="blob-num js-line-number" data-line-number="229"></td> - <td id="LC229" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>j_fname = r"data/congodata.csv"</span></td> - </tr> - <tr> - <td id="L230" class="blob-num js-line-number" data-line-number="230"></td> - <td id="LC230" class="blob-code blob-code-inner js-file-line"> congo_df <span class="pl-k">=</span> pd.read_csv(j_fname)</td> - </tr> - <tr> - <td id="L231" class="blob-num js-line-number" data-line-number="231"></td> - <td id="LC231" class="blob-code blob-code-inner js-file-line"> congo_df.loc[congo_df.index.max() <span class="pl-k">+</span> <span class="pl-c1">1</span>] <span class="pl-k">=</span> localFreqList</td> - </tr> - <tr> - <td id="L232" class="blob-num js-line-number" data-line-number="232"></td> - <td id="LC232" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> print(congo_df.tail(2))</span></td> - </tr> - <tr> - <td id="L233" class="blob-num js-line-number" data-line-number="233"></td> - <td id="LC233" class="blob-code blob-code-inner js-file-line"> myColours <span class="pl-k">=</span> congo_df[<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>]</td> - </tr> - <tr> - <td id="L234" class="blob-num js-line-number" data-line-number="234"></td> - <td id="LC234" class="blob-code blob-code-inner js-file-line"> myCountries <span class="pl-k">=</span> congo_df.drop_duplicates(<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>)[<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>].tolist()</td> - </tr> - <tr> - <td id="L235" class="blob-num js-line-number" data-line-number="235"></td> - <td id="LC235" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> print(myCountries)</span></td> - </tr> - <tr> - <td id="L236" class="blob-num js-line-number" data-line-number="236"></td> - <td id="LC236" class="blob-code blob-code-inner js-file-line"> congo_df.drop(<span class="pl-s"><span class="pl-pds">'</span>Colour<span class="pl-pds">'</span></span>, <span class="pl-v">axis</span><span class="pl-k">=</span><span class="pl-c1">1</span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L237" class="blob-num js-line-number" data-line-number="237"></td> - <td id="LC237" class="blob-code blob-code-inner js-file-line"> congo_df.set_index(<span class="pl-s"><span class="pl-pds">'</span>Strain<span class="pl-pds">'</span></span>, <span class="pl-v">inplace</span><span class="pl-k">=</span><span class="pl-c1">True</span>)</td> - </tr> - <tr> - <td id="L238" class="blob-num js-line-number" data-line-number="238"></td> - <td id="LC238" class="blob-code blob-code-inner js-file-line"> dataArray <span class="pl-k">=</span> congo_df.as_matrix()</td> - </tr> - <tr> - <td id="L239" class="blob-num js-line-number" data-line-number="239"></td> - <td id="LC239" class="blob-code blob-code-inner js-file-line"> pcaResult <span class="pl-k">=</span> PCA(dataArray)</td> - </tr> - <tr> - <td id="L240" class="blob-num js-line-number" data-line-number="240"></td> - <td id="LC240" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> pcaResult.center(0)</span></td> - </tr> - <tr> - <td id="L241" class="blob-num js-line-number" data-line-number="241"></td> - <td id="LC241" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> can't seem to find a simple way of prooducing a decent legend.</span></td> - </tr> - <tr> - <td id="L242" class="blob-num js-line-number" data-line-number="242"></td> - <td id="LC242" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> going to seperate items in to different countires.</span></td> - </tr> - <tr> - <td id="L243" class="blob-num js-line-number" data-line-number="243"></td> - <td id="LC243" class="blob-code blob-code-inner js-file-line"> compoundList <span class="pl-k">=</span> []</td> - </tr> - <tr> - <td id="L244" class="blob-num js-line-number" data-line-number="244"></td> - <td id="LC244" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> i <span class="pl-k">in</span> myCountries:</td> - </tr> - <tr> - <td id="L245" class="blob-num js-line-number" data-line-number="245"></td> - <td id="LC245" class="blob-code blob-code-inner js-file-line"> compoundList.append([])</td> - </tr> - <tr> - <td id="L246" class="blob-num js-line-number" data-line-number="246"></td> - <td id="LC246" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L247" class="blob-num js-line-number" data-line-number="247"></td> - <td id="LC247" class="blob-code blob-code-inner js-file-line"> i <span class="pl-k">=</span> <span class="pl-c1">0</span></td> - </tr> - <tr> - <td id="L248" class="blob-num js-line-number" data-line-number="248"></td> - <td id="LC248" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> item <span class="pl-k">in</span> pcaResult.Y:</td> - </tr> - <tr> - <td id="L249" class="blob-num js-line-number" data-line-number="249"></td> - <td id="LC249" class="blob-code blob-code-inner js-file-line"> col <span class="pl-k">=</span> myCountries.index(myColours[i])</td> - </tr> - <tr> - <td id="L250" class="blob-num js-line-number" data-line-number="250"></td> - <td id="LC250" class="blob-code blob-code-inner js-file-line"> compoundList[col].append(<span class="pl-k">-</span>item[<span class="pl-c1">0</span>])</td> - </tr> - <tr> - <td id="L251" class="blob-num js-line-number" data-line-number="251"></td> - <td id="LC251" class="blob-code blob-code-inner js-file-line"> compoundList[col].append(item[<span class="pl-c1">1</span>])</td> - </tr> - <tr> - <td id="L252" class="blob-num js-line-number" data-line-number="252"></td> - <td id="LC252" class="blob-code blob-code-inner js-file-line"> i <span class="pl-k">=</span> i <span class="pl-k">+</span> <span class="pl-c1">1</span></td> - </tr> - <tr> - <td id="L253" class="blob-num js-line-number" data-line-number="253"></td> - <td id="LC253" class="blob-code blob-code-inner js-file-line"> colormap <span class="pl-k">=</span> plt.cm.tab20 <span class="pl-c"><span class="pl-c">#</span> nipy_spectral, Set1,Paired</span></td> - </tr> - <tr> - <td id="L254" class="blob-num js-line-number" data-line-number="254"></td> - <td id="LC254" class="blob-code blob-code-inner js-file-line"> cols <span class="pl-k">=</span> [colormap(i) <span class="pl-k">for</span> i <span class="pl-k">in</span> np.linspace(<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">20</span>)]</td> - </tr> - <tr> - <td id="L255" class="blob-num js-line-number" data-line-number="255"></td> - <td id="LC255" class="blob-code blob-code-inner js-file-line"> fig, ax <span class="pl-k">=</span> plt.subplots(<span class="pl-v">figsize</span><span class="pl-k">=</span>(<span class="pl-c1">9</span>, <span class="pl-c1">6</span>))</td> - </tr> - <tr> - <td id="L256" class="blob-num js-line-number" data-line-number="256"></td> - <td id="LC256" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.figure(num=1,figsize=(12, 6))</span></td> - </tr> - <tr> - <td id="L257" class="blob-num js-line-number" data-line-number="257"></td> - <td id="LC257" class="blob-code blob-code-inner js-file-line"> i <span class="pl-k">=</span> <span class="pl-c1">0</span></td> - </tr> - <tr> - <td id="L258" class="blob-num js-line-number" data-line-number="258"></td> - <td id="LC258" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> d <span class="pl-k">in</span> myCountries:</td> - </tr> - <tr> - <td id="L259" class="blob-num js-line-number" data-line-number="259"></td> - <td id="LC259" class="blob-code blob-code-inner js-file-line"> a <span class="pl-k">=</span> compoundList[i]</td> - </tr> - <tr> - <td id="L260" class="blob-num js-line-number" data-line-number="260"></td> - <td id="LC260" class="blob-code blob-code-inner js-file-line"> b <span class="pl-k">=</span> a[::<span class="pl-c1">2</span>]</td> - </tr> - <tr> - <td id="L261" class="blob-num js-line-number" data-line-number="261"></td> - <td id="LC261" class="blob-code blob-code-inner js-file-line"> c <span class="pl-k">=</span> a[<span class="pl-c1">1</span>::<span class="pl-c1">2</span>]</td> - </tr> - <tr> - <td id="L262" class="blob-num js-line-number" data-line-number="262"></td> - <td id="LC262" class="blob-code blob-code-inner js-file-line"> ax.scatter(b, c, <span class="pl-v">color</span><span class="pl-k">=</span>cols[i], <span class="pl-v">label</span><span class="pl-k">=</span>myCountries[i])</td> - </tr> - <tr> - <td id="L263" class="blob-num js-line-number" data-line-number="263"></td> - <td id="LC263" class="blob-code blob-code-inner js-file-line"> i <span class="pl-k">=</span> i <span class="pl-k">+</span> <span class="pl-c1">1</span></td> - </tr> - <tr> - <td id="L264" class="blob-num js-line-number" data-line-number="264"></td> - <td id="LC264" class="blob-code blob-code-inner js-file-line"> leg <span class="pl-k">=</span> ax.legend( <span class="pl-v">bbox_to_anchor</span><span class="pl-k">=</span>(<span class="pl-c1">1.02</span>,<span class="pl-c1">1.02</span>), <span class="pl-v">loc</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>upper left<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">#</span>move legend out of plot</span></td> - </tr> - <tr> - <td id="L265" class="blob-num js-line-number" data-line-number="265"></td> - <td id="LC265" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>Principal Component Analysis of the Variant Antigen Profiles of $\itTrypanosoma$ $\itcongolense$. <span class="pl-pds">"</span></span> \</td> - </tr> - <tr> - <td id="L266" class="blob-num js-line-number" data-line-number="266"></td> - <td id="LC266" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">"</span>The plot reflects the<span class="pl-cce">\n</span>relationships amongst the VSG repertoires of each strain. Strains are color-coded <span class="pl-pds">"</span></span> \</td> - </tr> - <tr> - <td id="L267" class="blob-num js-line-number" data-line-number="267"></td> - <td id="LC267" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">"</span>by location of collection according<span class="pl-cce">\n</span>to key. Strains were isolated from multiple African countries as described in Silva Pereira et al. (2018).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L268" class="blob-num js-line-number" data-line-number="268"></td> - <td id="LC268" class="blob-code blob-code-inner js-file-line"> title <span class="pl-k">+=</span><span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span>Data was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019).<span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L269" class="blob-num js-line-number" data-line-number="269"></td> - <td id="LC269" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.title(title, ha = "center", va = "bottom",wrap = "True")</span></td> - </tr> - <tr> - <td id="L270" class="blob-num js-line-number" data-line-number="270"></td> - <td id="LC270" class="blob-code blob-code-inner js-file-line"> tx <span class="pl-k">=</span> ax.text(<span class="pl-k">-</span><span class="pl-c1">0.1</span>, <span class="pl-k">-</span><span class="pl-c1">0.07</span>, title, <span class="pl-v">va</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>top<span class="pl-pds">"</span></span>, <span class="pl-v">transform</span><span class="pl-k">=</span>ax.transAxes, <span class="pl-v">wrap</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>True<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L271" class="blob-num js-line-number" data-line-number="271"></td> - <td id="LC271" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>fig.add_axes([0,0.05,1.05,1.05])</span></td> - </tr> - <tr> - <td id="L272" class="blob-num js-line-number" data-line-number="272"></td> - <td id="LC272" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>fig.tight_layout(rect=[0, 0.03, 1, 0.95])</span></td> - </tr> - <tr> - <td id="L273" class="blob-num js-line-number" data-line-number="273"></td> - <td id="LC273" class="blob-code blob-code-inner js-file-line"> fig.subplots_adjust(<span class="pl-v">bottom</span> <span class="pl-k">=</span> <span class="pl-c1">0.3</span>)</td> - </tr> - <tr> - <td id="L274" class="blob-num js-line-number" data-line-number="274"></td> - <td id="LC274" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L275" class="blob-num js-line-number" data-line-number="275"></td> - <td id="LC275" class="blob-code blob-code-inner js-file-line"> fig.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/vapPCA.png<span class="pl-pds">"</span></span>, <span class="pl-v">bbox_extra_artists</span><span class="pl-k">=</span>(leg,tx), <span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L276" class="blob-num js-line-number" data-line-number="276"></td> - <td id="LC276" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>fig.savefig(htmlresource+"/vapPCA.png", bbox_extra_artists=(leg,))</span></td> - </tr> - <tr> - <td id="L277" class="blob-num js-line-number" data-line-number="277"></td> - <td id="LC277" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> pdf <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">'</span>PDF_Yes<span class="pl-pds">'</span></span>:</td> - </tr> - <tr> - <td id="L278" class="blob-num js-line-number" data-line-number="278"></td> - <td id="LC278" class="blob-code blob-code-inner js-file-line"> fig.savefig(htmlresource<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>/vapPCA.pdf<span class="pl-pds">"</span></span>,<span class="pl-v">bbox_extra_artists</span><span class="pl-k">=</span>(leg,tx), <span class="pl-v">bbox_inches</span><span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">'</span>tight<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L279" class="blob-num js-line-number" data-line-number="279"></td> - <td id="LC279" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>shutil.copyfile("vapPCA.pdf",PCAfn) # my $namechange = "mv ".$input."_k65/contigs.fa ".$input.".fa";</span></td> - </tr> - <tr> - <td id="L280" class="blob-num js-line-number" data-line-number="280"></td> - <td id="LC280" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>plt.show()</span></td> - </tr> - <tr> - <td id="L281" class="blob-num js-line-number" data-line-number="281"></td> - <td id="LC281" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L282" class="blob-num js-line-number" data-line-number="282"></td> - <td id="LC282" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">createHTML</span>(<span class="pl-smi">name</span>,<span class="pl-smi">htmlfn</span>,<span class="pl-smi">freqList</span>,<span class="pl-smi">devList</span>):</td> - </tr> - <tr> - <td id="L283" class="blob-num js-line-number" data-line-number="283"></td> - <td id="LC283" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource</span></td> - </tr> - <tr> - <td id="L284" class="blob-num js-line-number" data-line-number="284"></td> - <td id="LC284" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><html><title>T<span class="pl-c1">.</span>congolense VAP</title><body><div style='text-align:center'><h2><i>Trypanosoma congolense</i> Variant Antigen Profile</h2><h3><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L285" class="blob-num js-line-number" data-line-number="285"></td> - <td id="LC285" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> name</td> - </tr> - <tr> - <td id="L286" class="blob-num js-line-number" data-line-number="286"></td> - <td id="LC286" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><br/>Genomic Analysis</h3><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L287" class="blob-num js-line-number" data-line-number="287"></td> - <td id="LC287" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">"</span><p style = 'margin-left:23%; margin-right:23%'>Table Legend: Variant Antigen Profiles of <i>Trypanosoma congolense</i> estimated as the phylotype proportion and as the deviation from the mean across the sample cohort.<br><span class="pl-pds">"</span></span> \</td> - </tr> - <tr> - <td id="L288" class="blob-num js-line-number" data-line-number="288"></td> - <td id="LC288" class="blob-code blob-code-inner js-file-line"> <span class="pl-s"><span class="pl-pds">"</span>Data was produced with the 'Variant Antigen Profiler' (Silva Pereira et al., 2019).</p><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L289" class="blob-num js-line-number" data-line-number="289"></td> - <td id="LC289" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><style> table, th, tr, td {border: 1px solid black; border-collapse: collapse;}</style><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L290" class="blob-num js-line-number" data-line-number="290"></td> - <td id="LC290" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L291" class="blob-num js-line-number" data-line-number="291"></td> - <td id="LC291" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><table style='width:50%;margin-left:25%;text-align:center'><tr><th>Phylotype</th><th>Relative Frequency</th><th>Deviation from Mean</th></tr><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L292" class="blob-num js-line-number" data-line-number="292"></td> - <td id="LC292" class="blob-code blob-code-inner js-file-line"> tabString <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L293" class="blob-num js-line-number" data-line-number="293"></td> - <td id="LC293" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> flush out table with correct values</span></td> - </tr> - <tr> - <td id="L294" class="blob-num js-line-number" data-line-number="294"></td> - <td id="LC294" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">for</span> i <span class="pl-k">in</span> <span class="pl-c1">range</span>(<span class="pl-c1">0</span>, <span class="pl-c1">15</span>):</td> - </tr> - <tr> - <td id="L295" class="blob-num js-line-number" data-line-number="295"></td> - <td id="LC295" class="blob-code blob-code-inner js-file-line"> f<span class="pl-k">=</span> <span class="pl-c1">format</span>(freqList[i],<span class="pl-s"><span class="pl-pds">'</span>.4f<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L296" class="blob-num js-line-number" data-line-number="296"></td> - <td id="LC296" class="blob-code blob-code-inner js-file-line"> d<span class="pl-k">=</span> <span class="pl-c1">format</span>(devList[i],<span class="pl-s"><span class="pl-pds">'</span>.4f<span class="pl-pds">'</span></span>)</td> - </tr> - <tr> - <td id="L297" class="blob-num js-line-number" data-line-number="297"></td> - <td id="LC297" class="blob-code blob-code-inner js-file-line"> tabString <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">"</span><tr><td>phy<span class="pl-pds">"</span></span> <span class="pl-k">+</span> <span class="pl-c1">str</span>(i <span class="pl-k">+</span> <span class="pl-c1">1</span>) <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span></td><td><span class="pl-pds">"</span></span> <span class="pl-k">+</span> f <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span></td><td><span class="pl-pds">"</span></span> <span class="pl-k">+</span> d <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span></td></tr><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L298" class="blob-num js-line-number" data-line-number="298"></td> - <td id="LC298" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>tabString += "<tr><td>phy" + str(i + 1) + "</td><td>" + str(freqList[i]) + "</td><td>" + str(devList[i]) + "</td></tr>"</span></td> - </tr> - <tr> - <td id="L299" class="blob-num js-line-number" data-line-number="299"></td> - <td id="LC299" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> tabString <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">"</span></table><br><br><br><br><br><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L300" class="blob-num js-line-number" data-line-number="300"></td> - <td id="LC300" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L301" class="blob-num js-line-number" data-line-number="301"></td> - <td id="LC301" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><h3>The Variation Heat Map and Dendrogram</h3><p>The absolute phylotype variation in the sample compared to model dataset<span class="pl-c1">.</span></p><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L302" class="blob-num js-line-number" data-line-number="302"></td> - <td id="LC302" class="blob-code blob-code-inner js-file-line"> imgString <span class="pl-k">=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><img src = 'heatmap<span class="pl-c1">.</span>png' alt='Variation Heatmap' style='max-width:100%'><br><br><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L303" class="blob-num js-line-number" data-line-number="303"></td> - <td id="LC303" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> imgString</td> - </tr> - <tr> - <td id="L304" class="blob-num js-line-number" data-line-number="304"></td> - <td id="LC304" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L305" class="blob-num js-line-number" data-line-number="305"></td> - <td id="LC305" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><br><br><br><br><h3>The Deviation Heat Map and Dendrogram</h3><p>The phylotype variation expressed as the deviation from your sample mean compared to the model dataset</p><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L306" class="blob-num js-line-number" data-line-number="306"></td> - <td id="LC306" class="blob-code blob-code-inner js-file-line"> imgString <span class="pl-k">=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><img src = 'dheatmap<span class="pl-c1">.</span>png' alt='Deviation Heatmap' style='max-width:100%'><br><br><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L307" class="blob-num js-line-number" data-line-number="307"></td> - <td id="LC307" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> imgString</td> - </tr> - <tr> - <td id="L308" class="blob-num js-line-number" data-line-number="308"></td> - <td id="LC308" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L309" class="blob-num js-line-number" data-line-number="309"></td> - <td id="LC309" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><br><br><br><br><h3>The Variation PCA plot</h3><p>PCA analysis corresponding to absolute variation<span class="pl-c1">.</span> Colour coded according to location</p><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L310" class="blob-num js-line-number" data-line-number="310"></td> - <td id="LC310" class="blob-code blob-code-inner js-file-line"> imgString <span class="pl-k">=</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span><img src = 'vapPCA<span class="pl-c1">.</span>png' alt='PCA Analysis' style='max-width:100%'><br><br><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L311" class="blob-num js-line-number" data-line-number="311"></td> - <td id="LC311" class="blob-code blob-code-inner js-file-line"> htmlString <span class="pl-k">+=</span> imgString <span class="pl-k">+</span> <span class="pl-sr"><span class="pl-k">r</span><span class="pl-pds">"</span></div></body></html><span class="pl-pds">"</span></span></td> - </tr> - <tr> - <td id="L312" class="blob-num js-line-number" data-line-number="312"></td> - <td id="LC312" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L313" class="blob-num js-line-number" data-line-number="313"></td> - <td id="LC313" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">with</span> <span class="pl-c1">open</span>(htmlfn, <span class="pl-s"><span class="pl-pds">"</span>w<span class="pl-pds">"</span></span>) <span class="pl-k">as</span> htmlfile:</td> - </tr> - <tr> - <td id="L314" class="blob-num js-line-number" data-line-number="314"></td> - <td id="LC314" class="blob-code blob-code-inner js-file-line"> htmlfile.write(htmlString)</td> - </tr> - <tr> - <td id="L315" class="blob-num js-line-number" data-line-number="315"></td> - <td id="LC315" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L316" class="blob-num js-line-number" data-line-number="316"></td> - <td id="LC316" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L317" class="blob-num js-line-number" data-line-number="317"></td> - <td id="LC317" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">assemble</span>(<span class="pl-smi">args</span>,<span class="pl-smi">dict</span>):</td> - </tr> - <tr> - <td id="L318" class="blob-num js-line-number" data-line-number="318"></td> - <td id="LC318" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>argdict = {'name': 2, 'pdfexport': 3, 'kmers': 4, 'inslen': 5, 'covcut': 6, 'forward': 7, 'reverse': 8, 'html_file': 9,'html_resource': 10}</span></td> - </tr> - <tr> - <td id="L319" class="blob-num js-line-number" data-line-number="319"></td> - <td id="LC319" class="blob-code blob-code-inner js-file-line"> assembleWithVelvet(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]],args[dict[<span class="pl-s"><span class="pl-pds">'</span>kmers<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>inslen<span class="pl-pds">'</span></span>]],args[dict[<span class="pl-s"><span class="pl-pds">'</span>covcut<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>forward<span class="pl-pds">'</span></span>]],args[dict[<span class="pl-s"><span class="pl-pds">'</span>reverse<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L320" class="blob-num js-line-number" data-line-number="320"></td> - <td id="LC320" class="blob-code blob-code-inner js-file-line"> contigTranslation(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L321" class="blob-num js-line-number" data-line-number="321"></td> - <td id="LC321" class="blob-code blob-code-inner js-file-line"> myCountList <span class="pl-k">=</span> HMMerMotifSearch(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L322" class="blob-num js-line-number" data-line-number="322"></td> - <td id="LC322" class="blob-code blob-code-inner js-file-line"> myFreqList <span class="pl-k">=</span> relativeFrequencyTable(myCountList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]],args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]]) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_relative_frequncy.csv</span></td> - </tr> - <tr> - <td id="L323" class="blob-num js-line-number" data-line-number="323"></td> - <td id="LC323" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421,</span></td> - </tr> - <tr> - <td id="L324" class="blob-num js-line-number" data-line-number="324"></td> - <td id="LC324" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612,</span></td> - </tr> - <tr> - <td id="L325" class="blob-num js-line-number" data-line-number="325"></td> - <td id="LC325" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837,</span></td> - </tr> - <tr> - <td id="L326" class="blob-num js-line-number" data-line-number="326"></td> - <td id="LC326" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0372233400402414, 0.17102615694165]</span></td> - </tr> - <tr> - <td id="L327" class="blob-num js-line-number" data-line-number="327"></td> - <td id="LC327" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L328" class="blob-num js-line-number" data-line-number="328"></td> - <td id="LC328" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L329" class="blob-num js-line-number" data-line-number="329"></td> - <td id="LC329" class="blob-code blob-code-inner js-file-line"> myDevList <span class="pl-k">=</span> getDeviationFromMean(myFreqList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]]) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_deviation_from_mean.csv</span></td> - </tr> - <tr> - <td id="L330" class="blob-num js-line-number" data-line-number="330"></td> - <td id="LC330" class="blob-code blob-code-inner js-file-line"> relativeFrequencyHeatMap(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myFreqList,args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L331" class="blob-num js-line-number" data-line-number="331"></td> - <td id="LC331" class="blob-code blob-code-inner js-file-line"> deviationFromMeanHeatMap(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myDevList,args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L332" class="blob-num js-line-number" data-line-number="332"></td> - <td id="LC332" class="blob-code blob-code-inner js-file-line"> plotPCA(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myFreqList,args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L333" class="blob-num js-line-number" data-line-number="333"></td> - <td id="LC333" class="blob-code blob-code-inner js-file-line"> createHTML(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_file<span class="pl-pds">'</span></span>]], myFreqList, myDevList) <span class="pl-c"><span class="pl-c">#</span> assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource</span></td> - </tr> - <tr> - <td id="L334" class="blob-num js-line-number" data-line-number="334"></td> - <td id="LC334" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L335" class="blob-num js-line-number" data-line-number="335"></td> - <td id="LC335" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">contigs</span>(<span class="pl-smi">args</span>,<span class="pl-smi">dict</span>):</td> - </tr> - <tr> - <td id="L336" class="blob-num js-line-number" data-line-number="336"></td> - <td id="LC336" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>argdict = {'name': 2, 'pdfexport': 3, 'contigs': 4, 'html_file': 5, 'html_resource': 6}</span></td> - </tr> - <tr> - <td id="L337" class="blob-num js-line-number" data-line-number="337"></td> - <td id="LC337" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L338" class="blob-num js-line-number" data-line-number="338"></td> - <td id="LC338" class="blob-code blob-code-inner js-file-line"> shutil.copyfile(args[dict[<span class="pl-s"><span class="pl-pds">'</span>contigs<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]]<span class="pl-k">+</span><span class="pl-s"><span class="pl-pds">"</span>.fa<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L339" class="blob-num js-line-number" data-line-number="339"></td> - <td id="LC339" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L340" class="blob-num js-line-number" data-line-number="340"></td> - <td id="LC340" class="blob-code blob-code-inner js-file-line"> </td> - </tr> - <tr> - <td id="L341" class="blob-num js-line-number" data-line-number="341"></td> - <td id="LC341" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L342" class="blob-num js-line-number" data-line-number="342"></td> - <td id="LC342" class="blob-code blob-code-inner js-file-line"> contigTranslation(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L343" class="blob-num js-line-number" data-line-number="343"></td> - <td id="LC343" class="blob-code blob-code-inner js-file-line"> myCountList <span class="pl-k">=</span> HMMerMotifSearch(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L344" class="blob-num js-line-number" data-line-number="344"></td> - <td id="LC344" class="blob-code blob-code-inner js-file-line"> myFreqList <span class="pl-k">=</span> relativeFrequencyTable(myCountList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]],</td> - </tr> - <tr> - <td id="L345" class="blob-num js-line-number" data-line-number="345"></td> - <td id="LC345" class="blob-code blob-code-inner js-file-line"> args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]]) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_relative_frequncy.csv</span></td> - </tr> - <tr> - <td id="L346" class="blob-num js-line-number" data-line-number="346"></td> - <td id="LC346" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421,</span></td> - </tr> - <tr> - <td id="L347" class="blob-num js-line-number" data-line-number="347"></td> - <td id="LC347" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612,</span></td> - </tr> - <tr> - <td id="L348" class="blob-num js-line-number" data-line-number="348"></td> - <td id="LC348" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837,</span></td> - </tr> - <tr> - <td id="L349" class="blob-num js-line-number" data-line-number="349"></td> - <td id="LC349" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0372233400402414, 0.17102615694165]</span></td> - </tr> - <tr> - <td id="L350" class="blob-num js-line-number" data-line-number="350"></td> - <td id="LC350" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L351" class="blob-num js-line-number" data-line-number="351"></td> - <td id="LC351" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L352" class="blob-num js-line-number" data-line-number="352"></td> - <td id="LC352" class="blob-code blob-code-inner js-file-line"> myDevList <span class="pl-k">=</span> getDeviationFromMean(myFreqList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]],</td> - </tr> - <tr> - <td id="L353" class="blob-num js-line-number" data-line-number="353"></td> - <td id="LC353" class="blob-code blob-code-inner js-file-line"> args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]]) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_deviation_from_mean.csv</span></td> - </tr> - <tr> - <td id="L354" class="blob-num js-line-number" data-line-number="354"></td> - <td id="LC354" class="blob-code blob-code-inner js-file-line"> relativeFrequencyHeatMap(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myFreqList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L355" class="blob-num js-line-number" data-line-number="355"></td> - <td id="LC355" class="blob-code blob-code-inner js-file-line"> deviationFromMeanHeatMap(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myDevList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L356" class="blob-num js-line-number" data-line-number="356"></td> - <td id="LC356" class="blob-code blob-code-inner js-file-line"> plotPCA(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], myFreqList, args[dict[<span class="pl-s"><span class="pl-pds">'</span>pdfexport<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_resource<span class="pl-pds">'</span></span>]])</td> - </tr> - <tr> - <td id="L357" class="blob-num js-line-number" data-line-number="357"></td> - <td id="LC357" class="blob-code blob-code-inner js-file-line"> createHTML(args[dict[<span class="pl-s"><span class="pl-pds">'</span>name<span class="pl-pds">'</span></span>]], args[dict[<span class="pl-s"><span class="pl-pds">'</span>html_file<span class="pl-pds">'</span></span>]], myFreqList,</td> - </tr> - <tr> - <td id="L358" class="blob-num js-line-number" data-line-number="358"></td> - <td id="LC358" class="blob-code blob-code-inner js-file-line"> myDevList) <span class="pl-c"><span class="pl-c">#</span> assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource</span></td> - </tr> - <tr> - <td id="L359" class="blob-num js-line-number" data-line-number="359"></td> - <td id="LC359" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L360" class="blob-num js-line-number" data-line-number="360"></td> - <td id="LC360" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L361" class="blob-num js-line-number" data-line-number="361"></td> - <td id="LC361" class="blob-code blob-code-inner js-file-line"><span class="pl-k">def</span> <span class="pl-en">genomicProcess</span>(<span class="pl-smi">inputname</span>, <span class="pl-smi">exportpdf</span>, <span class="pl-smi">forwardFN</span>, <span class="pl-smi">reverseFN</span>, <span class="pl-smi">htmlfile</span>, <span class="pl-smi">htmlresource</span>):</td> - </tr> - <tr> - <td id="L362" class="blob-num js-line-number" data-line-number="362"></td> - <td id="LC362" class="blob-code blob-code-inner js-file-line"> assembleWithVelvet(inputname,forwardFN,reverseFN)</td> - </tr> - <tr> - <td id="L363" class="blob-num js-line-number" data-line-number="363"></td> - <td id="LC363" class="blob-code blob-code-inner js-file-line"> contigTranslation(inputname)</td> - </tr> - <tr> - <td id="L364" class="blob-num js-line-number" data-line-number="364"></td> - <td id="LC364" class="blob-code blob-code-inner js-file-line"> myCountList <span class="pl-k">=</span> HMMerMotifSearch(inputname)</td> - </tr> - <tr> - <td id="L365" class="blob-num js-line-number" data-line-number="365"></td> - <td id="LC365" class="blob-code blob-code-inner js-file-line"> myFreqList <span class="pl-k">=</span> relativeFrequencyTable(myCountList, inputname, htmlresource) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_relative_frequncy.csv</span></td> - </tr> - <tr> - <td id="L366" class="blob-num js-line-number" data-line-number="366"></td> - <td id="LC366" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421,</span></td> - </tr> - <tr> - <td id="L367" class="blob-num js-line-number" data-line-number="367"></td> - <td id="LC367" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612,</span></td> - </tr> - <tr> - <td id="L368" class="blob-num js-line-number" data-line-number="368"></td> - <td id="LC368" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837,</span></td> - </tr> - <tr> - <td id="L369" class="blob-num js-line-number" data-line-number="369"></td> - <td id="LC369" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span> 0.0372233400402414, 0.17102615694165]</span></td> - </tr> - <tr> - <td id="L370" class="blob-num js-line-number" data-line-number="370"></td> - <td id="LC370" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L371" class="blob-num js-line-number" data-line-number="371"></td> - <td id="LC371" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L372" class="blob-num js-line-number" data-line-number="372"></td> - <td id="LC372" class="blob-code blob-code-inner js-file-line"> myDevList <span class="pl-k">=</span> getDeviationFromMean(myFreqList, inputname,htmlresource) <span class="pl-c"><span class="pl-c">#</span> saves out inputname_deviation_from_mean.csv</span></td> - </tr> - <tr> - <td id="L373" class="blob-num js-line-number" data-line-number="373"></td> - <td id="LC373" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L374" class="blob-num js-line-number" data-line-number="374"></td> - <td id="LC374" class="blob-code blob-code-inner js-file-line"> relativeFrequencyHeatMap(inputname, myFreqList, exportpdf, htmlresource)</td> - </tr> - <tr> - <td id="L375" class="blob-num js-line-number" data-line-number="375"></td> - <td id="LC375" class="blob-code blob-code-inner js-file-line"> deviationFromMeanHeatMap(inputname, myDevList, exportpdf, htmlresource)</td> - </tr> - <tr> - <td id="L376" class="blob-num js-line-number" data-line-number="376"></td> - <td id="LC376" class="blob-code blob-code-inner js-file-line"> plotPCA(inputname, myFreqList, exportpdf, htmlresource)</td> - </tr> - <tr> - <td id="L377" class="blob-num js-line-number" data-line-number="377"></td> - <td id="LC377" class="blob-code blob-code-inner js-file-line"> createHTML(inputname, htmlfile, myFreqList,myDevList) <span class="pl-c"><span class="pl-c">#</span> assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource</span></td> - </tr> - <tr> - <td id="L378" class="blob-num js-line-number" data-line-number="378"></td> - <td id="LC378" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span></td> - </tr> - <tr> - <td id="L379" class="blob-num js-line-number" data-line-number="379"></td> - <td id="LC379" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L380" class="blob-num js-line-number" data-line-number="380"></td> - <td id="LC380" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L381" class="blob-num js-line-number" data-line-number="381"></td> - <td id="LC381" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L382" class="blob-num js-line-number" data-line-number="382"></td> - <td id="LC382" class="blob-code blob-code-inner js-file-line"><span class="pl-k">if</span> <span class="pl-c1">__name__</span> <span class="pl-k">==</span> <span class="pl-s"><span class="pl-pds">"</span>__main__<span class="pl-pds">"</span></span>:</td> - </tr> - <tr> - <td id="L383" class="blob-num js-line-number" data-line-number="383"></td> - <td id="LC383" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>contigTranslation('Tcongo')</span></td> - </tr> - <tr> - <td id="L384" class="blob-num js-line-number" data-line-number="384"></td> - <td id="LC384" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>contigTranslation('Test')</span></td> - </tr> - <tr> - <td id="L385" class="blob-num js-line-number" data-line-number="385"></td> - <td id="LC385" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>newHMMerMotifSearch('Test')</span></td> - </tr> - <tr> - <td id="L386" class="blob-num js-line-number" data-line-number="386"></td> - <td id="LC386" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>HMMerMotifSearch('Tcongo')</span></td> - </tr> - <tr> - <td id="L387" class="blob-num js-line-number" data-line-number="387"></td> - <td id="LC387" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>sys.exit()</span></td> - </tr> - <tr> - <td id="L388" class="blob-num js-line-number" data-line-number="388"></td> - <td id="LC388" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L389" class="blob-num js-line-number" data-line-number="389"></td> - <td id="LC389" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L390" class="blob-num js-line-number" data-line-number="390"></td> - <td id="LC390" class="blob-code blob-code-inner js-file-line"> myFreqList <span class="pl-k">=</span> [<span class="pl-c1">0.111670020120724</span>, <span class="pl-c1">0.103621730382294</span>, <span class="pl-c1">0.0784708249496982</span>, <span class="pl-c1">0.0110663983903421</span>,</td> - </tr> - <tr> - <td id="L391" class="blob-num js-line-number" data-line-number="391"></td> - <td id="LC391" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">0.0543259557344064</span>, <span class="pl-c1">0.0563380281690141</span>, <span class="pl-c1">0.0734406438631791</span>, <span class="pl-c1">0.0160965794768612</span>,</td> - </tr> - <tr> - <td id="L392" class="blob-num js-line-number" data-line-number="392"></td> - <td id="LC392" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">0.0110663983903421</span>, <span class="pl-c1">0.028169014084507</span>, <span class="pl-c1">0.126760563380282</span>, <span class="pl-c1">0.0583501006036217</span>, <span class="pl-c1">0.062374245472837</span>,</td> - </tr> - <tr> - <td id="L393" class="blob-num js-line-number" data-line-number="393"></td> - <td id="LC393" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">0.0372233400402414</span>, <span class="pl-c1">0.17102615694165</span>]</td> - </tr> - <tr> - <td id="L394" class="blob-num js-line-number" data-line-number="394"></td> - <td id="LC394" class="blob-code blob-code-inner js-file-line"> myDevList <span class="pl-k">=</span> [<span class="pl-c1">0.000790026</span>,<span class="pl-c1">0.0073109</span>,<span class="pl-k">-</span><span class="pl-c1">0.001151769</span>,<span class="pl-k">-</span><span class="pl-c1">0.004502933</span>,<span class="pl-k">-</span><span class="pl-c1">0.013687421</span>,<span class="pl-k">-</span><span class="pl-c1">0.016159773</span>,<span class="pl-c1">0.021689891</span>,</td> - </tr> - <tr> - <td id="L395" class="blob-num js-line-number" data-line-number="395"></td> - <td id="LC395" class="blob-code blob-code-inner js-file-line"> <span class="pl-c1">0.007863809</span>,<span class="pl-k">-</span><span class="pl-c1">0.003133585</span>,<span class="pl-k">-</span><span class="pl-c1">0.001111709</span>,<span class="pl-k">-</span><span class="pl-c1">0.01313879</span>,<span class="pl-c1">0.0036997</span>,<span class="pl-k">-</span><span class="pl-c1">0.00935284</span>,<span class="pl-c1">0.005640693</span>,<span class="pl-c1">0.015243802</span>]</td> - </tr> - <tr> - <td id="L396" class="blob-num js-line-number" data-line-number="396"></td> - <td id="LC396" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L397" class="blob-num js-line-number" data-line-number="397"></td> - <td id="LC397" class="blob-code blob-code-inner js-file-line"> relativeFrequencyHeatMap(<span class="pl-s"><span class="pl-pds">'</span>test<span class="pl-pds">'</span></span>, myFreqList, <span class="pl-s"><span class="pl-pds">"</span>PDF_Yes<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>results<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L398" class="blob-num js-line-number" data-line-number="398"></td> - <td id="LC398" class="blob-code blob-code-inner js-file-line"> deviationFromMeanHeatMap(<span class="pl-s"><span class="pl-pds">'</span>test<span class="pl-pds">'</span></span>, myDevList, <span class="pl-s"><span class="pl-pds">"</span>PDF_Yes<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>results<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L399" class="blob-num js-line-number" data-line-number="399"></td> - <td id="LC399" class="blob-code blob-code-inner js-file-line"> plotPCA(<span class="pl-s"><span class="pl-pds">'</span>test<span class="pl-pds">'</span></span>,myFreqList,<span class="pl-s"><span class="pl-pds">"</span>PDF_Yes<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>results<span class="pl-pds">"</span></span>)</td> - </tr> - <tr> - <td id="L400" class="blob-num js-line-number" data-line-number="400"></td> - <td id="LC400" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L401" class="blob-num js-line-number" data-line-number="401"></td> - <td id="LC401" class="blob-code blob-code-inner js-file-line"> createHTML(<span class="pl-s"><span class="pl-pds">'</span>test<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>results/test.html<span class="pl-pds">"</span></span>, myFreqList, myDevList)</td> - </tr> - <tr> - <td id="L402" class="blob-num js-line-number" data-line-number="402"></td> - <td id="LC402" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>contigTranslation("Test")</span></td> - </tr> - <tr> - <td id="L403" class="blob-num js-line-number" data-line-number="403"></td> - <td id="LC403" class="blob-code blob-code-inner js-file-line"> <span class="pl-c"><span class="pl-c">#</span>myCountList = HMMerMotifSearch("Test")</span></td> - </tr> - <tr> - <td id="L404" class="blob-num js-line-number" data-line-number="404"></td> - <td id="LC404" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L405" class="blob-num js-line-number" data-line-number="405"></td> - <td id="LC405" class="blob-code blob-code-inner js-file-line"> -</td> - </tr> - <tr> - <td id="L406" class="blob-num js-line-number" data-line-number="406"></td> - <td id="LC406" class="blob-code blob-code-inner js-file-line"> sys.exit()</td> - </tr> -</table> + htmlString += r"<h3>The Variation Heat Map and Dendrogram</h3><p>The absolute phylotype variation in the sample compared to model dataset.</p>" + imgString = r"<img src = 'heatmap.png' alt='Variation Heatmap' style='max-width:100%'><br><br>" + htmlString += imgString + + htmlString += r"<br><br><br><br><h3>The Deviation Heat Map and Dendrogram</h3><p>The phylotype variation expressed as the deviation from your sample mean compared to the model dataset</p>" + imgString = r"<img src = 'dheatmap.png' alt='Deviation Heatmap' style='max-width:100%'><br><br>" + htmlString += imgString + + htmlString += r"<br><br><br><br><h3>The Variation PCA plot</h3><p>PCA analysis corresponding to absolute variation. Colour coded according to location</p>" + imgString = r"<img src = 'vapPCA.png' alt='PCA Analysis' style='max-width:100%'><br><br>" + htmlString += imgString + r"</div></body></html>" + + with open(htmlfn, "w") as htmlfile: + htmlfile.write(htmlString) + + +def assemble(args,dict): + #argdict = {'name': 2, 'pdfexport': 3, 'kmers': 4, 'inslen': 5, 'covcut': 6, 'forward': 7, 'reverse': 8, 'html_file': 9,'html_resource': 10} + assembleWithVelvet(args[dict['name']],args[dict['kmers']], args[dict['inslen']],args[dict['covcut']], args[dict['forward']],args[dict['reverse']]) + contigTranslation(args[dict['name']]) + myCountList = HMMerMotifSearch(args[dict['name']]) + myFreqList = relativeFrequencyTable(myCountList, args[dict['name']],args[dict['html_resource']]) # saves out inputname_relative_frequncy.csv + # myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421, + # 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612, + # 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837, + # 0.0372233400402414, 0.17102615694165] + + + myDevList = getDeviationFromMean(myFreqList, args[dict['name']], args[dict['html_resource']]) # saves out inputname_deviation_from_mean.csv + relativeFrequencyHeatMap(args[dict['name']], myFreqList,args[dict['pdfexport']], args[dict['html_resource']]) + deviationFromMeanHeatMap(args[dict['name']], myDevList,args[dict['pdfexport']], args[dict['html_resource']]) + plotPCA(args[dict['name']], myFreqList,args[dict['pdfexport']], args[dict['html_resource']]) + createHTML(args[dict['name']], args[dict['html_file']], myFreqList, myDevList) # assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource + +def contigs(args,dict): + #argdict = {'name': 2, 'pdfexport': 3, 'contigs': 4, 'html_file': 5, 'html_resource': 6} + + shutil.copyfile(args[dict['contigs']], args[dict['name']]+".fa") - <details class="details-reset details-overlay BlobToolbar position-absolute js-file-line-actions dropdown d-none" aria-hidden="true"> - <summary class="btn-octicon ml-0 px-2 p-0 bg-white border border-gray-dark rounded-1" aria-label="Inline file action toolbar"> - <svg class="octicon octicon-kebab-horizontal" viewBox="0 0 13 16" version="1.1" width="13" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM13 7.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/></svg> - </summary> - <details-menu> - <ul class="BlobToolbar-dropdown dropdown-menu dropdown-menu-se mt-2" style="width:185px"> - <li><clipboard-copy role="menuitem" class="dropdown-item" id="js-copy-lines" style="cursor:pointer;" data-original-text="Copy lines">Copy lines</clipboard-copy></li> - <li><clipboard-copy role="menuitem" class="dropdown-item" id="js-copy-permalink" style="cursor:pointer;" data-original-text="Copy permalink">Copy permalink</clipboard-copy></li> - <li><a class="dropdown-item js-update-url-with-hash" id="js-view-git-blame" role="menuitem" href="/johnheap/VAPPER-Galaxy/blame/a4e16d71fe985f389930c02f94354b87d3aabadb/Tryp_G.py">View git blame</a></li> - <li><a class="dropdown-item" id="js-new-issue" role="menuitem" href="/johnheap/VAPPER-Galaxy/issues/new">Reference in new issue</a></li> - </ul> - </details-menu> - </details> + + + contigTranslation(args[dict['name']]) + myCountList = HMMerMotifSearch(args[dict['name']]) + myFreqList = relativeFrequencyTable(myCountList, args[dict['name']], + args[dict['html_resource']]) # saves out inputname_relative_frequncy.csv + # myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421, + # 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612, + # 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837, + # 0.0372233400402414, 0.17102615694165] + + + myDevList = getDeviationFromMean(myFreqList, args[dict['name']], + args[dict['html_resource']]) # saves out inputname_deviation_from_mean.csv + relativeFrequencyHeatMap(args[dict['name']], myFreqList, args[dict['pdfexport']], args[dict['html_resource']]) + deviationFromMeanHeatMap(args[dict['name']], myDevList, args[dict['pdfexport']], args[dict['html_resource']]) + plotPCA(args[dict['name']], myFreqList, args[dict['pdfexport']], args[dict['html_resource']]) + createHTML(args[dict['name']], args[dict['html_file']], myFreqList, + myDevList) # assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource - </div> - - </div> - - - <details class="details-reset details-overlay details-overlay-dark"> - <summary data-hotkey="l" aria-label="Jump to line"></summary> - <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast linejump" aria-label="Jump to line"> - <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-jump-to-line-form Box-body d-flex" action="" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓" /> - <input class="form-control flex-auto mr-3 linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line…" aria-label="Jump to line" autofocus> - <button type="submit" class="btn" data-close-dialog>Go</button> -</form> </details-dialog> - </details> +def genomicProcess(inputname, exportpdf, forwardFN, reverseFN, htmlfile, htmlresource): + assembleWithVelvet(inputname,forwardFN,reverseFN) + contigTranslation(inputname) + myCountList = HMMerMotifSearch(inputname) + myFreqList = relativeFrequencyTable(myCountList, inputname, htmlresource) # saves out inputname_relative_frequncy.csv + #myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421, + # 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612, + # 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837, + # 0.0372233400402414, 0.17102615694165] + + + myDevList = getDeviationFromMean(myFreqList, inputname,htmlresource) # saves out inputname_deviation_from_mean.csv + + relativeFrequencyHeatMap(inputname, myFreqList, exportpdf, htmlresource) + deviationFromMeanHeatMap(inputname, myDevList, exportpdf, htmlresource) + plotPCA(inputname, myFreqList, exportpdf, htmlresource) + createHTML(inputname, htmlfile, myFreqList,myDevList) # assumes imgs are heatmap.png, dheatmap.png, vapPCA.png and already in htmlresource + return - </div> - <div class="modal-backdrop js-touch-events"></div> -</div> - - </main> - </div> - - - </div> - - -<div class="footer container-lg width-full p-responsive" role="contentinfo"> - <div class="position-relative d-flex flex-row-reverse flex-lg-row flex-wrap flex-lg-nowrap flex-justify-center flex-lg-justify-between pt-6 pb-2 mt-6 f6 text-gray border-top border-gray-light "> - <ul class="list-style-none d-flex flex-wrap col-12 col-lg-5 flex-justify-center flex-lg-justify-between mb-2 mb-lg-0"> - <li class="mr-3 mr-lg-0">© 2019 <span title="0.91244s from unicorn-7478f9985c-zn698">GitHub</span>, Inc.</li> - <li class="mr-3 mr-lg-0"><a data-ga-click="Footer, go to terms, text:terms" href="https://github.com/site/terms">Terms</a></li> - <li class="mr-3 mr-lg-0"><a data-ga-click="Footer, go to privacy, text:privacy" href="https://github.com/site/privacy">Privacy</a></li> - <li class="mr-3 mr-lg-0"><a data-ga-click="Footer, go to security, text:security" href="https://github.com/security">Security</a></li> - <li class="mr-3 mr-lg-0"><a href="https://githubstatus.com/" data-ga-click="Footer, go to status, text:status">Status</a></li> - <li><a data-ga-click="Footer, go to help, text:help" href="https://help.github.com">Help</a></li> - </ul> - - <a aria-label="Homepage" title="GitHub" class="footer-octicon d-none d-lg-block mx-lg-4" href="https://github.com"> - <svg height="24" class="octicon octicon-mark-github" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> -</a> - <ul class="list-style-none d-flex flex-wrap col-12 col-lg-5 flex-justify-center flex-lg-justify-between mb-2 mb-lg-0"> - <li class="mr-3 mr-lg-0"><a data-ga-click="Footer, go to contact, text:contact" href="https://github.com/contact">Contact GitHub</a></li> - <li class="mr-3 mr-lg-0"><a href="https://github.com/pricing" data-ga-click="Footer, go to Pricing, text:Pricing">Pricing</a></li> - <li class="mr-3 mr-lg-0"><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li> - <li class="mr-3 mr-lg-0"><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li> - <li class="mr-3 mr-lg-0"><a href="https://github.blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li> - <li><a data-ga-click="Footer, go to about, text:about" href="https://github.com/about">About</a></li> - - </ul> - </div> - <div class="d-flex flex-justify-center pb-6"> - <span class="f6 text-gray-light"></span> - </div> -</div> - +if __name__ == "__main__": + #contigTranslation('Tcongo') + #contigTranslation('Test') + #newHMMerMotifSearch('Test') + #HMMerMotifSearch('Tcongo') + #sys.exit() - <div id="ajax-error-message" class="ajax-error-message flash flash-error"> - <svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg> - <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> - <svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg> - </button> - You can’t perform that action at this time. - </div> + myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421, + 0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612, + 0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837, + 0.0372233400402414, 0.17102615694165] + myDevList = [0.000790026,0.0073109,-0.001151769,-0.004502933,-0.013687421,-0.016159773,0.021689891, + 0.007863809,-0.003133585,-0.001111709,-0.01313879,0.0036997,-0.00935284,0.005640693,0.015243802] + + relativeFrequencyHeatMap('test', myFreqList, "PDF_Yes","results") + deviationFromMeanHeatMap('test', myDevList, "PDF_Yes","results") + plotPCA('test',myFreqList,"PDF_Yes","results") + + createHTML('test',"results/test.html", myFreqList, myDevList) + #contigTranslation("Test") + #myCountList = HMMerMotifSearch("Test") - <script crossorigin="anonymous" integrity="sha512-EPrD+nddbyhpiLL8l3M8VfJpZr4J2EWQLaPXZ+6A3VDJKzS5HeZ3dkMVieHSdvIPHsMbWPyVlY42SWKoS4XTfA==" type="application/javascript" src="https://github.githubassets.com/assets/compat-bootstrap-831f12d4.js"></script> - <script crossorigin="anonymous" integrity="sha512-oFBEYscCdWEyvUQehaYyaCSiKtIN4UvpfFHNpIXLUTSQ35JcacPNj86R8fgJfI1e7BOjbLZPTv1nJg3TECiMLw==" type="application/javascript" src="https://github.githubassets.com/assets/frameworks-7af24171.js"></script> - - <script crossorigin="anonymous" async="async" integrity="sha512-b9BDH7EZq1yaR2fUH08I378zVkToScLiQ//L0gdyPviliuwpWiVFkB8uW0K8zZszdeLeBpib7wGBLkPiIFgyHg==" type="application/javascript" src="https://github.githubassets.com/assets/github-bootstrap-2a8c2b54.js"></script> - - - - <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner" hidden - > - <svg class="octicon octicon-alert" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"/></svg> - <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span> - <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span> - </div> - <template id="site-details-dialog"> - <details class="details-reset details-overlay details-overlay-dark lh-default text-gray-dark hx_rsm" open> - <summary role="button" aria-label="Close dialog"></summary> - <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> - <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> - <svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg> - </button> - <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> - </details-dialog> - </details> -</template> - - <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> - <div class="Popover-message Popover-message--bottom-left Popover-message--large Box box-shadow-large" style="width:360px;"> - </div> -</div> - - <div aria-live="polite" class="js-global-screen-reader-notice sr-only"></div> - - </body> -</html> - + sys.exit()