Skip to content
Commits on Source (8)
# Change log
All notable changes to this project will be documented in this file.
## Version 2.3.3 2018-12-06
- TRANSIT:
- Minor bug fixes related to flags in HMM
## Version 2.3.2 2018-11-09
- TRANSIT:
- Minor bug fixes related to changing parameters in TPP GUI
......
# TRANSIT 2.3.2
# TRANSIT 2.3.3
[![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)
Welcome! This is the distribution for the TRANSIT and TPP tools developed by the Ioerger Lab.
Welcome! This is the distribution for the TRANSIT and TPP tools developed by the Ioerger Lab at Texas A&M University.
TRANSIT is a tool for the analysis of Tn-Seq data. It provides an easy to use graphical interface and access to three different analysis methods that allow the user to determine essentiality in a single condition as well as between conditions.
TRANSIT is a tool for processing and statistical analysis of Tn-Seq data.
It provides an easy to use graphical interface and access to three different analysis methods that allow the user to determine essentiality in a single condition as well as between conditions.
TRANSIT Home page: http://saclab.tamu.edu/essentiality/transit/index.html
TRANSIT Documentation: https://transit.readthedocs.io/en/latest/transit_overview.html
[Changelog](https://github.com/mad-lab/transit/blob/master/CHANGELOG.md)
......@@ -42,7 +47,7 @@ For any questions or comments, please contact Dr. Thomas Ioerger, ioerger@cs.tam
For full instructions on how to install and run TRANSIT (and the optional pre-processor, TPP), please see the documentation included in this distribution ("src/pytransit/doc" folder) or visit the following web page:
http://saclab.tamu.edu/essentiality/transit/transit.html
https://transit.readthedocs.io/en/latest/
## Datasets
......
tnseq-transit (2.3.3-1) unstable; urgency=medium
* New upstream version
* buildsystem=pybuild
* More complete Build-Depends
* Exclude tests that need local data file
* Work around a dangling symlink to local data file
-- Andreas Tille <tille@debian.org> Tue, 18 Dec 2018 17:48:11 +0100
tnseq-transit (2.3.2-1) unstable; urgency=medium
* Team upload.
......
......@@ -5,8 +5,14 @@ Section: science
Priority: optional
Build-Depends: debhelper (>= 11~),
dh-python,
python-all-dev,
python-setuptools
python-dev,
python-setuptools,
python-numpy,
python-scipy,
python-pil,
python-matplotlib,
python-statsmodels,
bwa
Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/med-team/tnseq-transit
Vcs-Git: https://salsa.debian.org/med-team/tnseq-transit.git
......@@ -18,9 +24,10 @@ Depends: ${python:Depends},
${misc:Depends},
python-numpy,
python-scipy,
python-pillow,
python-pil,
python-matplotlib,
python-wxgtk3.0
python-wxgtk3.0,
bwa
Breaks: transit
Provides: transit
Replaces: transit
......
skip_test_requiring_non_existing_input_data.patch
Description: Exclude tests that need local data file
Author: Andreas Tille <tille@debian.org>
Last-Update: Tue, 18 Dec 2018 16:56:48 +0100
--- a/tests/test_tpp.py
+++ b/tests/test_tpp.py
@@ -34,7 +34,7 @@ def get_stats(path):
class TestTPP(TransitTestCase):
- @unittest.skipUnless(os.path.exists("/usr/bin/bwa"), "requires BWA")
+ @unittest.skipUnless(os.path.exists("../misc/test"), "requires local data file")
def test_tpp_noflag_primer(self):
arguments = ["-bwa", "/usr/bin/bwa", "-ref", "H37Rv.fna", "-reads1", "test.fastq", "-output",
@@ -44,7 +44,7 @@ class TestTPP(TransitTestCase):
self.assertTrue(NOFLAG_PRIMER == stats)
- @unittest.skipUnless(os.path.exists("/usr/bin/bwa"), "requires BWA")
+ @unittest.skipUnless(os.path.exists("../misc/test"), "requires local data file")
def test_tpp_flag_primer(self):
arguments = ["-bwa", "/usr/bin/bwa", "-ref", "H37Rv.fna", "-reads1", "test.fastq", "-output",
@@ -55,7 +55,7 @@ class TestTPP(TransitTestCase):
@unittest.expectedFailure
- @unittest.skipUnless(os.path.exists("/usr/bin/bwa"), "requires BWA")
+ @unittest.skipUnless(os.path.exists("../misc/test"), "requires local data file")
def test_tpp_noflag_noprimer(self):
with self.assertRaises(SystemExit):
@@ -67,7 +67,7 @@ class TestTPP(TransitTestCase):
@unittest.expectedFailure
- @unittest.skipUnless(os.path.exists("/usr/bin/bwa"), "requires BWA")
+ @unittest.skipUnless(os.path.exists("../misc/test"), "requires local data file")
def test_tpp_flag_noprimer(self):
with self.assertRaises(SystemExit):
......@@ -6,8 +6,21 @@ export LC_ALL=C.UTF-8
include /usr/share/dpkg/default.mk
%:
dh $@ --with python2
dh $@ --with python2 --buildsystem=pybuild
override_dh_install:
dh_install
mv debian/$(DEB_SOURCE)/usr/bin/tpp debian/$(DEB_SOURCE)/usr/bin/transit-tpp
# Upstream tarball contains a dangling symlink to local data file - hack around this
override_dh_auto_configure:
mkdir -p tests_invalid_data
mv tests/H37Rv.fna tests_invalid_data
dh_auto_configure
override_dh_auto_clean:
if [ -e tests_invalid_data/H37Rv.fna ] ; then \
mv tests_invalid_data/H37Rv.fna tests ; \
rmdir tests_invalid_data ; \
fi
dh_auto_clean
......@@ -6,10 +6,13 @@ https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from setuptools import setup, find_packages, Command
# To use a consistent encoding
from codecs import open
from os import path
from shutil import rmtree
import os
here = path.abspath(path.dirname(__file__))
......@@ -22,7 +25,68 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f:
import sys
sys.path.insert(1, "src/")
import pytransit
version = pytransit.__version__[1:] #"2.0.3"
version = pytransit.__version__[1:]
class UploadCommand(Command):
"""Support setup.py upload."""
description = 'Build and publish the package.'
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def yes_or_no(self, question):
while True:
reply = str(raw_input(question +' (y/n): ')).lower().strip()
if reply == 'y':
return True
return False
def run(self):
try:
self.status('Removing previous builds...')
rmtree(os.path.join(here, 'dist'))
except OSError:
pass
if not self.yes_or_no("Have you done the following? \n" +
"- Updated README/Documentation?\n"
"- Have you updated CHANGELOG?\n"
"- Have you updated Transit Essentiality page?\n"
"- Is version v{0} correct".format(version)):
self.status("Exiting...")
sys.exit()
self.status('Building Source and Wheel (universal) distribution...')
os.system('{0} setup.py sdist bdist_wheel'.format(sys.executable))
if self.yes_or_no("Add tag and push to public github? tag:v{0}".format(version)):
self.status('Adding and pushing git tags to origin and public...')
os.system('git tag v{0}'.format(version))
os.system('git push origin --tags')
os.system('git push https://github.com/mad-lab/transit')
os.system('git push https://github.com/mad-lab/transit --tags')
else:
self.status("Exiting...")
sys.exit()
if self.yes_or_no("Proceed with publish to PyPI? version: v{0}, tag:v{0}".format(version)):
self.status('Uploading the package to PyPI via Twine...')
os.system('twine upload dist/*')
else:
self.status("Exiting...")
sys.exit()
sys.exit()
setup(
name='tnseq-transit',
......@@ -117,5 +181,8 @@ setup(
'tpp=pytpp.__main__:run_main',
],
},
cmdclass={
'upload': UploadCommand,
},
)
......@@ -2,6 +2,6 @@
__all__ = ["transit_tools", "tnseq_tools", "norm_tools", "stat_tools"]
__version__ = "v2.3.2"
__version__ = "v2.3.3"
prefix = "[TRANSIT]"
......@@ -257,7 +257,7 @@ class HMMMethod(base.SingleConditionMethod):
output_file = open(outpath, "w")
replicates = kwargs.get("r", "Mean")
normalization = kwargs.get("r", "TTR")
normalization = kwargs.get("n", "TTR")
LOESS = kwargs.get("l", False)
ignoreCodon = True
NTerminus = float(kwargs.get("iN", 0.0))
......@@ -430,6 +430,7 @@ class HMMMethod(base.SingleConditionMethod):
Optional Arguments:
-r <string> := How to handle replicates. Sum, Mean. Default: -r Mean
-n <string> := Normalization method. Default: -n TTR
-l := Perform LOESS Correction; Helps remove possible genomic position bias. Default: Off.
-iN <float> := Ignore TAs occuring at given fraction of the N terminus. Default: -iN 0.0
-iC <float> := Ignore TAs occuring at given fraction of the C terminus. Default: -iC 0.0
......
......@@ -101,6 +101,7 @@ class NormalizeMethod(base.SingleConditionMethod):
self.infile = args[0] # only 1 input wig file
self.outfile = args[1] # if no arg give, could print to screen
self.normalization = kwargs.get("n", "TTR") # check if it is a legal method name
self.combined_wig = kwargs.get("c",False)
return self(self.infile,self.outfile,self.normalization)
......@@ -117,12 +118,17 @@ class NormalizeMethod(base.SingleConditionMethod):
for line in open(infile):
if line.startswith("variableStep"): line2 = line.rstrip(); break
(data, sites) = tnseq_tools.get_data(self.ctrldata)
if self.combined_wig==True: (sites,data,files) = tnseq_tools.read_combined_wig(self.ctrldata[0])
else: (data, sites) = tnseq_tools.get_data(self.ctrldata)
(data,factors) = norm_tools.normalize_data(data,self.normalization)
print "writing",outputPath
file = open(outputPath,"w")
file.write("# %s normalization of %s\n" % (self.normalization,infile))
if self.combined_wig==True:
for f in files: file.write("#File: %s\n" % f)
for i in range(len(sites)): file.write('\t'.join([str(sites[i])]+["%0.1f" % x for x in list(data[...,i])])+"\n")
else:
file.write(line2+"\n")
for j in range(len(sites)):
file.write("%s %s\n" % (sites[j],int(data[0,j])))
......@@ -134,9 +140,10 @@ class NormalizeMethod(base.SingleConditionMethod):
@classmethod
def usage_string(self):
return """
python %s normalize <input.wig> <output.wig> [-n TTR|betageom]
python %s normalize <input.wig> <output.wig> [-c] [-n TTR|betageom]
Optional Arguments:
-c := the input file is a combined_wig file
-n <string> := Normalization method. Default: -n TTR
""" % (sys.argv[0])
......
......@@ -122,7 +122,7 @@ class TnseqStatsMethod(base.SingleConditionMethod):
for i in range(data.shape[0]):
density, meanrd, nzmeanrd, nzmedianrd, maxrd, totalrd, skew, kurtosis = tnseq_tools.get_data_stats(data[i,:])
nzmedianrd = int(nzmedianrd) if numpy.isnan(nzmedianrd)==False else 0
vals = [datasets[i], "%0.2f" % density, "%0.1f" % meanrd, "%0.1f" % nzmeanrd, "%d" % nzmedianrd, maxrd, totalrd, "%0.1f" % skew, "%0.1f" % kurtosis]
vals = [datasets[i], "%0.2f" % density, "%0.1f" % meanrd, "%0.1f" % nzmeanrd, "%d" % nzmedianrd, maxrd, int(totalrd), "%0.1f" % skew, "%0.1f" % kurtosis]
file.write('\t'.join([str(x) for x in vals])+'\n')
if self.outfile!=None: file.close()
......
Overview
========
TPP Overview
============
TPP is a software tool for processing raw reads (e.g. .fastq files,
*untrimmed*) from an Tn-Seq experiment, extracting counts of transposon
......
......@@ -868,12 +868,15 @@ Example
> python src/transit.py normalize --help
usage: python src/transit.py normalize <input.wig> <output.wig> [-n TTR|betageom]
usage: python src/transit.py normalize <input.wig> <output.wig> [-c] [-n TTR|betageom]
> python src/transit.py normalize Rv_1_H37RvRef.wig Rv_1_H37RvRef_TTR.wig -n TTR
> python src/transit.py normalize Rv_1_H37RvRef.wig Rv_1_H37RvRef_BG.wig -n betageom
The normalize command now also works on combined_wig files too.
If the input file is a combined_wig file, add the '-c' flag at the end.
.. _combined_wig:
Combined wig files
......
......@@ -2,8 +2,8 @@
Overview
========
TRANSIT Overview
================
+ This is a software that can be used to analyze Tn-Seq datasets. It includes various statistical calculations of essentiality of genes or genomic regions (including conditional essentiality between 2 conditions). These methods were developed and tested as a collaboration between the Sassetti lab (UMass) and the Ioerger lab (Texas A&M) [DeJesus2015TRANSIT]_.
......@@ -108,14 +108,15 @@ own primer sequences, if they use a different sample prep protocol.
Developers
----------
================== ============ ==============================================================================
======================= ============ ==============================================================================
Name Time Active Contact Information
================== ============ ==============================================================================
Michael A. DeJesus 2015-Present `http://mad-lab.org <http://mad-lab.org>`_
======================= ============ ==============================================================================
Thomas R. Ioerger 2015-Present `http://faculty.cs.tamu.edu/ioerger/ <http://faculty.cs.tamu.edu/ioerger/>`_
Michael A. DeJesus 2015-2018 `http://mad-lab.org <http://mad-lab.org>`_
Chaitra Ambadipudi 2015
Eric Nelson 2016
================== ============ ==============================================================================
Siddharth Subramaniyam 2018
======================= ============ ==============================================================================
......
......@@ -195,7 +195,7 @@ class CombinedWigMethod(base.SingleConditionMethod):
@classmethod
def usage_string(self):
return """python %s export combined_wig <comma-separated .wig files> <annotation .prot_table> <output file>""" % (sys.argv[0])
return """python %s export combined_wig <comma-separated .wig files> <annotation .prot_table> <output file> [-n normalization_method]\ndefault normalization_method=TTR""" % (sys.argv[0])
if __name__ == "__main__":
......
......@@ -28,12 +28,18 @@ def rv_siteindexes_map(genes, TASiteindexMap):
RvSiteindexesMap[gene["rv"]] = siteindexes
return RvSiteindexesMap
# format:
# header lines (prefixed by '#'), followed by lines with counts
# counts lines contain the following columns: TA coord, counts, other info like gene/annotation
# for each column of counts, there must be a header line prefixed by "#File: " and then an id or filename
def read_combined_wig(fname):
"""
Read the combined wig-file generated by Transit
:: Filename -> Tuple([Site], [[WigData]])
Site :: [Integer]
:: Filename -> Tuple([Site], [WigData], [Filename])
Site :: Integer
WigData :: [Integer]
Filename :: String
"""
sites,countsByWig,files = [],[],[]
with open(fname) as f:
......@@ -44,7 +50,8 @@ def read_combined_wig(fname):
countsByWig = [[] for _ in files]
for line in lines:
if line[0]=='#': continue
cols = line.split("\t")[0:-1]
cols = line.split("\t")[0:1+len(files)]
cols = cols[:1+len(files)] # additional columns at end could contain gene info
# Read in position as int, and readcounts as float
cols = map(lambda (i, v): int(v) if i == 0 else float(v), enumerate(cols))
position, wigCounts = cols[0], cols[1:]
......