comparison cpo_galaxy_tree.py @ 26:3dc84625d22c draft

planemo upload
author jjjjia
date Wed, 29 Aug 2018 17:25:50 -0400
parents 573136f142b6
children 13bf5059984a
comparison
equal deleted inserted replaced
25:573136f142b6 26:3dc84625d22c
23 23
24 import subprocess 24 import subprocess
25 import pandas #conda pandas 25 import pandas #conda pandas
26 import optparse 26 import optparse
27 import os 27 import os
28 os.environ['QT_QPA_PLATFORM']='offscreen' 28 #os.environ['QT_QPA_PLATFORM']='offscreen'
29 import datetime 29 import datetime
30 import sys 30 import sys
31 import time 31 import time
32 import urllib.request 32 import urllib.request
33 import gzip 33 import gzip
38 38
39 39
40 #parses some parameters 40 #parses some parameters
41 parser = optparse.OptionParser("Usage: %prog [options] arg1 arg2 ...") 41 parser = optparse.OptionParser("Usage: %prog [options] arg1 arg2 ...")
42 parser.add_option("-t", "--tree", dest="treePath", type="string", default="./pipelineTest/tree.txt", help="absolute file path to phylip tree") 42 parser.add_option("-t", "--tree", dest="treePath", type="string", default="./pipelineTest/tree.txt", help="absolute file path to phylip tree")
43 parser.add_option("-d", "--distance", dest="distancePath", type="string", default="./pipelineTest/distance.tab", help="absolute file path to distance matrix") 43 parser.add_option("-d", "--distance", dest="distancePath", type="string", default="./pipelineTest/dist.tabular", help="absolute file path to distance matrix")
44 parser.add_option("-m", "--metadata", dest="metadataPath", type="string", default="./pipelineTest/metadata.tsv",help="absolute file path to metadata file") 44 parser.add_option("-m", "--metadata", dest="metadataPath", type="string", default="./pipelineTest/metadata.tabular",help="absolute file path to metadata file")
45 parser.add_option("-o", "--output_file", dest="outputFile", type="string", default="tree.png", help="Output graphics file. Use ending 'png', 'pdf' or 'svg' to specify file format.") 45 parser.add_option("-o", "--output_file", dest="outputFile", type="string", default="tree.png", help="Output graphics file. Use ending 'png', 'pdf' or 'svg' to specify file format.")
46 46
47 # sensitive data adder 47 # sensitive data adder
48 parser.add_option("-p", "--sensitive_data", dest="sensitivePath", type="string", default="", help="Spreadsheet (CSV) with sensitive metadata") 48 parser.add_option("-p", "--sensitive_data", dest="sensitivePath", type="string", default="", help="Spreadsheet (CSV) with sensitive metadata")
49 parser.add_option("-c", "--sensitive_cols", dest="sensitiveCols", type="string", default="", help="CSV list of column names from sensitive metadata spreadsheet to use as labels on dendrogram") 49 parser.add_option("-c", "--sensitive_cols", dest="sensitiveCols", type="string", default="", help="CSV list of column names from sensitive metadata spreadsheet to use as labels on dendrogram")
183 _results.CarbapenemResistanceGenes = (str(r.loc[r.index[i], 'Carbapenem Resistance Genes'])) 183 _results.CarbapenemResistanceGenes = (str(r.loc[r.index[i], 'Carbapenem Resistance Genes']))
184 _results.OtherAMRGenes = (str(r.loc[r.index[i], 'Other AMR Genes'])) 184 _results.OtherAMRGenes = (str(r.loc[r.index[i], 'Other AMR Genes']))
185 _results.TotalPlasmids = int(r.loc[r.index[i], 'Total Plasmids']) 185 _results.TotalPlasmids = int(r.loc[r.index[i], 'Total Plasmids'])
186 _results.plasmidBestMatch = str(r.loc[r.index[i], 'Plasmid Best Match']) 186 _results.plasmidBestMatch = str(r.loc[r.index[i], 'Plasmid Best Match'])
187 _results.plasmididentity = str(r.loc[r.index[i], 'Plasmid Identity']) 187 _results.plasmididentity = str(r.loc[r.index[i], 'Plasmid Identity'])
188 _results.plasmidsharedhashes = float(r.loc[r.index[i], 'Plasmid Shared Hash']) 188 _results.plasmidsharedhashes = str(r.loc[r.index[i], 'Plasmid Shared Hash'])
189 for j in range(0,_results.TotalPlasmids): 189 for j in range(0,_results.TotalPlasmids):
190 _plasmid = plasmidObj() 190 _plasmid = plasmidObj()
191 _plasmid.PlasmidsID =(((str(r.loc[r.index[i], 'Plasmids ID'])).split(";"))[j]) 191 _plasmid.PlasmidsID =(((str(r.loc[r.index[i], 'Plasmids ID'])).split(";"))[j])
192 _plasmid.Num_Contigs = (((str(r.loc[r.index[i], 'Num_Contigs'])).split(";"))[j]) 192 _plasmid.Num_Contigs = (((str(r.loc[r.index[i], 'Num_Contigs'])).split(";"))[j])
193 _plasmid.PlasmidLength = (((str(r.loc[r.index[i], 'Plasmid Length'])).split(";"))[j]) 193 _plasmid.PlasmidLength = (((str(r.loc[r.index[i], 'Plasmid Length'])).split(";"))[j])