Skip to content

Commit

Permalink
A few changes:
Browse files Browse the repository at this point in the history
- adding a RELEASING.md
- adding a logging.conf for use by scripts
- changing scripts to use logger instead of printing
- upping dependent package versions, upping isovar version
  • Loading branch information
julia326 committed Oct 13, 2016
1 parent d2998e3 commit c125802
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 24 deletions.
8 changes: 8 additions & 0 deletions RELEASING.md
@@ -0,0 +1,8 @@
# Releasing Isovar

This document explains what do once your [Pull Request](https://www.atlassian.com/git/tutorials/making-a-pull-request/) has been reviewed and all final changes applied. Now you're ready merge your branch into master and release it to the world:

0. Make sure that you have `pandoc` and `pypandoc` installed: this is needed for readme markdown on PyPI. (See [here](http://pandoc.org/installing.html) and [here](https://pypi.python.org/pypi/pypandoc), respectively, for instructions.)
1. Bump the [version](http://semver.org/) in `__init__.py`, as part of the PR you want to release.
2. Merge your branch into master.
3. Run `python setup.py sdist upload`, which pushes the newest release to PyPI.
2 changes: 1 addition & 1 deletion isovar/__init__.py
Expand Up @@ -14,4 +14,4 @@

from __future__ import print_function, division, absolute_import

__version__ = "0.2.2"
__version__ = "0.2.3"
56 changes: 56 additions & 0 deletions isovar/cli/logging.conf
@@ -0,0 +1,56 @@
[loggers]
keys=root,isovar,varcode,pyensembl,datacache

[formatters]
keys=simpleFormatter

[handlers]
keys=consoleHandler,consoleHandlerCritical

[logger_root]
level=INFO
handlers=consoleHandlerCritical

[handler_consoleHandler]
class=StreamHandler
level=INFO
formatter=simpleFormatter
args=(sys.stdout,)

[handler_consoleHandlerCritical] # only for root logger: essentially silent
class=StreamHandler
level=CRITICAL
formatter=simpleFormatter
args=(sys.stdout,)

[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=

# isovar

[logger_isovar]
level=DEBUG
qualname=isovar
handlers=consoleHandler

# varcode

[logger_varcode]
level=DEBUG
qualname=varcode
handlers=consoleHandler

# pyensembl

[logger_pyensembl]
level=DEBUG
qualname=pyensembl
handlers=consoleHandler

# datacache

[logger_datacache]
level=DEBUG
qualname=datacache
handlers=consoleHandler
4 changes: 2 additions & 2 deletions requirements.txt
@@ -1,7 +1,7 @@
numpy>=1.7
pandas>=0.13.1
pyensembl>=1.0.0
varcode>=0.5.0
pyensembl>=1.0.3
varcode>=0.5.9
pysam>=0.9.0
scikit-bio==0.4.2
nose>=1.3.3
Expand Down
14 changes: 10 additions & 4 deletions script/isovar-allele-counts.py
Expand Up @@ -18,25 +18,31 @@
Prints number of reads supporting ref, alt, and other alleles at variant loci.
"""

from __future__ import print_function, division, absolute_import
from __future__ import division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.rna_reads import (
make_rna_reads_arg_parser,
allele_reads_generator_from_args
)
from isovar.allele_counts import allele_counts_dataframe

parser = make_rna_reads_arg_parser()

logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_rna_reads_arg_parser()
parser.add_argument(
"--output",
default="isovar-allele-counts-result.csv",
help="Name of CSV file which contains read sequences")

if __name__ == "__main__":
args = parser.parse_args()
print(args)
logger.info(args)
variants_and_allele_reads_generator = allele_reads_generator_from_args(args)
allele_counts_df = allele_counts_dataframe(variants_and_allele_reads_generator)
print(allele_counts_df)
logger.info(allele_counts_df)
allele_counts_df.to_csv(args.output)
12 changes: 9 additions & 3 deletions script/isovar-allele-reads.py
Expand Up @@ -18,13 +18,19 @@
Prints names and sequences of reads overlapping a given set of variants.
"""

from __future__ import print_function, division, absolute_import
from __future__ import division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.rna_reads import (
make_rna_reads_arg_parser,
allele_reads_dataframe_from_args
)

logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_rna_reads_arg_parser()
parser.add_argument(
"--output",
Expand All @@ -33,7 +39,7 @@

if __name__ == "__main__":
args = parser.parse_args()
print(args)
logger.info(args)
df = allele_reads_dataframe_from_args(args)
print(df)
logger.info(df)
df.to_csv(args.output)
5 changes: 3 additions & 2 deletions script/isovar-protein-sequences.py
Expand Up @@ -22,18 +22,19 @@

from __future__ import print_function, division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.protein_sequences import (
make_protein_sequences_arg_parser,
protein_sequences_dataframe_from_args
)


logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)


parser = make_protein_sequences_arg_parser()

parser.add_argument(
"--output",
default="isovar-translate-variants-results.csv",
Expand Down
9 changes: 7 additions & 2 deletions script/isovar-reference-contexts.py
Expand Up @@ -15,14 +15,19 @@
# limitations under the License.

from __future__ import print_function, division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.reference_context import (
make_reference_context_arg_parser,
reference_contexts_dataframe_from_args
)

parser = make_reference_context_arg_parser()
logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_reference_context_arg_parser()
parser.add_argument(
"--output",
default="isovar-reference-contexts-result.csv",
Expand All @@ -31,5 +36,5 @@
if __name__ == "__main__":
args = parser.parse_args()
reference_contexts_df = reference_contexts_dataframe_from_args(args)
print(reference_contexts_df)
logger.info(reference_contexts_df)
reference_contexts_df.to_csv(args.output)
10 changes: 8 additions & 2 deletions script/isovar-translations.py
Expand Up @@ -20,12 +20,18 @@
"""

from __future__ import print_function, division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.translation import (
make_translation_arg_parser,
translations_dataframe_from_args,
)

logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_translation_arg_parser()
parser.add_argument(
"--output",
Expand All @@ -34,7 +40,7 @@

if __name__ == "__main__":
args = parser.parse_args()
print(args)
logger.info(args)
df = translations_dataframe_from_args(args)
print(df)
logger.info(df)
df.to_csv(args.output)
11 changes: 8 additions & 3 deletions script/isovar-variant-reads.py
Expand Up @@ -19,22 +19,27 @@
"""

from __future__ import print_function, division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.rna_reads import (
variant_reads_dataframe_from_args,
make_rna_reads_arg_parser,
)

parser = make_rna_reads_arg_parser()
logging.config.fileConfig(pkg_resources.resource_filename('isovar.cli', 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_rna_reads_arg_parser()
parser.add_argument(
"--output",
default="isovar-variant-reads-result.csv",
help="Name of CSV file which contains variant read sequences")

if __name__ == "__main__":
args = parser.parse_args()
print(args)
logger.info(args)
df = variant_reads_dataframe_from_args(args)
print(df)
logger.info(df)
df.to_csv(args.output)
12 changes: 9 additions & 3 deletions script/isovar-variant-sequences.py
Expand Up @@ -15,22 +15,28 @@
# limitations under the License.

from __future__ import print_function, division, absolute_import
import logging
import logging.config
import pkg_resources

from isovar.cli.variant_sequences import (
make_variant_sequences_arg_parser,
variant_sequences_dataframe_from_args
)

parser = make_variant_sequences_arg_parser(add_sequence_length_arg=True)

logging.config.fileConfig(pkg_resources.resource_filename(__name__, 'logging.conf'))
logger = logging.getLogger(__name__)

parser = make_variant_sequences_arg_parser(add_sequence_length_arg=True)
parser.add_argument(
"--output",
default="isovar-variant-sequences-results.csv",
help="Name of CSV file which contains predicted sequences")

if __name__ == "__main__":
args = parser.parse_args()
print(args)
logger.info(args)
df = variant_sequences_dataframe_from_args(args)
print(df)
logger.info(df)
df.to_csv(args.output)
5 changes: 3 additions & 2 deletions setup.py
Expand Up @@ -68,11 +68,12 @@
'pysam >= 0.9.0',
'pandas',
'scikit-bio==0.4.2',
'varcode>=0.5.0',
'pyensembl>=1.0.0'
'varcode>=0.5.9',
'pyensembl>=1.0.3'
],
long_description=readme,
packages=find_packages(),
package_data={'isovar.cli': ['logging.conf']},
scripts=[
"script/isovar-protein-sequences.py",
"script/isovar-translations.py",
Expand Down

0 comments on commit c125802

Please sign in to comment.