[med-svn] [Git][med-team/tnseq-transit][upstream] New upstream version 2.3.3

Andreas Tille gitlab at salsa.debian.org
Tue Dec 18 16:53:32 GMT 2018


Andreas Tille pushed to branch upstream at Debian Med / tnseq-transit


Commits:
2707cb28 by Andreas Tille at 2018-12-18T15:54:26Z
New upstream version 2.3.3
- - - - -


12 changed files:

- CHANGELOG.md
- README.md
- setup.py
- src/pytransit/__init__.py
- src/pytransit/analysis/hmm.py
- src/pytransit/analysis/normalize.py
- src/pytransit/analysis/tnseq_stats.py
- src/pytransit/doc/source/tpp.rst
- src/pytransit/doc/source/transit_methods.rst
- src/pytransit/doc/source/transit_overview.rst
- src/pytransit/export/combined_wig.py
- src/pytransit/tnseq_tools.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,6 +1,10 @@
 # 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


=====================================
README.md
=====================================
@@ -1,12 +1,17 @@
-# 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 at 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


=====================================
setup.py
=====================================
@@ -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,
+    },
 )
 


=====================================
src/pytransit/__init__.py
=====================================
@@ -2,6 +2,6 @@
 __all__ = ["transit_tools", "tnseq_tools", "norm_tools", "stat_tools"]
 
 
-__version__ = "v2.3.2"
+__version__ = "v2.3.3"
 prefix = "[TRANSIT]"
 


=====================================
src/pytransit/analysis/hmm.py
=====================================
@@ -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


=====================================
src/pytransit/analysis/normalize.py
=====================================
@@ -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,15 +118,20 @@ 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))
-        file.write(line2+"\n")
-        for j in range(len(sites)):
-          file.write("%s %s\n" % (sites[j],int(data[0,j])))
+        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])))
         file.close()
 
         self.finish()
@@ -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])
 


=====================================
src/pytransit/analysis/tnseq_stats.py
=====================================
@@ -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()
 


=====================================
src/pytransit/doc/source/tpp.rst
=====================================
@@ -1,7 +1,7 @@
 
 
-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


=====================================
src/pytransit/doc/source/transit_methods.rst
=====================================
@@ -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


=====================================
src/pytransit/doc/source/transit_overview.rst
=====================================
@@ -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/>`_
-Chaitra Ambadipudi  2015
-Eric Nelson         2016
-==================  ============  ==============================================================================
+=======================  ============  ==============================================================================
+ Name                    Time Active          Contact Information
+=======================  ============  ==============================================================================
+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
+=======================  ============  ==============================================================================
 
 
 


=====================================
src/pytransit/export/combined_wig.py
=====================================
@@ -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__":


=====================================
src/pytransit/tnseq_tools.py
=====================================
@@ -28,23 +28,30 @@ 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:
         lines = f.readlines()
         for line in lines:
-            if line.startswith("#File:"):
+            if line.startswith("#File: "):
                 files.append(line.split()[1])
     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:]



View it on GitLab: https://salsa.debian.org/med-team/tnseq-transit/commit/2707cb289c1324ea6c6786942cce9079927fbcb5

-- 
View it on GitLab: https://salsa.debian.org/med-team/tnseq-transit/commit/2707cb289c1324ea6c6786942cce9079927fbcb5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20181218/5153b0e2/attachment-0001.html>


More information about the debian-med-commit mailing list