Commit 287cc733 authored by Fabrice Allain's avatar Fabrice Allain
Browse files

Trouble with capturing and unicode syntax with python 3 compatibility...

parent 6767d22c
......@@ -289,10 +289,11 @@ class Capturing(list):
sys.stdout = self._stringio = StringIO()
return self
def __exit__(self,):
def __exit__(self, *args):
"""
:return:
"""
logger.error("Error during capture [%s]" % str(args))
self.extend("\n".join(self._stringio.getvalue().splitlines()))
sys.stdout = self._stdout
......
No preview for this file type
"""
Input/Output aria_ec
"""
from __future__ import absolute_import, division, print_function
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import logging
......
No preview for this file type
......@@ -14,7 +14,7 @@ import sys
import json
import re
import aria.legacy.AminoAcid as AminoAcid
from .base import get_filename, Capturing
from .base import get_filename
from .protein import Protein
from .reader import ProtFileListReader
from .protmap import (ResAtmMap, ResMap)
......@@ -124,11 +124,11 @@ class AriaXMLConverter(Converter, object):
sequence = SequenceList(chain_types, self._mol_set['first_residue_number'])
with Capturing() as output:
sequence.parse(self._mol_set['input'], self._mol_set['format'],
self._mol_set['naming_convention'])
# with Capturing() as output:
sequence.parse(self._mol_set['input'], self._mol_set['format'],
self._mol_set['naming_convention'])
logger.info("\n" + "".join(output))
# logger.info("\n" + "".join(output))
factory = self.create_factory()
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -11,8 +11,8 @@ import logging
import pkg_resources as pkgr
import aria.legacy.SequenceList as SequenceList
import aria.legacy.AminoAcid as AmnAcd
from six import iteritems
from .base import (reg_load, Capturing, ppdict)
from six import iteritems, text_type
from .base import (reg_load, ppdict)
# import skbio.Protein as skprot
# TODO: interface skbio ??
......@@ -375,9 +375,10 @@ class AminoAcidSequence(SequenceList.SequenceList, object):
:return:
"""
# TODO: smarter reader checking type of file (fasta, etc ...)
with Capturing() as output:
self.ReadFasta(filename)
logger.info(''.join(output))
# TODO: capturing has some troubles with unicode ...
# with Capturing() as output:
self.ReadFasta(text_type(filename))
# logger.info(''.join(output))
self.sequence = "".join((AmnAcd.AminoAcid(str(_))[0] for _ in
self.aalist))
......@@ -480,9 +481,10 @@ class Protein:
:param outfile:
:return:
"""
with Capturing() as output:
self.aa_sequence.WriteSeq(outfile)
logger.info(''.join(output))
# TODO: same as above, trouble with unicode calls inside capturing
# with Capturing() as output:
self.aa_sequence.WriteSeq(text_type(outfile))
# logger.info(''.join(output))
self.seqfile_path = outfile
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -13,9 +13,10 @@ except subprocess.CalledProcessError:
version_git = open(version_py).read().strip().split('=')[-1].replace('"',
'')
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as pyv:
pyv.write(version_msg + os.linesep + "__version__=" + version_git)
# TODO: Seems not compatible with PEP440 ...
# version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
# with open(version_py, 'w') as pyv:
# pyv.write(version_msg + os.linesep + "__version__=" + version_git)
__version_info__ = (0, 1, 0) # MAJOR, MINOR, PATCH
__version__ = '.'.join((str(i) for i in __version_info__))
......
# Do not edit this file, pipeline versioning is governed by git tags
__version__=v0.1.11-dev2-16-gb1e477c
\ No newline at end of file
__version__ = 'v0.1.0'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment