Skip to content
Commits on Source (9)
......@@ -63,6 +63,7 @@ docs/_build/
**/doc/_build/
#Data files
/data/
*.wig
*.dat
*.png
......
# Change log
All notable changes to this project will be documented in this file.
## Version 3.0.0 2019-07-18
#### TRANSIT:
- TRANSIT now supports python 3. (To use with python 2, use releases < 3.0.0)
- Improved speed of GSEA in Pathway Enrichment analysis.
## Version 2.5.2 2019-05-16
#### TRANSIT:
......
# TRANSIT 2.5.1
[![Build Status](https://travis-ci.org/mad-lab/transit.svg?branch=master)](https://travis-ci.org/mad-lab/transit) [![Documentation Status](https://readthedocs.org/projects/transit/badge/?version=latest)](http://transit.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/tnseq-transit)](https://pepy.tech/project/tnseq-transit)
# TRANSIT
[![Version](https://img.shields.io/github/tag/mad-lab/transit.svg)](https://github.com/mad-lab/transit) [![Build Status](https://travis-ci.org/mad-lab/transit.svg?branch=master)](https://travis-ci.org/mad-lab/transit) [![Documentation Status](https://readthedocs.org/projects/transit/badge/?version=latest)](http://transit.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/tnseq-transit)](https://pepy.tech/project/tnseq-transit)
=======
Welcome! This is the distribution for the TRANSIT and TPP tools developed by the [Ioerger Lab](http://orca2.tamu.edu/tom/iLab.html) at Texas A&M University.
......
tnseq-transit (3.0.0-1) UNRELEASED; urgency=medium
* New upstream version
* New version supports Python3
Closes: #931711
* debhelper-compat 12
* Standards-Version: 4.4.0
* Depends: s/python3-wxgtk3.0/python3-wxgtk4.0/
TODO: https://pypi.org/project/PyPubSub/
-- Andreas Tille <tille@debian.org> Thu, 25 Jul 2019 21:35:41 +0200
tnseq-transit (2.5.2-1) unstable; urgency=medium
* New upstream version
......
......@@ -3,30 +3,30 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.
Uploaders: Andreas Tille <tille@debian.org>
Section: science
Priority: optional
Build-Depends: debhelper (>= 12~),
Build-Depends: debhelper-compat (= 12),
dh-python,
python-dev,
python-setuptools,
python-numpy,
python-scipy,
python-pil,
python-matplotlib,
python-statsmodels,
python3-dev,
python3-setuptools,
python3-numpy,
python3-scipy,
python3-pil,
python3-matplotlib,
python3-statsmodels,
bwa
Standards-Version: 4.3.0
Standards-Version: 4.4.0
Vcs-Browser: https://salsa.debian.org/med-team/tnseq-transit
Vcs-Git: https://salsa.debian.org/med-team/tnseq-transit.git
Homepage: http://saclab.tamu.edu/essentiality/transit/
Package: tnseq-transit
Architecture: any
Depends: ${python:Depends},
Depends: ${python3:Depends},
${misc:Depends},
python-numpy,
python-scipy,
python-pil,
python-matplotlib,
python-wxgtk3.0,
python3-numpy,
python3-scipy,
python3-pil,
python3-matplotlib,
python3-wxgtk4.0,
bwa
Breaks: transit
Provides: transit
......
Author: Andreas Tille <tille@debian.org>
Last-Update: Thu, 25 Jul 2019 21:35:41 +0200
Description: Use 2to3 to finalise Python2 -> Python3 migration
--- a/src/pytransit/analysis/multitnseq.py
+++ b/src/pytransit/analysis/multitnseq.py
@@ -9,7 +9,7 @@ try:
except Exception as e:
hasR = False
-import base
+from . import base
import numpy
import scipy
import pdfkit
@@ -18,7 +18,7 @@ import statsmodels.stats.multicomp
import pytransit.transit_tools as transit_tools
import pytransit.tnseq_tools as tnseq_tools
import pytransit.norm_tools as norm_tools
-from multitnseq_helpers import def_r_samples_corrplot, def_r_clustering, def_r_make_heatmap, def_r_conditions_corrplot
+from .multitnseq_helpers import def_r_samples_corrplot, def_r_clustering, def_r_make_heatmap, def_r_conditions_corrplot
###### GUI ELEMENTS ######
short_name = "MultiTnSeq"
@@ -60,7 +60,7 @@ class MultiTnSeqMethod(base.AnalysisMeth
(args, kwargs) = transit_tools.cleanargs(rawargs)
if (kwargs.get('-help', False) or kwargs.get('h', False)):
- print(MultiTnSeqMethod.usage_string())
+ print((MultiTnSeqMethod.usage_string()))
sys.exit(0)
fna = args[0]
@@ -130,7 +130,7 @@ class MultiTnSeqMethod(base.AnalysisMeth
if Samples.get(row,"Condition") == cond:
fname = Samples.get(row,"Filename")
if fname not in filenamesInCombWig:
- print "error: filename '%s' listed in samples metadata not found in combined wig file" % fname; sys.exit(0)
+ print("error: filename '%s' listed in samples metadata not found in combined wig file" % fname); sys.exit(0)
SampleIndexes.append(row)
wigindexes.append(filenamesInCombWig.index(fname))
@@ -149,7 +149,7 @@ class MultiTnSeqMethod(base.AnalysisMeth
fname = Samples.get(row,"Filename")
cond2datasets[cond].append(filenamesInData.index(fname))
if len(cond2datasets[cond]) == 0:
- print "error: no samples found in metadata for condition %s" % cond; sys.exit(0)
+ print("error: no samples found in metadata for condition %s" % cond); sys.exit(0)
(normed, factors) = norm_tools.normalize_data(data, method='TTR')
Nds,Nsites = normed.shape # transposed: rows are datasets, cols are TA sites
@@ -196,15 +196,15 @@ class MultiTnSeqMethod(base.AnalysisMeth
if False: # print means for each gene for each dataset
- print '\t'.join(filenamesInData)
- print '\t'.join([Samples.get(x,"Id") for x in SampleIndexes])
+ print('\t'.join(filenamesInData))
+ print('\t'.join([Samples.get(x,"Id") for x in SampleIndexes]))
for (start,end,Rv,gene,strand) in genes:
if len(TAsites[Rv])>0: # skip genes with no TA sites
means = []
for j in range(Nds):
obs = normed[j,TAsites[Rv]]
means.append(numpy.mean(obs))
- print '\t'.join([Rv,gene,str(len(TAsites[Rv]))]+["%0.1f" % x for x in means])
+ print('\t'.join([Rv,gene,str(len(TAsites[Rv]))]+["%0.1f" % x for x in means]))
#sys.exit(0)
@@ -344,14 +344,14 @@ class MultiTnSeqMethod(base.AnalysisMeth
batches[batch].append(Means[Rv][r])
vals.append(Means[Rv][r]) ###
for b in "CC1 CC2 CC3 KO".split(): vals.append(numpy.mean(batches[b]))
- print '\t'.join([Rv,gene]+["%0.1f" % x for x in vals]) ###
+ print('\t'.join([Rv,gene]+["%0.1f" % x for x in vals])) ###
###sys.exit(0)
# remove batch effects (subtract batch means from mean gene counts; adjust each to global mean)
if self.debatch and "Batch" in Conditions.headers:
- print "<BR>correcting means for batch effects..."
+ print("<BR>correcting means for batch effects...")
for (start,end,Rv,gene,strand) in genes:
if Rv in Means:
batches = {}
@@ -372,11 +372,11 @@ class MultiTnSeqMethod(base.AnalysisMeth
if False: # print gene means for each condition (with batch corrections)
vals = ['ORF','gene']+Conditions.getcol("Condition")
- print '\t'.join(vals)
+ print('\t'.join(vals))
for (start,end,Rv,gene,strand) in genes:
if Rv not in Means: continue
vals = [Means[Rv][r] for r in range(Conditions.nrows)]
- print '\t'.join([Rv,gene]+["%0.1f" % x for x in vals])
+ print('\t'.join([Rv,gene]+["%0.1f" % x for x in vals]))
sys.exit(0)
################################
@@ -398,11 +398,11 @@ class MultiTnSeqMethod(base.AnalysisMeth
lfcs[Rv] = lfcvec
if self.stdnorm:
- print "<BR>applying standard normalization to LFCs"
+ print("<BR>applying standard normalization to LFCs")
for i,cond in enumerate(Conditions.keys):
- col = [row[i] for row in lfcs.values()]
+ col = [row[i] for row in list(lfcs.values())]
m,s = numpy.mean(col),numpy.std(col) # consider using quantiles(col,[0,0.25,0.5,0.75,1.0])
- for Rv in lfcs.keys():
+ for Rv in list(lfcs.keys()):
lfcs[Rv][i] = (lfcs[Rv][i]-m)/s
file = open(self.makefname("temp_LFCs.txt", self.rundir),"w")
@@ -415,7 +415,7 @@ class MultiTnSeqMethod(base.AnalysisMeth
file.write('\t'.join([str(x) for x in vals])+EOL)
cnt += 1
file.close()
- if cnt==0: print "error: no significantly varying genes found by ANOVA"; return
+ if cnt==0: print("error: no significantly varying genes found by ANOVA"); return
r_conditions_corrplot = def_r_conditions_corrplot()
r_make_heatmap = def_r_make_heatmap()
skip_test_requiring_non_existing_input_data.patch
2to3.patch
......@@ -6,7 +6,7 @@ export LC_ALL=C.UTF-8
include /usr/share/dpkg/default.mk
%:
dh $@ --with python2 --buildsystem=pybuild
dh $@ --with python3 --buildsystem=pybuild
override_dh_install:
dh_install
......
......@@ -61,6 +61,7 @@ class UploadCommand(Command):
if not self.yes_or_no("Have you done the following? \n" +
"- Updated README/Documentation?\n"
"- Are in the master branch, and have you merged version branch into master?\n"
"- Have you run the tests ('pytest tests/')?\n"
"- Have you updated CHANGELOG?\n"
"- Have you updated Transit Essentiality page?\n"
"- Updated version in src/pytransit/__init__.py (used to set git tag)?\n"
......@@ -111,12 +112,14 @@ setup(
# Choose your license
license='GNU GPL',
python_requires='>=3.6',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
#'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: OS Independent',
......@@ -144,7 +147,7 @@ setup(
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['setuptools', 'numpy~=1.15', 'scipy~=1.2', 'matplotlib~=2.2', 'pillow~=5.0', 'statsmodels~=0.9'],
install_requires=['setuptools', 'numpy~=1.16', 'scipy~=1.2', 'matplotlib~=3.0', 'pillow~=6.0', 'statsmodels~=0.9'],
#dependency_links = [
# "git+https://github.com/wxWidgets/wxPython.git#egg=wxPython"
......
......@@ -30,8 +30,8 @@ import shutil
import platform
import gzip
from tpp_tools import *
from tpp_gui import *
from pytpp.tpp_tools import *
from pytpp.tpp_gui import *
def run_main():
......@@ -67,9 +67,9 @@ def main(*args, **kwargs):
pass
elif not args and not kwargs and not hasWx:
print "Please install wxPython to run in GUI Mode."
print "To run in Console Mode please follow these instructions:"
print ""
print("Please install wxPython to run in GUI Mode.")
print("To run in Console Mode please follow these instructions:")
print("")
show_help()
else:
......@@ -85,7 +85,7 @@ def main(*args, **kwargs):
"window-size", "bwa-alg", "replicon-ids","primer-start-window"])
unknown_flags = set(kwargs.keys()) - known_flags
if unknown_flags:
print "error: unrecognized flags:", ", ".join(unknown_flags)
print("error: unrecognized flags:", ", ".join(unknown_flags))
show_help()
sys.exit()
......
......@@ -36,7 +36,7 @@ try:
except Exception as e:
hasWx = False
from tpp_tools import *
from pytpp.tpp_tools import *
if hasWx:
......@@ -339,7 +339,7 @@ The Mme1 protocol generally assumes reads do NOT include the primer prefix, and
#
def OnChanged(self, str_path):
print "changed"
print("changed")
value = os.path.basename(str_path).split('.')[0]
if '_R1' in value or '_R2':
value = value.split('_')[0]
......@@ -405,7 +405,7 @@ The Mme1 protocol generally assumes reads do NOT include the primer prefix, and
if dlg.ShowModal() == wx.ID_OK:
paths = dlg.GetPaths()
for path in paths:
print "analyzing dataset:",path
print("analyzing dataset:",path)
analyze_dataset(path)
dlg.Destroy()
self.update_dataset_list()
......@@ -452,7 +452,7 @@ The Mme1 protocol generally assumes reads do NOT include the primer prefix, and
#
def OnQuit(self, e):
print "Quitting TPP. Good bye."
print("Quitting TPP. Good bye.")
self.vars.action = "quit"
self.Close()
return 0
......
......@@ -266,7 +266,7 @@ def extract_staggered(infile,outfile,vars):
if vars.window_size!=-1: message("Looking for start of Tn prefix with P,Q = %d,%d (origin = %d, window size = %d)" % (P,Q,origin,vars.window_size)) # [RJ] Outputting P,Q values and origin/window size
else: message("Looking for start of Tn prefix within P,Q = [%d,%d]" % (P,Q))
tot = 0
#print infile
#print(infile)
if vars.barseq_catalog_out!=None:
barcodes_file = vars.base+".barseq" # I could define this in vars
catalog = open(barcodes_file,"w")
......@@ -274,7 +274,7 @@ def extract_staggered(infile,outfile,vars):
barseq2 = "CGTACGCTGCAGGTCGACGGCCGG"
barseq1len,barseq2len = len(barseq1),len(barseq2)
for line in open(infile):
#print line
#print(line)
line = line.rstrip()
if not line: continue
if line[0]=='>': header = line; continue
......@@ -313,7 +313,7 @@ def extract_staggered(infile,outfile,vars):
def message(s):
#print "[tn_preprocess]",s
#print("[tn_preprocess]",s)
#sys.stdout.flush()
sys.stderr.write("[tn_preprocess] "+s+"\n")
......@@ -338,7 +338,7 @@ def select_reads(goodreads,infile,outfile):
header = line
id = get_id(line)
else:
if hash.has_key(id):
if id in hash:
output.write(header)
output.write(line)
output.close()
......@@ -515,11 +515,11 @@ def template_counts(ref,sam,bcfile,vars):
else:
pos = i+1
h = hits[replicon_names[replicon_index]].get(pos,[])
f = filter(lambda x: x[0]=='F',h)
r = filter(lambda x: x[0]=='R',h)
f = list(filter(lambda x: x[0]=='F',h))
r = list(filter(lambda x: x[0]=='R',h))
u = list(set(h))
uf = filter(lambda x: x[0]=='F',u)
ur = filter(lambda x: x[0]=='R',u)
uf = list(filter(lambda x: x[0]=='F',u))
ur = list(filter(lambda x: x[0]=='R',u))
data = [pos,len(f),len(uf),len(r),len(ur),len(f)+len(r),len(uf)+len(ur)]
sites.append(data)
sites_list.append(sites)
......@@ -847,10 +847,10 @@ def bwa_subprocess(command, outfile):
#process.wait()
(pout,perr) = process.communicate()
#for line in iter(process.stderr.readline, ''):
for line in perr.split('\n'): # returned by communicate()
if "Permission denied" in line:
for line in perr.split(b'\n'): # returned by communicate()
if b"Permission denied" in line:
raise IOError("Error: BWA encountered a permissions error: \n\n%s" % line)
if "invalid option" in line:
if b"invalid option" in line:
raise ValueError("Error: Unrecognized flag for BWA: %s" % (line.split()[-1]))
sys.stderr.write("%s\n" % line.strip())
......@@ -935,7 +935,7 @@ def get_read_length(filename):
i = 0
for line in fil:
if i == 1:
#print "reads1 line: " + line
#print("reads1 line: " + line)
return len(line.strip())
i+=1
......@@ -1006,9 +1006,9 @@ def create_barseq_catalog(vars, replicon_index):
goodbc = {}
for bc,sites2 in mapsto.items():
pop = popularity(sites2) # make a table of locations at which the barcode appears
#print bc,pop
#print(bc,pop)
if len(pop)==1: goodbc[bc] = 1
#for x in sorted(sites.items()): print x[0],genome[x[0]-1:x[0]+1],popularity(x[1])
#for x in sorted(sites.items()): print(x[0],genome[x[0]-1:x[0]+1],popularity(x[1]))
file = open(vars.barseq_catalog_out[replicon_index],"w")
file.write("# Barseq (stats are at the bottom): reads = %s, ref = %s\n" % (vars.fq1,vars.ref))
......@@ -1070,7 +1070,7 @@ def generate_output(vars):
cur_tc = sum(cur_tcounts)
cur_ratio = cur_rc/float(cur_tc) if (cur_rc != 0 and cur_tc !=0) else 0
cur_ta_sites = len(cur_rcounts)
cur_tas_hit = len(filter(lambda x: x>0,cur_rcounts))
cur_tas_hit = len(list(filter(lambda x: x>0,cur_rcounts)))
cur_density = cur_tas_hit/float(cur_ta_sites) if cur_tas_hit != 0 else 0
counts[replicon_index].sort(key=lambda x: x[-1])
cur_max_tc = counts[replicon_index][-1][6]
......@@ -1202,17 +1202,17 @@ def generate_output(vars):
infile = open(vars.stats)
for line in infile:
if '#' in line:
print line.rstrip()
print(line.rstrip())
infile.close()
#############################################################################
def error(s):
print "error:",s
print("error:",s)
sys.exit(0)
def warning(s):
print "warning:",s
print("warning:",s)
......@@ -1308,7 +1308,7 @@ def verify_inputs(vars):
error('cannot find BWA executable. Please include the full executable name as well as its directory.')
def initialize_globals(vars, args=[], kwargs={}):
vars.fq1,vars.fq2,vars.ref,vars.bwa,vars.bwa_alg,vars.replicon_ids,vars.base,vars.maxreads = "","","","","","","",""
vars.fq1,vars.fq2,vars.ref,vars.bwa,vars.bwa_alg,vars.replicon_ids,vars.base,vars.maxreads = "","","","","","","",-1
vars.mm1 = 1 # mismatches allowed in Tn prefix AND adapter prefix on read2
vars.transposon = 'Himar1'
vars.protocol = "Sassetti"
......@@ -1433,20 +1433,20 @@ def save_config(vars):
f.close()
def show_help():
#print 'usage: python PATH/src/tpp.py -bwa <EXECUTABLE_WITH_PATH> -ref <fasta-file|comma_separated_list> -reads1 <FASTQ_OR_FASTA_FILE> [-reads2 <FASTQ_OR_FASTA_FILE>] -output <BASE_FILENAME> [-maxreads <N>] [-mismatches <N>] [-flags "<STRING>"] [-tn5|-himar1] [-primer <seq>] [-primer-start-window INT,INT] [-window-size INT] [-barseq_catalog_in|_out <file>] [-replicon-ids <comma_separated_list_of_names>]'
print 'usage: python PATH/src/tpp.py -bwa <EXECUTABLE_WITH_PATH> -ref <fasta-file|comma_separated_list> -reads1 <FASTQ_OR_FASTA_FILE> [-reads2 <FASTQ_OR_FASTA_FILE>] -output <BASE_FILENAME> [OPTIONAL ARGS]'
print ' OPTIONAL ARGS:'
print ' -protocol [Sassetti|Tn5|Mme1] # which sample prep protocol was used?; sassetti protocol is the default; this sets the default transposon and primer sequence'
print ' -primer <seq> # prefix of reads corresponding to end of transposon at junction with genomic sequence; can override default seq'
print ' -maxreads <INT>'
print ' -mismatches <INT> # when searching for constant regions in reads 1 and 2; default is 1'
print ' -flags "<STRING>" # args to pass to BWA'
print ' -primer-start-window INT,INT # position in read to search for start of primer; default is [0,20]'
print ' -window-size INT # automatic method to set window'
print ' -barseq_catalog_in|-barseq_catalog_out <file>'
print ' -replicon-ids <comma_separated_list_of_names> # if multiple replicons/genomes/contigs/sequences were provided in -ref, give them names.'
print ' # Enter \'auto\' for autogenerated ids.'
#print('usage: python PATH/src/tpp.py -bwa <EXECUTABLE_WITH_PATH> -ref <fasta-file|comma_separated_list> -reads1 <FASTQ_OR_FASTA_FILE> [-reads2 <FASTQ_OR_FASTA_FILE>] -output <BASE_FILENAME> [-maxreads <N>] [-mismatches <N>] [-flags "<STRING>"] [-tn5|-himar1] [-primer <seq>] [-primer-start-window INT,INT] [-window-size INT] [-barseq_catalog_in|_out <file>] [-replicon-ids <comma_separated_list_of_names>]')
print('usage: python PATH/src/tpp.py -bwa <EXECUTABLE_WITH_PATH> -ref <fasta-file|comma_separated_list> -reads1 <FASTQ_OR_FASTA_FILE> [-reads2 <FASTQ_OR_FASTA_FILE>] -output <BASE_FILENAME> [OPTIONAL ARGS]')
print(' OPTIONAL ARGS:')
print(' -protocol [Sassetti|Tn5|Mme1] # which sample prep protocol was used?; sassetti protocol is the default; this sets the default transposon and primer sequence')
print(' -primer <seq> # prefix of reads corresponding to end of transposon at junction with genomic sequence; can override default seq' )
print(' -maxreads <INT>')
print(' -mismatches <INT> # when searching for constant regions in reads 1 and 2; default is 1')
print(' -flags "<STRING>" # args to pass to BWA')
print(' -primer-start-window INT,INT # position in read to search for start of primer; default is [0,20]')
print(' -window-size INT # automatic method to set window')
print(' -barseq_catalog_in|-barseq_catalog_out <file>')
print(' -replicon-ids <comma_separated_list_of_names> # if multiple replicons/genomes/contigs/sequences were provided in -ref, give them names.')
print(' # Enter \'auto\' for autogenerated ids.')
class Globals:
pass
......@@ -2,6 +2,6 @@
__all__ = ["transit_tools", "tnseq_tools", "norm_tools", "stat_tools"]
__version__ = "v2.5.2"
__version__ = "v3.0.0"
prefix = "[TRANSIT]"
......@@ -18,7 +18,7 @@ if hasWx:
import pytransit
import pytransit.transit_tools as transit_tools
from pytransit import transit_tools
import pytransit.analysis
import pytransit.export
import pytransit.convert
......@@ -50,20 +50,20 @@ def main(*args, **kwargs):
kwargs.pop("-debug")
if (not args and ('v' in kwargs or '-version' in kwargs)):
print "Version: {0}".format(pytransit.__version__)
print("Version: {0}".format(pytransit.__version__))
sys.exit(0)
if (not args and ('h' in kwargs or '-help' in kwargs)):
print "For commandline mode, please use one of the known methods (or see documentation to add a new one):"
print("For commandline mode, please use one of the known methods (or see documentation to add a new one):")
print("Analysis methods: ")
for m in all_methods:
## TODO :: Move normalize to separate subcommand?
if (m == "normalize"): continue
print "\t - %s" % m
print("\t - %s" % m)
print("Other functions: ")
print("\t - normalize")
print("\t - convert")
print("\t - export")
print "Usage: python %s <method>" % sys.argv[0]
print("Usage: python %s <method>" % sys.argv[0])
sys.exit(0)
# Check if running in GUI Mode
......@@ -87,13 +87,13 @@ def main(*args, **kwargs):
# Tried GUI mode but has no wxPython
elif not (args or kwargs) and not hasWx:
print "Please install wxPython to run in GUI Mode."
print "To run in Console Mode please follow these instructions:"
print ""
print "Usage: python %s <method>" % sys.argv[0]
print "List of known methods:"
print("Please install wxPython to run in GUI Mode.")
print("To run in Console Mode please follow these instructions:")
print("")
print("Usage: python %s <method>" % sys.argv[0])
print("List of known methods:")
for m in methods:
print "\t - %s" % m
print("\t - %s" % m)
# Running in Console mode
else:
import matplotlib
......@@ -106,11 +106,11 @@ def main(*args, **kwargs):
export_method_name = args[1]
if export_method_name not in export_methods:
print "Error: Need to specify the export method."
print "Please use one of the known methods (or see documentation to add a new one):"
print("Error: Need to specify the export method.")
print("Please use one of the known methods (or see documentation to add a new one):")
for m in export_methods:
print "\t - %s" % m
print "Usage: python %s export <method>" % sys.argv[0]
print("\t - %s" % m)
print("Usage: python %s export <method>" % sys.argv[0])
else:
methodobj = export_methods[export_method_name].method.fromconsole()
methodobj.Run()
......@@ -120,20 +120,20 @@ def main(*args, **kwargs):
convert_method_name = args[1]
if convert_method_name not in convert_methods:
print "Error: Need to specify the convert method."
print "Please use one of the known methods (or see documentation to add a new one):"
print("Error: Need to specify the convert method.")
print("Please use one of the known methods (or see documentation to add a new one):")
for m in convert_methods:
print "\t - %s" % m
print "Usage: python %s convert <method>" % sys.argv[0]
print("\t - %s" % m)
print("Usage: python %s convert <method>" % sys.argv[0])
else:
methodobj = convert_methods[convert_method_name].method.fromconsole()
methodobj.Run()
else:
print "Error: The '%s' method is unknown." % method_name
print "Please use one of the known methods (or see documentation to add a new one):"
print("Error: The '%s' method is unknown." % method_name)
print("Please use one of the known methods (or see documentation to add a new one):")
for m in all_methods:
print "\t - %s" % m
print "Usage: python %s <method>" % sys.argv[0]
print("\t - %s" % m)
print("Usage: python %s <method>" % sys.argv[0])
else:
methodobj = all_methods[method_name].method.fromconsole()
......
......@@ -5,24 +5,23 @@ import glob
modules = glob.glob(dirname(__file__)+"/*.py")
__all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
import base
from pytransit.analysis import base
import gumbel
import example
import tn5gaps
import binomial
import griffin
import resampling
import hmm
import rankproduct
import gi
import utest
import normalize
import pathway_enrichment #08/22/2018 by Ivan
import anova
import zinb
import tnseq_stats
import winsorize
from pytransit.analysis import gumbel
from pytransit.analysis import example
from pytransit.analysis import tn5gaps
from pytransit.analysis import binomial
from pytransit.analysis import griffin
from pytransit.analysis import resampling
from pytransit.analysis import hmm
from pytransit.analysis import rankproduct
from pytransit.analysis import gi
from pytransit.analysis import utest
from pytransit.analysis import normalize
from pytransit.analysis import pathway_enrichment
from pytransit.analysis import anova
from pytransit.analysis import zinb
from pytransit.analysis import tnseq_stats
methods = {}
methods["example"] = example.ExampleAnalysis()
......@@ -43,10 +42,10 @@ methods["zinb"] = zinb.ZinbAnalysis()
methods["normalize"] = normalize.Normalize()
methods["pathway_enrichment"]=pathway_enrichment.GSEAAnalysis()
methods["tnseq_stats"]=tnseq_stats.TnseqStats()
methods["winsorize"] = winsorize.Winsorize()
# EXPORT METHODS
import norm
from pytransit.analysis import norm
export_methods = {}
export_methods["norm"] = norm.NormAnalysis()
......@@ -6,7 +6,7 @@ import time
import sys
import collections
import base
from pytransit.analysis import base
import pytransit
import pytransit.transit_tools as transit_tools
import pytransit.tnseq_tools as tnseq_tools
......@@ -52,8 +52,8 @@ class AnovaMethod(base.MultiConditionMethod):
normalization = kwargs.get("n", "TTR")
NTerminus = float(kwargs.get("iN", 0.0))
CTerminus = float(kwargs.get("iC", 0.0))
ignored_conditions = filter(None, kwargs.get("-ignore-conditions", "").split(","))
included_conditions = filter(None, kwargs.get("-include-conditions", "").split(","))
ignored_conditions = list(filter(None, kwargs.get("-ignore-conditions", "").split(",")))
included_conditions = list(filter(None, kwargs.get("-include-conditions", "").split(",")))
if len(included_conditions) > 0 and len(ignored_conditions) > 0:
print(self.transit_error("Cannot use both include-conditions and ignore-conditions flags"))
......@@ -136,7 +136,7 @@ class AnovaMethod(base.MultiConditionMethod):
status.append("TA sites <= 1")
pvals.append(1)
else:
countSum, countsVec = self.group_by_condition(map(lambda wigData: wigData[RvSiteindexesMap[Rv]], data), conditions)
countSum, countsVec = self.group_by_condition(list(map(lambda wigData: wigData[RvSiteindexesMap[Rv]], data)), conditions)
if (countSum == 0):
pval = 1
......
......@@ -124,8 +124,8 @@ class TransitFile (TransitGUIBase):
if line.startswith("#"): continue
tmp = line.split("\t")
tmp[-1] = tmp[-1].strip()
#print colnames
#print len(colnames), len(tmp)
#print(colnames)
#print( len(colnames), len(tmp))
try:
rowdict = dict([(colnames[i], tmp[i]) for i in range(len(colnames))])
except Exception as e:
......@@ -153,15 +153,15 @@ class TransitFile (TransitGUIBase):
def displayInTrackView(self, displayFrame, event):
#print "Self:", self
#print "Frame:", displayFrame
#print "Event:", event
#print "Frame parent:", displayFrame.parent
#print("Self:", self)
#print("Frame:", displayFrame)
#print("Event:", event)
#print("Frame parent:", displayFrame.parent)
try:
gene = displayFrame.grid.GetCellValue(displayFrame.row, 0)
displayFrame.parent.allViewFunc(displayFrame, gene)
except Exception as e:
print file_prefix, "Error occurred: %s" % e
print(file_prefix, "Error occurred: %s" % e)
#
......@@ -318,23 +318,23 @@ class AnalysisMethod:
try:
return self.fromargs(sys.argv[2:])
except InvalidArgumentException as e:
print "Error: %s" % str(e)
print self.usage_string()
print("Error: %s" % str(e))
print(self.usage_string())
except IndexError as e:
print "Error: %s" % str(e)
print self.usage_string()
print("Error: %s" % str(e))
print(self.usage_string())
except TypeError as e:
print "Error: %s" % str(e)
print("Error: %s" % str(e))
traceback.print_exc()
print self.usage_string()
print(self.usage_string())
except ValueError as e:
print "Error: %s" % str(e)
print("Error: %s" % str(e))
traceback.print_exc()
print self.usage_string()
print(self.usage_string())
except Exception as e:
print "Error: %s" % str(e)
print("Error: %s" % str(e))
traceback.print_exc()
print self.usage_string()
print(self.usage_string())
sys.exit()
#
......@@ -356,7 +356,7 @@ class AnalysisMethod:
#TODO: write docstring
members = sorted([attr for attr in dir(self) if not callable(getattr(self,attr)) and not attr.startswith("__")])
for m in members:
print "%s = %s" % (m, getattr(self, m))
print("%s = %s" % (m, getattr(self, m)))
#
......
......@@ -22,7 +22,7 @@ import numpy
import scipy.stats
import datetime
import base
from pytransit.analysis import base
import pytransit.transit_tools as transit_tools
import pytransit.tnseq_tools as tnseq_tools
import pytransit.norm_tools as norm_tools
......@@ -346,7 +346,7 @@ class BinomialMethod(base.SingleConditionMethod):
elif K[g]/float(N[g]) == 1: theta[g][0] = 0.001
else: theta[g][0] = K[g]/float(N[g])
#print g, ORF[g], K[g], N[g], theta[g][0]
#print(g, ORF[g], K[g], N[g], theta[g][0])
Z[g][0] = scipy.stats.bernoulli.rvs(1-theta[g][0])
......@@ -439,9 +439,9 @@ class BinomialMethod(base.SingleConditionMethod):
Z[:,i] = scipy.stats.bernoulli.rvs(p1)
except:
inan = numpy.isnan(p1)
print >> sys.stderr, "K=\t", K[inan]
print >> sys.stderr, "N=\t", N[inan]
print >> sys.stderr, "theta=", theta[inan,i]
sys.stderr.write("K=\t", K[inan],"\n")
sys.stderr.write("N=\t", N[inan],"\n")
sys.stderr.write("theta=", theta[inan,i],'\n')
sys.exit()
pz1[i] = p1[0]
......@@ -546,8 +546,8 @@ if __name__ == "__main__":
G.console_message("Printing the member variables:")
G.print_members()
print ""
print "Running:"
print("")
print("Running:")
G.Run()
......
......@@ -23,7 +23,7 @@ import numpy
import scipy.stats
import datetime
import base
from pytransit.analysis import base
import pytransit.transit_tools as transit_tools
import pytransit.tnseq_tools as tnseq_tools
import pytransit.norm_tools as norm_tools
......@@ -236,17 +236,17 @@ if __name__ == "__main__":
(args, kwargs) = transit_tools.cleanargs(sys.argv[1:])
print "ARGS:", args
print "KWARGS:", kwargs
print("ARGS:", args)
print("KWARGS:", kwargs)
G = Example.fromargs(sys.argv[1:])
print G
print(G)
G.console_message("Printing the member variables:")
G.print_members()
print ""
print "Running:"
print("")
print("Running:")
G.Run()
......