Skip to content

Commit 9e0d768

Browse files
committed
convert to python pkg
1 parent b31aac9 commit 9e0d768

20 files changed

+132
-1
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include hamstr1s *
File renamed without changes.

hamstr1s/__init__.py

Whitespace-only changes.
155 Bytes
Binary file not shown.
1.74 KB
Binary file not shown.
File renamed without changes.

bin/addTaxonHamstr.py renamed to hamstr1s/addTaxonHamstr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def main():
144144
index = index + 1
145145
id = str(id) + '_' + str(index)
146146
tmpDict[id] = 1
147-
id = re.sub('\|', '_', seq)
147+
id = re.sub('\|', '_', id)
148148
seq = str(inSeq[id].seq)
149149
specialChr = 'no'
150150
if any(c for c in seq if not c.isalpha()):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

hamstr1s/runOneseq.py

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# -*- coding: utf-8 -*-
2+
3+
#######################################################################
4+
# Copyright (C) 2020 Vinh Tran
5+
#
6+
# This script is used to run HaMStR oneSeq.
7+
#
8+
# This script is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License <http://www.gnu.org/licenses/> for
12+
# more details
13+
#
14+
15+
#
16+
#######################################################################
17+
18+
import sys
19+
import os
20+
import argparse
21+
import subprocess
22+
23+
def runOneseq(args):
24+
(f,n,i,o,c,v,a,cpus,replace,oldFAS) = args
25+
script = os.path.realpath(__file__).replace('addTaxaHamstr', 'addTaxonHamstr')
26+
cmd = 'python3 %s -f %s -n %s -i %s -o %s -v %s --cpus %s' % (script, f,n,i,o,v,cpus)
27+
if c == True:
28+
cmd = cmd + ' -c'
29+
if a == True:
30+
cmd = cmd + ' -a'
31+
if oldFAS == True:
32+
cmd = cmd + ' --oldFAS'
33+
if replace == True:
34+
cmd = cmd + ' --replace'
35+
# print(cmd)
36+
logFile = o + '/addTaxaHamstr.log'
37+
cmd = cmd + ' >> ' + logFile
38+
try:
39+
subprocess.call([cmd], shell = True)
40+
except:
41+
sys.exit('Problem running\n%s' % (cmd))
42+
43+
def main():
44+
version = '0.0.1'
45+
parser = argparse.ArgumentParser(description='You are running runOneseq version ' + str(version) + '.')
46+
required = parser.add_argument_group('required arguments')
47+
optional = parser.add_argument_group('optional arguments')
48+
required.add_argument('-i', '--input', help='Input fasta file', action='store', default='', required=True)
49+
optional.add_argument('--setup', help='Setup HaMStR-oneSeq', action='store_true', default=False)
50+
optional.add_argument('--oneseqHelp', help='Print help of oneseq', action='store_true', default=False)
51+
52+
### get arguments
53+
args = parser.parse_args()
54+
input = args.input
55+
help = args.oneseqHelp
56+
setup = args.setup
57+
58+
oneseqPath = os.path.realpath(__file__).replace('/runOneseq.py','')
59+
if help:
60+
if os.path.exists(oneseqPath + '/oneSeq.pl'):
61+
helpMsgCmd = subprocess.Popen([oneseqPath + '/hamstr.pl', '-h'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
62+
helpMsg, helpErr = helpMsgCmd.communicate()
63+
print(helpMsg.decode('UTF-8'))
64+
print(helpErr.decode('UTF-8'))
65+
66+
if setup:
67+
setupFile = oneseqPath + '/setup.sh'
68+
subprocess.call([setupFile], shell = True)
69+
70+
71+
if __name__ == '__main__':
72+
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/env python
2+
3+
#######################################################################
4+
# Copyright (C) 2019 Julian Dosch
5+
#
6+
# This file is part of greedyFAS.
7+
#
8+
# greedyFAS is free software: you can redistribute it and/or modify
9+
# it under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation, either version 3 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# greedyFAS is distributed in the hope that it will be useful,
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with greedyFAS. If not, see <http://www.gnu.org/licenses/>.
20+
#
21+
#######################################################################
22+
23+
from setuptools import setup, find_packages
24+
25+
with open("README.md", "r") as input:
26+
long_description = input.read()
27+
28+
setup(
29+
name="hamstr1s",
30+
version="2.0.0",
31+
python_requires='>=3.7.0',
32+
description="Feature-aware orthology prediction tool",
33+
long_description=long_description,
34+
author="Vinh Tran",
35+
author_email="[email protected]",
36+
url="https://github.com/BIONF/HaMStR",
37+
packages=find_packages(),
38+
package_data={'': ['*']},
39+
install_requires=[
40+
'biopython',
41+
'tqdm',
42+
'ete3'
43+
],
44+
entry_points={
45+
'console_scripts': ["1s = hamstr1s.runOneseq:main",
46+
"addTaxonHamstr = hamstr1s.addTaxonHamstr:main",
47+
"addTaxaHamstr = hamstr1s.addTaxaHamstr:main",
48+
"mergeHamstrOutput = hamstr1s.mergePhyloprofileData:main"],
49+
},
50+
license="GPL-3.0",
51+
classifiers=[
52+
"Environment :: Console",
53+
"Intended Audience :: End Users/Desktop",
54+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
55+
"Natural Language :: English",
56+
"Programming Language :: Python :: 3",
57+
],
58+
)

0 commit comments

Comments
 (0)