# HG changeset patch # User jjjjia # Date 1535063754 14400 # Node ID 4d2777aa99dbb96a8f1f6abe20b6652e9fe4b13d # Parent cabceaa239e49312e6ba51e39d65437c47229e81 planemo upload diff -r cabceaa239e4 -r 4d2777aa99db cpo_galaxy_tree.py --- a/cpo_galaxy_tree.py Thu Aug 23 12:21:15 2018 -0400 +++ b/cpo_galaxy_tree.py Thu Aug 23 18:35:54 2018 -0400 @@ -4,17 +4,24 @@ #$ -V # Pass environment variables to the job #$ -N CPO_pipeline # Replace with a more specific job name #$ -wd /home/jjjjia/testCases # Use the current working dir -#$ -pe smp 8 # Parallel Environment (how many cores) +#$ -pe smp 1 # Parallel Environment (how many cores) #$ -l h_vmem=11G # Memory (RAM) allocation *per core* #$ -e ./logs/$JOB_ID.err #$ -o ./logs/$JOB_ID.log #$ -m ea #$ -M bja20@sfu.ca -#~/scripts/pipeline.py -i BC11-Kpn005_S2 -f /data/jjjjia/R1/BC11-Kpn005_S2_L001_R1_001.fastq.gz -r /data/jjjjia/R2/BC11-Kpn005_S2_L001_R2_001.fastq.gz -o pipelineResultsQsub -e "Klebsiella pneumoniae" +# >python cpo_galaxy_tree.py -t /path/to/tree.ph -d /path/to/distance/matrix -m /path/to/metadata + +# +# pandas +# python +# ete3 +# pyqt +# import subprocess -import pandas +import pandas #conda pandas import optparse import os import datetime @@ -24,8 +31,8 @@ import gzip import collections import json -import numpy -import ete3 as e +import numpy #conda numpy +import ete3 as e #conda ete3 3.1.1**** >requires pyqt5 #parses some parameters @@ -69,9 +76,9 @@ #endregion #region useful functions -def read(path): +def read(path): #read in a text file to a list return [line.rstrip('\n') for line in open(path)] -def execute(command): +def execute(command): #subprocess.popen call bash command process = subprocess.Popen(command, shell=False, cwd=curDir, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # Poll process for new output until finished @@ -89,13 +96,13 @@ return output else: raise subprocess.CalledProcessError(exitCode, command) -def httpGetFile(url, filepath=""): +def httpGetFile(url, filepath=""): #download a file from the web if (filepath == ""): return urllib.request.urlretrieve(url) else: urllib.request.urlretrieve(url, filepath) return True -def gunzip(inputpath="", outputpath=""): +def gunzip(inputpath="", outputpath=""): #gunzip if (outputpath == ""): with gzip.open(inputpath, 'rb') as f: gzContent = f.read() @@ -106,7 +113,7 @@ with open(outputpath, 'wb') as out: out.write(gzContent) return True -def addFace(name): +def addFace(name): #function to add a facet to a tree #if its the reference branch, populate the faces with column headers face = e.faces.TextFace(name,fsize=10,tight_text=True) face.border.margin = 5 diff -r cabceaa239e4 -r 4d2777aa99db cpo_galaxy_tree.xml --- a/cpo_galaxy_tree.xml Thu Aug 23 12:21:15 2018 -0400 +++ b/cpo_galaxy_tree.xml Thu Aug 23 18:35:54 2018 -0400 @@ -1,10 +1,10 @@ This tool makes a phylogenetic tree using data from snippy alignments, clustalw NJ tree and metadat from cpo_prediction workflow using ETE3 - pandas - python + python + pandas ete3 - pyqt + pyqt - + \ No newline at end of file