Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
backtranslate
Commits
ce1bc12f
Unverified
Commit
ce1bc12f
authored
May 10, 2020
by
Jeroen F.J. Laros
Browse files
Simplified package metadata handling.
parent
c8554e01
Changes
6
Hide whitespace changes
Inline
Side-by-side
backtranslate/__init__.py
View file @
ce1bc12f
from
os.path
import
dirname
,
abspath
from
configparser
import
ConfigParser
from
pkg_resources
import
get_distribution
from
.backtranslate
import
BackTranslate
config
=
ConfigParser
()
with
open
(
'{}/setup.cfg'
.
format
(
dirname
(
abspath
(
__file__
))))
as
handle
:
config
.
read_file
(
handle
)
def
_get_metadata
(
name
):
pkg
=
get_distribution
(
__package__
)
for
line
in
pkg
.
get_metadata_lines
(
pkg
.
PKG_INFO
):
if
line
.
startswith
(
'{}: '
.
format
(
name
)):
return
line
.
split
(
': '
)[
1
]
return
''
_copyright_notice
=
'Copyright (c) {} {} <{}>'
.
format
(
config
.
get
(
'metadata'
,
'copyright'
),
config
.
get
(
'metadata'
,
'author'
),
config
.
get
(
'metadata'
,
'author_email'
))
_copyright_notice
=
'Copyright (c) {} <{}>'
.
format
(
_get_metadata
(
'Author'
),
_get_metadata
(
'Author-email'
))
usage
=
[
config
.
get
(
'
metadata
'
,
'description
'
),
_copyright_notice
]
usage
=
[
_
get
_
metadata
(
'Summary
'
),
_copyright_notice
]
def
doc_split
(
func
):
...
...
@@ -23,7 +25,5 @@ def doc_split(func):
def
version
(
name
):
return
'{} version {}
\n\n
{}
\n
Homepage: {}'
.
format
(
config
.
get
(
'metadata'
,
'name'
),
config
.
get
(
'metadata'
,
'version'
),
_copyright_notice
,
config
.
get
(
'metadata'
,
'url'
))
_get_metadata
(
'Name'
),
_get_metadata
(
'Version'
),
_copyright_notice
,
_get_metadata
(
'Home-page'
))
backtranslate/setup.cfg
deleted
120000 → 0
View file @
c8554e01
../setup.cfg
\ No newline at end of file
backtranslate/util.py
View file @
ce1bc12f
...
...
@@ -11,7 +11,7 @@ def _three_to_one():
def
subst_to_cds
(
substitutions
,
offset
):
"""
Convert a set of substitutions to CDS coordinates.
"""Convert a set of substitutions to CDS coordinates.
:arg dict substitutions: Set of single nucleotide substitutions indexed by
position.
...
...
setup.cfg
View file @
ce1bc12f
[metadata]
name = backtranslate
version = 0.1.
1
version = 0.1.
2
description = Functions for reverse translation.
long_description = file: README.rst
author = LUMC, Jeroen F.J. Laros
...
...
@@ -9,20 +9,22 @@ url = https://github.com/mutalyzer/backtranslate
keywords = bioinformatics
license = MIT
classifiers =
Intended Audience :: Developers
Intended Audience :: Science/Research
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
copyright = 2015-2019
Topic :: Scientific/Engineering
[options]
packages = find:
install_requires =
biopython
configparser
python-Levenshtein
[options.package_data]
backtranslate = setup.cfg
biopython==1.76
python-Levenshtein==0.12.0
tests_require =
fake-open==0.0.1
pytest==4.0.1
[options.entry_points]
console_scripts =
...
...
tests/test_backtranslate.py
View file @
ce1bc12f
"""
Tests for the backtranslate.backtranslate module.
"""
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
from
future.builtins
import
str
,
zip
"""Tests for the backtranslate.backtranslate module."""
from
backtranslate.backtranslate
import
BackTranslate
,
cmp_subst
class
TestParser
(
object
):
"""
Test the backtranslate.backtranslate module.
"""
"""Test the backtranslate.backtranslate module."""
def
setup
(
self
):
self
.
bt
=
BackTranslate
()
...
...
tests/test_cli.py
View file @
ce1bc12f
"""
Tests for the backtranslate CLI.
"""
from
__future__
import
(
absolute_import
,
division
,
print_function
,
unicode_literals
)
from
future.builtins
import
str
,
zip
"""Tests for the backtranslate CLI."""
import
sys
from
hashlib
import
md5
...
...
@@ -16,9 +10,7 @@ from backtranslate import cli
class
TestParser
(
object
):
"""
Test the backtranslate.backtranslate module.
"""
"""Test the backtranslate.backtranslate module."""
def
setup
(
self
):
self
.
_input
=
open
(
'data/mhv.fa'
)
self
.
_output
=
StringIO
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment