diff --git a/ariaec/__init__.pyc b/ariaec/__init__.pyc index 8beec7da806c597f90cc1923e67032e7aa62f134..6dbf12f6af78ab4e98ffa0e0249c74b06128ba80 100644 Binary files a/ariaec/__init__.pyc and b/ariaec/__init__.pyc differ diff --git a/ariaec/base.py b/ariaec/base.py index 69f3148d0856c5df2f395e866863c4505f182cb3..eb0d60ae1c118752a188c31e08b3cc209e883891 100644 --- a/ariaec/base.py +++ b/ariaec/base.py @@ -13,7 +13,7 @@ import sys import numpy as np import pkg_resources as pkgr import matplotlib.artist as art -from cStringIO import StringIO +from io import StringIO logger = logging.getLogger() @@ -289,10 +289,8 @@ class Capturing(list): sys.stdout = self._stringio = StringIO() return self - def __exit__(self, *args): + def __exit__(self,): """ - - :param args: :return: """ self.extend("\n".join(self._stringio.getvalue().splitlines())) diff --git a/ariaec/base.pyc b/ariaec/base.pyc index d6f1402e1fc0c50fce3f807e87cb99c13241e5d5..59ffcefb29d6191ce32bcd0a920da7a8f15909a6 100644 Binary files a/ariaec/base.pyc and b/ariaec/base.pyc differ diff --git a/ariaec/commands.py b/ariaec/commands.py index 21d36fdd168167acc8689df3e363d909de61f0bb..bee32d6e00022175300a714cc90ddb7e972f5542 100644 --- a/ariaec/commands.py +++ b/ariaec/commands.py @@ -27,6 +27,9 @@ def check_file(prospective_file): class ReadableFile(argp.Action): + def __init__(self, *args, **kwargs): + super(ReadableFile, self).__init__(*args, **kwargs) + def __call__(self, parser, namespace, values, option_string=None): if type(values) == list: for prospective_file in values: diff --git a/ariaec/commands.pyc b/ariaec/commands.pyc index 2d377707d3f28aea7f677e655f4cea34ee2eddeb..61d20baa4bf388d23f4053573274c13d551a398e 100644 Binary files a/ariaec/commands.pyc and b/ariaec/commands.pyc differ diff --git a/ariaec/econverter.py b/ariaec/econverter.py index 203e7dd4b47d3c38bd542dc0d8d49d9debff6e8e..4a109160805a8b29d35d8a352bcd8e9e2edf2b70 100644 --- a/ariaec/econverter.py +++ b/ariaec/econverter.py @@ -13,7 +13,6 @@ import os import sys import json import re -import pkg_resources as pkgr import aria.legacy.AminoAcid as AminoAcid from .base import get_filename, Capturing from .protein import Protein @@ -307,7 +306,7 @@ assign (resid {res1} and name o) (resid {res2} and name hn) 1.8 {dminus} {dplus # Build global secondary structure distance restraints (H-H+4, E-E+1, # ...) with open(outfile, 'w') as outfile: - for a in xrange(len(sec_struct) - 1): + for a in range(len(sec_struct) - 1): for b in range(a + 1, len(sec_struct)): ss1 = sec_struct[a][2] ss2 = sec_struct[b][2] @@ -331,7 +330,7 @@ assign (resid {res1} and name {atm1}) (resid {res2} and name {atm2}) {dist} {sd def write_dihedral_tbl(sec_struct, outfile, k=0.5, e=2): # Build dihedral angle restraints (phi, psi) with open(outfile, "w") as outfile: - for i in xrange(len(sec_struct)): + for i in range(len(sec_struct)): if (i + 1) != len(sec_struct): if sec_struct[i][2] == sec_struct[i + 1][2]: # Si ss identique @@ -396,6 +395,12 @@ assign (resid {res1} and name n) (resid {res1} and name ca) (resid {res1} and na class AriaEcXMLConverter(AriaXMLConverter): + + @staticmethod + def _write_hbmap_tbl(hbmap, outfile, dminus, dplus, n_hb=None, hb_type="main", topo=None): + AriaXMLConverter._write_hbmap_tbl(hbmap, outfile, dminus, dplus, n_hb=None, hb_type="main", + topo=None) + def __init__(self, *args, **kwargs): self.restraint_list = [] super(AriaEcXMLConverter, self).__init__(*args, **kwargs) @@ -711,7 +716,7 @@ class AriaEcXMLConverter(AriaXMLConverter): self._pickler.dump(self.molecule, self._mol_set[ 'output']) - except Exception, msg: + except Exception as msg: logger.error("Error writing xml seq file : %s" % msg) @@ -732,7 +737,7 @@ class AriaEcXMLConverter(AriaXMLConverter): templatepath = os.path.abspath(aria_template) ariaproj_template = Template(filename=templatepath, - module_directory="/tmp/mako_modules") + module_directory="/tmp/mako_modules") try: t = open(templatepath, 'r') diff --git a/ariaec/econverter.pyc b/ariaec/econverter.pyc index acf5859b87db9337d5547ea2326adfb6d8fc2812..e9e078e3844b0924216ae2cefa64f62adef2ac88 100644 Binary files a/ariaec/econverter.pyc and b/ariaec/econverter.pyc differ diff --git a/ariaec/ecsettings.py b/ariaec/ecsettings.py index dd131a4fb30c5e3e5437f9d023c6d0f2a1197d06..bebf738e19d8cfe0693e494b1b9b53a747435607 100644 --- a/ariaec/ecsettings.py +++ b/ariaec/ecsettings.py @@ -5,9 +5,9 @@ from __future__ import absolute_import, division, print_function import logging import os -import ConfigParser +from configparser import SafeConfigParser import collections -import cPickle as Pickle +import pickle import pkg_resources as pkgr from .base import format_dict @@ -42,7 +42,7 @@ class Settings(object): elif not pkg: logger.error("Configuration file not found (%s)" % configpath) return None - config = ConfigParser.SafeConfigParser(allow_no_value=True) + config = SafeConfigParser(allow_no_value=True) if pkg: with pkgr.resource_stream(__name__, configpath) as conf: config.readfp(conf) @@ -62,7 +62,7 @@ class Settings(object): def write_config(self, filename): # Ecrit les config de toutes les sections dans un autre fichier logger.info("Writing .ini file (%s)" % filename) - config = ConfigParser.SafeConfigParser(allow_no_value=True) + config = SafeConfigParser(allow_no_value=True) iniout = open(filename, mode="w") for section in self._sections: config.add_section(section) @@ -151,12 +151,12 @@ class AriaEcSettings(Settings): try: # Read scsc_min_file given in aria_ec.ini with open(self.main.config["scsc_min_file"]) as scsc: - scsc_min = Pickle.load(scsc) + scsc_min = pickle.load(scsc) except (IOError, KeyError, TypeError): # If file can't be open or given key is invalid, load default # package file with pkgr.resource_stream(__name__, self.SCSC_MIN) as scsc: - scsc_min = Pickle.load(scsc) + scsc_min = pickle.load(scsc) scsc_min = dict( (aa1, dict((aa2, tuple(atm_pair.split(', '))) for aa2, atm_pair in atm_pairs.items())) diff --git a/ariaec/ecsettings.pyc b/ariaec/ecsettings.pyc index 255ed5031f4cbbcd88e62c1a883bc47f6365371f..1ddd9862f6718960ea3e9177c434ba2f8f0f7a41 100644 Binary files a/ariaec/ecsettings.pyc and b/ariaec/ecsettings.pyc differ diff --git a/ariaec/maplot.pyc b/ariaec/maplot.pyc index 52c27a55568ff104dddf5f68a89fe949ec82cd0d..7a504fb5cdc373664cc54480f4312cc4963f6c6a 100644 Binary files a/ariaec/maplot.pyc and b/ariaec/maplot.pyc differ diff --git a/ariaec/ndconv.pyc b/ariaec/ndconv.pyc index 2561e1ff8777409c519f6f9e8cb594ed87ed618e..e998e9b990adb6af4d8cd5b8ec496740d5f1a6d0 100644 Binary files a/ariaec/ndconv.pyc and b/ariaec/ndconv.pyc differ diff --git a/ariaec/protein.py b/ariaec/protein.py index 8b5a48fc3842a35fa68f2382bea14ccc93e5d1ad..0b6031f0f269d73e84d348b897a1290b4f475e33 100644 --- a/ariaec/protein.py +++ b/ariaec/protein.py @@ -11,6 +11,7 @@ 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) # import skbio.Protein as skprot # TODO: interface skbio ?? @@ -211,7 +212,7 @@ class SsList: try: with open(filename) as f: self._read_ssdist(f, filename=filename) - except Exception, message: + except Exception as message: logger.error("%s" % message) logger.error("Can't load given ss dist file...") logger.error("Loading default ss dist file") @@ -242,7 +243,7 @@ class SsList: # TODO: read_dssp -class AminoAcidSequence(SequenceList.SequenceList): +class AminoAcidSequence(SequenceList.SequenceList, object): startres_reg = re.compile(r"^\s*residue\s+(?P<name>[A-Za-z]{1,4})", flags=re.I) end_reg = re.compile(r"^\s*end", flags=re.I) @@ -277,7 +278,7 @@ class AminoAcidSequence(SequenceList.SequenceList): :param kwargs: :return: """ - SequenceList.SequenceList.__init__(self, *args, **kwargs) + super(AminoAcidSequence, self).__init__(*args, **kwargs) self._topfile = topologyfile self._topology = None self._topok = False @@ -303,7 +304,7 @@ class AminoAcidSequence(SequenceList.SequenceList): self._topology = [(aa, topo[aa]) for aa in self.aalist] self._topok = True else: - self._topology = list(topo.iteritems()) + self._topology = list(iteritems(topo)) return self._topology def __getitem__(self, key): @@ -324,7 +325,7 @@ class AminoAcidSequence(SequenceList.SequenceList): def readtopo(self): """ - + Parse topology file for amino acids :return: """ topo = {} @@ -346,24 +347,24 @@ class AminoAcidSequence(SequenceList.SequenceList): resname = "" continue # Walk along reg dict - for regid, reg in self.restatement_reg.iteritems(): + for regid, reg in iteritems(self.restatement_reg): + if regid not in topo[resname]: + topo[resname][regid] = [] if regid == "bond": match = re.findall(reg, line) + if match: + topo[resname][regid] += match + break else: match = reg.search(line) - if match: - if regid not in topo[resname]: - topo[resname][regid] = [] - if regid == "bond": - # Add 2-tuple - topo[resname][regid] += match - elif regid in ("improper", "dihedral"): - # Add tuple into list since we need atm order - topo[resname][regid].append(match.groups()) - else: - # Add dict - topo[resname][regid].append(match.groupdict()) - break + if match: + if regid in ("improper", "dihedral"): + # Add tuple into list since we need atm order + topo[resname][regid].append(match.groups()) + else: + # Add dict + topo[resname][regid].append(match.groupdict()) + break logger.debug("Topology used:\n%s" % ppdict(topo)) return topo diff --git a/ariaec/protein.pyc b/ariaec/protein.pyc index 3df5777c7f7fa6aa966518bc7a9d3fbd82c53a12..94fef3012ea0cdec3a3cde4312dc5fdbcdb62a43 100644 Binary files a/ariaec/protein.pyc and b/ariaec/protein.pyc differ diff --git a/ariaec/protmap.py b/ariaec/protmap.py index 451240ef5e1954a911404f8307adcf7a7f44c2fe..266156bf3d6baf09d044bb54b22daade6cce8076 100644 --- a/ariaec/protmap.py +++ b/ariaec/protmap.py @@ -41,8 +41,11 @@ class Map(pd.DataFrame): mtype_choices = {'contact': bool, 'distance': float, "score": float} - def _constructor_expanddim(self): - super(Map, self)._constructor_expanddim() + def update(self, *args, **kwargs): + super(Map, self).update(*args, **kwargs) + + # def _constructor_expanddim(self): + # super(Map, self)._constructor_expanddim() def __init__(self, index=None, columns=None, mtype='distance', duplicate_levels=False, data=None, dtype=None, sym=True, @@ -660,7 +663,7 @@ class ResAtmMap(ProteinMap): "the default cutoff)" % str(pair)) logger.info( "Filtering values in matrix related to %s (%s)" % - (str(pair), str(treshold))) + (str(pair), str(treshold) if treshold else def_cutoff)) if pair in (("SC", "SC"), ("sc", "sc")): # Use scsc_min to apply treshold updateonly for selected atom # sidechain @@ -757,8 +760,8 @@ class AaMap(Map): Amino Acid Distance Matrix """ - def _constructor_expanddim(self): - super(AaMap, self)._constructor_expanddim() + # def _constructor_expanddim(self): + # super(AaMap, self)._constructor_expanddim() def __init__(self, *args, **kwargs): if ("humanidx", "columns") not in kwargs: @@ -781,8 +784,8 @@ class AtmMap(Map): Atom Distance Matrix """ - def _constructor_expanddim(self): - super(AtmMap, self)._constructor_expanddim() + # def _constructor_expanddim(self): + # super(AtmMap, self)._constructor_expanddim() def __init__(self, *args, **kwargs): super(AtmMap, self).__init__(*args, **kwargs) @@ -1037,7 +1040,7 @@ class MapFilter: ss_start_end = collections.defaultdict(lambda: [None, None]) # TODO: deplacer construction du dic ss_start_end dans SsList - for res_ind in xrange(len(ss_matrix)): + for res_ind in range(len(ss_matrix)): # Construction du dict ss_start_end if res_ind == 0: # If first residue @@ -1082,7 +1085,7 @@ class MapFilter: for n in (1, 2, 3, 4): # Search type of the bond (H-1 H, E-2 E, ...) - for i in xrange(2): + for i in range(2): # Test both sides resi = contact[i] @@ -1331,8 +1334,7 @@ class MapFilter: else: op = "added" ctype = clash - meta_clash[clash_t]["warn"] += "\n/!\ Clash: {clash_desc} {" \ - "clash} flag for contact " \ + meta_clash[clash_t]["warn"] += "\n/!\ Clash: {clash_desc} {clash} flag for contact " \ "{res_pos} ({res1}, {res2})".format( clash_desc=op, clash=ctype, res_pos=icontact + 1, res1=contact[0], res2=contact[1]) diff --git a/ariaec/protmap.pyc b/ariaec/protmap.pyc index 97bdf80fc6bac046dfcd28c7d8a8f59c05779b2f..d40663f51f5c554e656cb18edc04d897a71ce272 100644 Binary files a/ariaec/protmap.pyc and b/ariaec/protmap.pyc differ diff --git a/ariaec/reader.pyc b/ariaec/reader.pyc index be72a36a7ff53222b0b28eba550b659a5245a599..29df7419eb4233ff489dc99cb4ba9c7f506cdf80 100644 Binary files a/ariaec/reader.pyc and b/ariaec/reader.pyc differ diff --git a/ariaec/setup.pyc b/ariaec/setup.pyc index 61472e585722d579ed2c331f857e43d791d42641..db150a42b10c9adc4fef86392cc074440d3d1ad8 100644 Binary files a/ariaec/setup.pyc and b/ariaec/setup.pyc differ diff --git a/bin/ec2aria.pyc b/bin/ec2aria.pyc deleted file mode 100644 index 5b9ac9c197722157d01eac0069236a7db1e68bd6..0000000000000000000000000000000000000000 Binary files a/bin/ec2aria.pyc and /dev/null differ diff --git a/setup.py b/setup.py index 182a0d265ed6febbb45cafb4104c81f217c7171b..2ffec384b0f659be4985b64b8119f92abc25c166 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ setup( 'seaborn', 'scipy', 'sklearn', - 'colorlog', + 'colorlog', 'mako', # 'scikit-bio==0.4.0', # 'aria==2.3' ], diff --git a/version.py b/version.py index e0ce9534e68845f3859089100de0c3af44c750c3..76bddd8d57fb6f69b0f2cb010d2c2f575c1b0898 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ # Do not edit this file, pipeline versioning is governed by git tags -__version__=v0.1.11-dev2-8-g4239f50 \ No newline at end of file +__version__=v0.1.11-dev2-16-gb1e477c \ No newline at end of file