annotate Vap.py @ 8:e75a85590041 draft

Uploaded
author johnheap
date Mon, 03 Jun 2019 14:09:07 -0400
parents 36cb22bd911d
children c4463e84a7ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
1 """
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
2 * Copyright 2018 University of Liverpool
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
3 * Author: John Heap, Computational Biology Facility, UoL
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
4 * Based on original scripts of Sara Silva Pereira, Institute of Infection and Global Health, UoL
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
5 *
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
6 * Licensed under the Apache License, Version 2.0 (the "License");
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
7 * you may not use this file except in compliance with the License.
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
8 * You may obtain a copy of the License at
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
9 *
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
10 * http://www.apache.org/licenses/LICENSE-2.0
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
11 *
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
12 * Unless required by applicable law or agreed to in writing, software
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
13 * distributed under the License is distributed on an "AS IS" BASIS,
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
15 * See the License for the specific language governing permissions and
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
16 * limitations under the License.
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
17 *
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
18 """
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
19 #import subprocess
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
20 #import re
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
21 import os
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
22 import sys
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
23 #import pandas as pd
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
24 #import numpy as np
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
25 #import seaborn as sns
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
26 #import matplotlib.pyplot as plt
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
27 #from matplotlib.mlab import PCA
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
28 import Tryp_G
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
29 import Tryp_T
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
30 import Tryp_V
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
31 import argparse
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
32 #Entry .sort out the arguments
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
33
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
34 pdfExport = False
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
35 #parser = argparse.ArgumentParser(description='Variant Antigen Profiler - the VAP.')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
36 #parser.add_argument('name')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
37 #parser.add_argument('-t','-T', action = 'store_true', default = False, help = "Transciptomic Pathway")
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
38 #parser.add_argument('-p','-P', action = 'store_true', default = False, help = "Export PDFs to HTML directory")
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
39 #parser.add_argument('strain')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
40 #parser.add_argument('Forward_Read_File')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
41 #parser.add_argument('Reverse_Read_File')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
42 #parser.add_argument('htmlfile')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
43 #parser.add_argument('htmlresource')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
44 #parser.add_argument('heatmapFile')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
45 #parser.add_argument('PCAFile')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
46 #parser.add_argument('devheatmapFile')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
47 #args = parser.parse_args()
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
48
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
49 #we have numerous parameters....
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
50 #hard code it for differnt types?
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
51
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
52
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
53 arguments = sys.argv
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
54 htmldir = arguments[len(arguments)-1] #last argument is always html_resource
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
55 if not os.path.exists(htmldir):
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
56 os.mkdir(htmldir)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
57
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
58 if arguments[1] == 'g_assemble':
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
59 argdict = {'name':2, 'pdfexport':3, 'kmers':4,'inslen':5, 'covcut':6, 'forward':7, 'reverse':8, 'html_file':9, 'html_resource':10}
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
60 Tryp_G.assemble(arguments,argdict)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
61 if arguments[1] == 'g_contigs':
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
62 argdict = {'name':2, 'pdfexport':3, 'contigs':4, 'html_file':5, 'html_resource':6}
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
63 Tryp_G.contigs(arguments,argdict)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
64 if arguments[1] == 'transcipt':
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
65 argdict = {'name':2, 'pdfexport': 3, 'strain': 4, 'forward': 5, 'reverse': 6, 'html_file': 7, 'html_resource': 8}
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
66 Tryp_T.transcriptomicProcess(arguments,argdict)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
67 if arguments[1] == 'v_assemble':
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
68 argdict = {'name':2, 'pdfexport':3, 'kmers':4,'inslen':5, 'covcut':6, 'forward':7, 'reverse':8, 'html_file':9, 'html_resource':10}
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
69 Tryp_V.vivax_assemble(arguments,argdict)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
70 if arguments[1] == 'v_contigs':
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
71 argdict = {'name':2, 'pdfexport':3, 'contigs':4, 'html_file':5, 'html_resource':6}
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
72 Tryp_V.vivax_contigs(arguments,argdict)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
73
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
74
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
75 sys.exit()
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
76
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
77
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
78
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
79 #if not os.path.exists(args.htmlresource):
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
80 # os.mkdir(args.htmlresource)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
81 #if args.p:
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
82 # pdfExport = True
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
83 #if args.t:
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
84 # print ("Transcriptomic Pathway")
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
85 # Tryp_T.transcriptomicProcess(args.name, pdfExport, args.strain, args.Forward_Read_File, args.Reverse_Read_File, args.htmlfile, args.htmlresource)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
86 #else:
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
87 #print ('Genomic Pathway')
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
88 #Tryp_G.test_output(args.name, args.htmlfile, args.htmlresource, args.heatmapFile, args.PCAFile,args.devheatmapFile)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
89 # Tryp_G.genomicProcess(args.name, pdfExport, args.Forward_Read_File, args.Reverse_Read_File, args.htmlfile, args.htmlresource)
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
90
36cb22bd911d planemo upload for repository https://github.com/johnheap/VAPPER-Galaxy
johnheap
parents:
diff changeset
91