Repository 'vapper'
hg clone https://toolshed.g2.bx.psu.edu/repos/johnheap/vapper

Changeset 16:c4e87b277576 (2019-06-03)
Previous changeset 15:597fe882966e (2019-06-03) Next changeset 17:5e346d75ccf3 (2019-06-03)
Commit message:
Uploaded
modified:
Tryp_G.py
b
diff -r 597fe882966e -r c4e87b277576 Tryp_G.py
--- a/Tryp_G.py Mon Jun 03 15:57:59 2019 -0400
+++ b/Tryp_G.py Mon Jun 03 15:58:48 2019 -0400
[
b'@@ -1,2528 +1,406 @@\n-\n+"""\n+ * Copyright 2018 University of Liverpool\n+ * Author: John Heap, Computational Biology Facility, UoL\n+ * Based on original scripts of Sara Silva Pereira, Institute of Infection and Global Health, UoL\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the "License");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an "AS IS" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ """\n \n+import subprocess\n+import re\n+import os\n+import sys\n+import shutil\n+import pandas as pd\n+import numpy as np\n+import matplotlib as mpl\n+mpl.use(\'Agg\')\n+import matplotlib.pyplot as plt\n+from matplotlib.mlab import PCA\n+import seaborn as sns\n \n+# some globals for convenience\n \n+pList = [\'P1\', \'P2\', \'P3\', \'P4\', \'P5\', \'P6\', \'P7\', \'P8\', \'P9\', \'P10\', \'P11\', \'P12\', \'P13\', \'P14\', \'P15\']\n+\n+quietString = ""\t#" >>"+os.path.dirname(os.path.realpath(__file__))+"/log/Vap_log.txt 2>&1"\n+\n+def assembleWithVelvet(name, kmers, inslen, covcut, fastq1name,fastq2name):\n+    #argString = "velveth " + name + "_k65 65 -shortPaired -fastq " + name + "_R1.fastq " + name + "_R2.fastq"\n+    argString = "velveth " + name + "_k"+ kmers+" "+ kmers + " -shortPaired -fastq " + fastq1name+" "+fastq2name+quietString\n+    print(argString)\n+    returncode = subprocess.call(argString, shell=True)\n+    if returncode != 0:\n+        return "Error in velveth"\n+    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\n+    #argString = "velvetg " + name + "_k65 -exp_cov auto -ins_length 400 -cov_cutoff 5 -clean yes -ins_length_sd 50 -min_pair_count 20"+quietString\n+    print(argString)\n+    returncode = subprocess.call(argString, shell = True)\n+    if returncode != 0:\n+        return "Error in velvetg"\n+    shutil.copyfile(name + "_k"+kmers+"//contigs.fa",name + ".fa")  # my $namechange = "mv ".$input."_k65/contigs.fa ".$input.".fa";\n+    return "ok"\n+\n+def contigTranslation(name):\n+    argString = "transeq " + name + ".fa " + name + "_6frame.fas -frame=6 " #+quietString\n+    print(argString)\n+    returncode = subprocess.call(argString, shell=True)\n \n \n-<!DOCTYPE html>\n-<html lang="en">\n-  <head>\n-    <meta charset="utf-8">\n-  <link rel="dns-prefetch" href="https://github.githubassets.com">\n-  <link rel="dns-prefetch" href="https://avatars0.githubusercontent.com">\n-  <link rel="dns-prefetch" href="https://avatars1.githubusercontent.com">\n-  <link rel="dns-prefetch" href="https://avatars2.githubusercontent.com">\n-  <link rel="dns-prefetch" href="https://avatars3.githubusercontent.com">\n-  <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">\n-  <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">\n+def HMMerMotifSearch(name):\n+    motifs = [\'1\', \'2a\', \'2b\', \'3\', \'4a\', \'4b\', \'4c\', \'5\', \'6\', \'7\', \'8a\', \'8b\', \'9a\', \'9b\',\n+              \'9c\', \'10a\', \'10b\', \'11a\', \'11b\', \'12\', \'13a\', \'13b\', \'13c\', \'13d\', \'14\', \'15a\', \'15b\', \'15c\']\n+    lineCounts = []\n+    compoundList = []\n+    dir_path = os.path.dirname(os.path.realpath(__file__))\n+    phylopath = dir_path + "/data/Motifs/Phylotype"\n+    for m in motifs:\n+        argString = "hmmsearch " + phylopath + m + ".hmm " + name + "_6frame.fas > Phy" + m + ".out"  # +quietString\n+        # argString = "hmmsearch "+phylopath + m + ".hmm " + dir_path+"/data/Test_6frame.fas > Phy" + m + ".out"\n+        #print(argString)\n+        subprocess.call(argString, shell=True)\n+\n+        hmmResult = open("Phy" + m + ".out", \'r\')\n+        tempout = open(dir_path + "/data/" + "Phy" + m + ".txt", \'w\')\n+   '..b'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>\n-    </button>\n-    You can\xe2\x80\x99t perform that action at this time.\n-  </div>\n+    myFreqList = [0.111670020120724, 0.103621730382294, 0.0784708249496982, 0.0110663983903421,\n+                  0.0543259557344064, 0.0563380281690141, 0.0734406438631791, 0.0160965794768612,\n+                  0.0110663983903421, 0.028169014084507, 0.126760563380282, 0.0583501006036217, 0.062374245472837,\n+                  0.0372233400402414, 0.17102615694165]\n+    myDevList = [0.000790026,0.0073109,-0.001151769,-0.004502933,-0.013687421,-0.016159773,0.021689891,\n+                 0.007863809,-0.003133585,-0.001111709,-0.01313879,0.0036997,-0.00935284,0.005640693,0.015243802]\n+\n+    relativeFrequencyHeatMap(\'test\', myFreqList, "PDF_Yes","results")\n+    deviationFromMeanHeatMap(\'test\', myDevList, "PDF_Yes","results")\n+    plotPCA(\'test\',myFreqList,"PDF_Yes","results")\n+\n+    createHTML(\'test\',"results/test.html", myFreqList, myDevList)\n+    #contigTranslation("Test")\n+    #myCountList = HMMerMotifSearch("Test")\n \n \n-    <script crossorigin="anonymous" integrity="sha512-EPrD+nddbyhpiLL8l3M8VfJpZr4J2EWQLaPXZ+6A3VDJKzS5HeZ3dkMVieHSdvIPHsMbWPyVlY42SWKoS4XTfA==" type="application/javascript" src="https://github.githubassets.com/assets/compat-bootstrap-831f12d4.js"></script>\n-    <script crossorigin="anonymous" integrity="sha512-oFBEYscCdWEyvUQehaYyaCSiKtIN4UvpfFHNpIXLUTSQ35JcacPNj86R8fgJfI1e7BOjbLZPTv1nJg3TECiMLw==" type="application/javascript" src="https://github.githubassets.com/assets/frameworks-7af24171.js"></script>\n-    \n-    <script crossorigin="anonymous" async="async" integrity="sha512-b9BDH7EZq1yaR2fUH08I378zVkToScLiQ//L0gdyPviliuwpWiVFkB8uW0K8zZszdeLeBpib7wGBLkPiIFgyHg==" type="application/javascript" src="https://github.githubassets.com/assets/github-bootstrap-2a8c2b54.js"></script>\n-    \n-    \n-    \n-  <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner" hidden\n-    >\n-    <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>\n-    <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>\n-    <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>\n-  </div>\n-  <template id="site-details-dialog">\n-  <details class="details-reset details-overlay details-overlay-dark lh-default text-gray-dark hx_rsm" open>\n-    <summary role="button" aria-label="Close dialog"></summary>\n-    <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal">\n-      <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog>\n-        <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>\n-      </button>\n-      <div class="octocat-spinner my-6 js-details-dialog-spinner"></div>\n-    </details-dialog>\n-  </details>\n-</template>\n-\n-  <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0">\n-  <div class="Popover-message Popover-message--bottom-left Popover-message--large Box box-shadow-large" style="width:360px;">\n-  </div>\n-</div>\n-\n-  <div aria-live="polite" class="js-global-screen-reader-notice sr-only"></div>\n-\n-  </body>\n-</html>\n-\n+    sys.exit()\n'