From 23f08cbb6e90bbaa5520b732dcabaef4194602fd Mon Sep 17 00:00:00 2001 From: msbentsen Date: Thu, 21 Mar 2019 17:17:01 +0100 Subject: [PATCH] 3.0.2: Fixed improper sorting of output bed/txt --- setup.py | 13 +++++++++++++ uropa/__init__.py | 1 + uropa/uropa.py | 5 +++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2dc9383..82acbae 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,18 @@ +import os +import re from setuptools import setup +#Path of setup file to establish version +setupdir = os.path.abspath(os.path.dirname(__file__)) + +def find_version(init_file): + version_file = open(init_file).read() + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) + if version_match: + return version_match.group(1) + else: + raise RuntimeError("Unable to find version string.") + def readme(): with open('README.md', encoding='utf-8') as f: return f.read() diff --git a/uropa/__init__.py b/uropa/__init__.py index e69de29..e72968d 100644 --- a/uropa/__init__.py +++ b/uropa/__init__.py @@ -0,0 +1 @@ +__version__ = "3.0.2" diff --git a/uropa/uropa.py b/uropa/uropa.py index 05abcab..8c33e90 100644 --- a/uropa/uropa.py +++ b/uropa/uropa.py @@ -27,6 +27,7 @@ #Import internal functions from uropa.utils import * from uropa.annotation import * +from uropa import __version__ as VERSION def restricted_float(f, f_min, f_max): f = float(f) @@ -80,7 +81,7 @@ def main(): #additional.add_argument("--add-comments",help="add comment lines to output files", action="store_true") additional.add_argument("-l","--log", help="Log file name for messages and warnings (default: log is written to stdout)", action="store", metavar="uropa.log") additional.add_argument("-d","--debug",help="Print verbose messages (for debugging)", action="store_true") - additional.add_argument("-v","--version",help="Prints the version and exits", action="version",version="%(prog)s 3.0.1") + additional.add_argument("-v","--version", help="Prints the version and exits", action="version", version="%(prog)s " + VERSION) args = parser.parse_args() #Write help if no input was given @@ -410,7 +411,7 @@ def main(): #Sort on peak_ids all_hits["original_order"] = [internal_peak_ids.index(peak_id) for peak_id in all_hits["internal_peak_id"]] #map position - all_hits.sort_values(by=["original_order", "feat_start", "feat_end"]) + all_hits.sort_values(by=["original_order", "feat_start"], inplace=True) #All hits logger.debug("Writing _allhits.txt")