Commit f891072c authored by Fabrice  ALLAIN's avatar Fabrice ALLAIN

Merge branch '36-error-during-conversion-table-loading' into 'master'

Resolve "Error during Conversion Table loading"

Closes #36

See merge request bis-aria/ariaec!14
parents 3f9865e2 2ad78ecf
......@@ -11,7 +11,6 @@ stages:
- coverage
- deploy
- cleanup
- deliver
build:
stage: build
......@@ -45,6 +44,7 @@ coverage:
- htmlcov/
only:
refs:
- production
- master
changes:
- src/**/*
......@@ -66,6 +66,7 @@ pages:
only:
refs:
- master
- production
changes:
- docs/**/*
......@@ -79,13 +80,14 @@ deliver:
image:
name: registry.gitlab.com/hyper-expanse/open-source/semantic-delivery-gitlab:9.0.0
entrypoint: [""]
only:
refs:
- merge_requests
script:
- semantic-delivery-gitlab --token $SEMANTIC_TOKEN
stage: deliver
stage: deploy
environment:
name: production
only:
- production
# deploy_pypi:
# stage: deploy
......
## [0.0.21](https://gitlab.pasteur.fr/bis-aria/Ariaec/compare/0.1.0...0.0.21) (2019-07-08)
### Bug Fixes
* add debug log message in ssclash ([8e50b10](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/8e50b10))
* add debug log message in ssclash ([beb4935](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/beb4935))
* avoid key errors if all parameters don't exist with pdbqual command ([ea0e556](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/ea0e556))
* change api key for semantic delivery ([8eba464](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/8eba464))
* change dependencies in setup.py ([eb5c0be](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/eb5c0be))
* change depreacted CI var in gitlab ci conf file ([74463c0](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/74463c0))
* change depreacted CI var in gitlab ci conf file ([4464019](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/4464019))
* escape percent character within csh script for format function ([a785ce9](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/a785ce9))
* force python 2.7 dependency ([99041c7](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/99041c7))
* force python 2.7 dependency ([5f3380d](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/5f3380d))
* future dependency in dockerfile ([0d1d39e](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/0d1d39e))
* implement setting.get method used within pdbqual tool ([a8d66dc](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/a8d66dc))
* implement setting.get method used within pdbqual tool ([1832c26](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/1832c26))
* remove logger during serialization for distance restraint class ([0465e1b](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/0465e1b))
* remove sge_job_id var in csh script refine for sbatch options ([a036e7f](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/a036e7f))
* removed unicode strings during convert part ([39d1d47](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/39d1d47))
* revision of output slurm file for cns refine.csh ([8d14ebd](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/8d14ebd))
* solve conflict issue between pdbqual and setup config parameters ([48a05e2](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/48a05e2))
* solve import issue with pdbqual command ([737dd53](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/737dd53))
* solve issue [#24](https://gitlab.pasteur.fr/bis-aria/Ariaec/issues/24) ([aeda4d1](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/aeda4d1))
* solve issue with missing alignment for evcoupling contacts ([c6f3afc](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/c6f3afc))
* solve issue with warnings in the logger ([990419e](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/990419e))
* solve numpy dependency issue with hdbscan ([bf3c81c](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/bf3c81c))
* solve several format issues in the new logging system ([eff5776](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/eff5776))
* sphinx crash with 1.8 due to python 3 dependencies ([fd0efa1](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/fd0efa1))
* syntax error for clashlist flag in aria project templates ([9b270f0](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/9b270f0))
* Update ariabase.py getstate ([6c209af](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/6c209af))
* update doc confs with the new project tree ([46dff44](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/46dff44))
* update dockerfile ([541d72c](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/541d72c))
* update dockerfile ([40b59e9](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/40b59e9))
* update dockerfile ([00d6865](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/00d6865))
* wget dependency in dockerfile ([bdf572c](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/bdf572c))
* wrong installation order in dockerfile for husky npm module ([934a449](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/934a449))
* wrong installation order in dockerfile for husky npm module ([c83c314](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/c83c314))
* **aria.core.TypeChecking:** overwrite previous python3 patch ([dbca55a](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/dbca55a))
* **aria.core.TypeChecking:** solve byte string type checker issue when running the package with python3 ([07fb1c6](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/07fb1c6))
### Features
* add options to activate or deactivate pdq quality tools (pdbqual command) ([4a54d05](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/4a54d05))
* add structure_analysis_enabled option within conbox commands ([e88a654](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/e88a654))
* add v2.3.7 aria project template ([1b9fa48](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/1b9fa48))
* Automatic changelog ([8fda476](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/8fda476))
* Automatic changelog ([23e095b](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/23e095b))
* molecule settings hack in order to support multiple chains ([164f187](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/164f187))
* new logging system for aria core ([223c58d](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/223c58d))
* new logging system for aria core ([1fd579c](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/1fd579c))
* safe xml tag checker for python3 ([d8b091e](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/d8b091e))
* semantic delivery gitlab ([b11664f](https://gitlab.pasteur.fr/bis-aria/Ariaec/commit/b11664f))
Version: 0.0.21
\ No newline at end of file
Version: 0.1.01
\ No newline at end of file
......@@ -21,10 +21,11 @@ list of PDB files.
Be sure to check if the following packages are correctly installed with
your python installation or virtual environment.
- **pip** (>= 9.0)
- **setuptools** (>= 18.0)
- **pip** (>= 18.0)
- **git** (>= 2.0)
- **cns-solve** (1.21)
- **pbxplore** (>= 1.3.8)
- **ccpnmr analysis** (optional)
- **ccpn data model** (optional)
Then the easiest solution is to call the **pip** command below :
......@@ -33,7 +34,8 @@ Then the easiest solution is to call the **pip** command below :
For more information about installation and usage, please refer to the
[ARIAEC documentation](http://bis-aria.pages.pasteur.fr/ariaec)
**ARIA contains patches for CNS-solve which needs to be compiled after the installation. Please follow [post installation instructions](http://bis-aria.pages.pasteur.fr/ariaec/installation.html#post-installation-instructions).**
**ARIA contains patches for CNS-solve which needs to be compiled after the
installation. Please follow [post installation instructions](http://bis-aria.pages.pasteur.fr/ariaec/installation.html#post-installation-instructions).**
## Contributing
......
......@@ -8,20 +8,11 @@
usage
contributing
.. toctree::
:maxdepth: 4
:caption: API
Core package <api/aria.core>
Conbox package <api/aria.conbox>
.. toctree::
:maxdepth: 2
:caption: Tutorial
tutorial/setup
tutorial/run
tutorial/analysis
tutorial
.. toctree::
:maxdepth: 2
......@@ -29,3 +20,11 @@
examples/bpt1/bpt1
examples/malecoli/malecoli
.. toctree::
:maxdepth: 4
:caption: API
Core package <api/aria.core>
Conbox package <api/aria.conbox>
......@@ -15,48 +15,50 @@ can be found in the ``docs`` folder or :download:`here <../../examples.tar.gz>`.
Contact map analysis
--------------------
**Input**
.. code-block:: console
> ariaec maplot examples/bpt1/data/BPT1_BOVIN.fa examples/bpt1/data/BPT1_BOVIN.indextableplus examples/bpt1/data/BPT1_BOVIN.native.aligned.pdb examples/bpt1/data/BPT1_BOVIN_contacts.gremlin.out -o examples/bpt1/out -t pdb gremlin
(venv) [user@host examples] > ariaec maplot bpt1/data/BPT1_BOVIN.fa bpt1/data/BPT1_BOVIN.indextableplus bpt1/data/BPT1_BOVIN.native.aligned.pdb bpt1/data/BPT1_BOVIN_contacts.gremlin.out -o bpt1/out -t pdb gremlin
**Output**
.. code-block:: console
================================================================================
ARIA Evolutive Contact toolbox
================================================================================
================================================================================
ARIA Evolutive Contact toolbox
================================================================================
INFO Initialize settings
INFO Making output directories
INFO Reading fasta file /c7/home/fallain/tmp/bpt1/data/bpt1_bovin.fa
INFO Amino acid sequence: FCLEPPYTGPCKARIIRYFYNAKAGLCQTFVYGGCRAKRNNFKSAEDCMRTCG
INFO Checking if file /c7/home/fallain/tmp/bpt1/data/BPT1_BOVIN.indextableplus correspond to indextableplus format
INFO Format type correct (indextableplus)
INFO Reading secondary structure file /c7/home/fallain/tmp/bpt1/data/BPT1_BOVIN.indextableplus [indextableplus]
INFO Loading ss dist file
INFO Reading distance file /c7/home/fallain/.conda/envs/aria/lib/python2.7/site-packages/aria/conbox/data/ss_dist.txt
INFO Align secondary structure sequence with protein sequence
INFO Reading /c7/home/fallain/tmp/bpt1/data/BPT1_BOVIN.native.aligned.pdb file
INFO Updating distance map with pdb file
INFO Generate contact map using contact definition defaultdict(None, {'default_cutoff': 8.0})
INFO Using default cutoff
INFO Reading /c7/home/fallain/tmp/bpt1/data/BPT1_BOVIN_contacts.gremlin.out file
INFO Pdb map set as reference
INFO Generate contact map plot (/c7/home/fallain/tmp/bpt1/out/BPT1_BOVIN.maplot.pdf)
INFO Generate map report file (/c7/home/fallain/tmp/bpt1/out/mapreport)
INFO Generate roc file (/c7/home/fallain/tmp/bpt1/out/graphics/maplot.roc.csv)
INFO Generate roc plot (/c7/home/fallain/tmp/bpt1/out/graphics/maplot.roc.pdf)
INFO Generate precall file (/c7/home/fallain/tmp/bpt1/out/graphics/maplot.roc.csv)
INFO Generate precall plot (/c7/home/fallain/tmp/bpt1/out/graphics/maplot.precall.pdf)
INFO Generate contact file (/c7/home/fallain/tmp/bpt1/out/BPT1_BOVIN_contacts_gremlin.contact.txt)
INFO Generate stat file (/c7/home/fallain/tmp/bpt1/out/maplot.contactcmp.csv)
INFO Contact list: [(1, 39), (1, 42), (1, 51), (3, 22), (3, 25), (3, 45), (3, 47), (3, 51), (4, 23), (4, 38), (4, 39), (4, 42), (4, 49), (5, 23), (6, 19), (7, 37), (8, 12), (8, 31), (8, 33), (9, 19), (9, 34), (9, 37), (9, 41), (10, 33), (10, 36), (11, 33), (11, 35), (12, 8), (12, 20), (12, 31), (12, 33), (13, 33), (13, 34), (14, 31), (14, 33), (14, 36), (15, 31), (16, 29), (16, 31), (17, 41), (17, 43), (18, 28), (18, 29), (18, 45), (19, 6), (19, 9), (19, 28), (19, 29), (20, 12), (20, 25), (20, 27), (21, 28), (22, 3), (22, 25), (22, 28), (23, 4), (23, 5), (23, 26), (23, 29), (23, 43), (24, 28), (25, 3), (25, 20), (25, 22), (25, 28), (25, 46), (25, 53), (26, 23), (27, 20), (27, 48), (27, 52), (28, 18), (28, 19), (28, 21), (28, 22), (28, 24), (28, 25), (29, 16), (29, 18), (29, 19), (29, 23), (30, 33), (30, 37), (30, 38), (31, 8), (31, 12), (31, 14), (31, 15), (31, 16), (32, 37), (32, 38), (32, 40), (32, 41), (33, 8), (33, 10), (33, 11), (33, 12), (33, 13), (33, 14), (33, 30), (34, 9), (34, 13), (34, 37), (35, 11), (36, 10), (36, 14), (36, 39), (36, 50), (37, 7), (37, 9), (37, 30), (37, 32), (37, 34), (37, 41), (38, 4), (38, 30), (38, 32), (38, 41), (39, 1), (39, 4), (39, 36), (40, 32), (41, 9), (41, 17), (41, 32), (41, 37), (41, 38), (42, 1), (42, 4), (43, 17), (43, 23), (43, 47), (44, 47), (45, 3), (45, 18), (45, 49), (46, 25), (46, 49), (46, 50), (47, 3), (47, 43), (47, 44), (47, 51), (48, 27), (48, 52), (49, 4), (49, 45), (49, 46), (49, 53), (50, 36), (50, 46), (50, 53), (51, 1), (51, 3), (51, 47), (52, 27), (52, 48), (53, 25), (53, 49), (53, 50)]
INFO Generate contact map plot (/c7/home/fallain/tmp/bpt1/out/.maplot.pdf)
INFO Generate contact file (/c7/home/fallain/tmp/bpt1/out/BPT1_BOVIN_native_aligned.contact.txt)
INFO Initialize settings
INFO Making output directories
reading FASTA file examples/bpt1/data/BPT1_BOVIN.fa
INFO Amino acid sequence: FCLEPPYTGPCKARIIRYFYNAKAGLCQTFVYGGCRAKRNNFKSAEDCMRTCG
INFO Checking if file examples/bpt1/data/BPT1_BOVIN.indextableplus correspond to indextableplus format
INFO Format type correct (indextableplus)
INFO Reading secondary structure file examples/bpt1/data/BPT1_BOVIN.indextableplus [indextableplus]
INFO Loading ss dist file
INFO Reading distance file ss_dist.txt
INFO Align secondary structure sequence with protein sequence
INFO Reader focused on file(s) ['examples/bpt1/data/BPT1_BOVIN.native.aligned.pdb', 'examples/bpt1/data/BPT1_BOVIN_contacts.gremlin.out'] ['pdb', 'gremlin']
INFO Reading examples/bpt1/data/BPT1_BOVIN.native.aligned.pdb file
INFO Updating distance map with pdb file
INFO Generate contact map using contact definition defaultdict(None, {'bool': None, 'default_cutoff': 8.0})
INFO Using default cutoff
INFO Reading examples/bpt1/data/BPT1_BOVIN_contacts.gremlin.out file
INFO Pdb map set as reference
INFO Generate contact map plot (examples/bpt1/out/BPT1_BOVIN.maplot.pdf)
INFO Generate contact file (examples/bpt1/out/BPT1_BOVIN_native_aligned.contact.txt)
INFO Generate map report file (examples/bpt1/out/mapreport)
INFO Generate roc file (examples/bpt1/out/graphics/maplot.roc.csv)
INFO Generate roc plot (examples/bpt1/out/graphics/maplot.roc.pdf)
INFO Generate precall file (examples/bpt1/out/graphics/maplot.roc.csv)
INFO Generate precall plot (examples/bpt1/out/graphics/maplot.precall.pdf)
INFO Generate contact file (examples/bpt1/out/BPT1_BOVIN_contacts_gremlin.contact.txt)
INFO Generate stat file (examples/bpt1/out/maplot.contactcmp.csv)
INFO Contact list: [(1, 39), (1, 42), (1, 51), (3, 22), (3, 25), (3, 45), (3, 47), (3, 51), (4, 23), (4, 38), (4, 39), (4, 42), (4, 49), (5, 23), (6, 19), (7, 37), (8, 12), (8, 31), (8, 33), (9, 19), (9, 34), (9, 37), (9, 41), (10, 33), (10, 36), (11, 33), (11, 35), (12, 8), (12, 20), (12, 31), (12, 33), (13, 33), (13, 34), (14, 31), (14, 33), (14, 36), (15, 31), (16, 29), (16, 31), (17, 41), (17, 43), (18, 28), (18, 29), (18, 45), (19, 6), (19, 9), (19, 28), (19, 29), (20, 12), (20, 25), (20, 27), (21, 28), (22, 3), (22, 25), (22, 28), (23, 4), (23, 5), (23, 26), (23, 29), (23, 43), (24, 28), (25, 3), (25, 20), (25, 22), (25, 28), (25, 46), (25, 53), (26, 23), (27, 20), (27, 48), (27, 52), (28, 18), (28, 19), (28, 21), (28, 22), (28, 24), (28, 25), (29, 16), (29, 18), (29, 19), (29, 23), (30, 33), (30, 37), (30, 38), (31, 8), (31, 12), (31, 14), (31, 15), (31, 16), (32, 37), (32, 38), (32, 40), (32, 41), (33, 8), (33, 10), (33, 11), (33, 12), (33, 13), (33, 14), (33, 30), (34, 9), (34, 13), (34, 37), (35, 11), (36, 10), (36, 14), (36, 39), (36, 50), (37, 7), (37, 9), (37, 30), (37, 32), (37, 34), (37, 41), (38, 4), (38, 30), (38, 32), (38, 41), (39, 1), (39, 4), (39, 36), (40, 32), (41, 9), (41, 17), (41, 32), (41, 37), (41, 38), (42, 1), (42, 4), (43, 17), (43, 23), (43, 47), (44, 47), (45, 3), (45, 18), (45, 49), (46, 25), (46, 49), (46, 50), (47, 3), (47, 43), (47, 44), (47, 51), (48, 27), (48, 52), (49, 4), (49, 45), (49, 46), (49, 53), (50, 36), (50, 46), (50, 53), (51, 1), (51, 3), (51, 47), (52, 27), (52, 48), (53, 25), (53, 49), (53, 50)]
INFO Generate contact map plot (examples/bpt1/out/.maplot.pdf)
Setup
......
......@@ -203,8 +203,8 @@ version 1.2 :
2. Edit the file ``cns_solve_env`` in the directory ``cns_solve_1.1`` to define
the location of the CNSsolve directory.
3. Go to directory ``cns_solve_1.1`` and type ``make install``. This should start
the compilation process.
3. Go to the directory ``cns_solve_1.1`` and type ``make install``. This should
start the compilation process.
.. Footnotes
......
=========
Workflows
=========
Structure calculation with EC restraints
========================================
The ``ariaec`` Command Line Interface (CLI) is the main tool for
converting and analyze contact map information. The main command of this
interface is ``ariaec setup`` which create an ARIA project XML file. Then we can
follow the usual steps for an ARIA project.
Configuration file
------------------
All the parameters for ``ariaec`` commands are encapsulated on a configuration
file in INI format. Each time you need to overwrite the default parameters,
another configuration file can be used with the updated parameters. There is
no need to give all the parameters in order to have a correct configuration
file.
A more detailed description of the parameters is in :doc:`configuration`
section.
Restraints & project conversion
-------------------------------
Build infrastructure
--------------------
Running ARIA
============
This diff is collapsed.
......@@ -7,11 +7,9 @@
"doc": "docs"
},
"scripts": {
"precommit": "conventional-changelog -i CHANGELOG.md -s -r 0",
"precommit": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"test": "echo \"Error: no test specified\" && exit 1",
"commitmsg": "commitlint -e $GIT_PARAMS",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
"commitmsg": "commitlint -e $GIT_PARAMS"
},
"repository": {
"type": "git",
......@@ -27,6 +25,7 @@
},
"dependencies": {
"@hutson/semantic-delivery-gitlab": "^9.0.4",
"conventional-changelog-angular": "^5.0.3",
"conventional-changelog-cli": "^2.0.21"
}
}
......@@ -128,7 +128,7 @@ class AriaEcContactMap(object):
mergecontactmap = mergemaps.get("maplot")
for mapname, mapt in self.allresmap.keys():
if mapt != self.reftype:
# TODO: DON'T WORK !!!!
# TODO: DOESN'T WORK !!!!
LOG.info("Merging %s with %s map",
mergetype, mapt)
up_map = self.allresmap[mapt]["maplot"]
......@@ -191,11 +191,14 @@ class AriaEcContactMap(object):
cmpmap.write_contacts(mapname,
scoremap=scoremap,
outdir=outdir)
cmpmap.compare_contactmap(refmap, cmplist, prefix,
cmpmap.compare_contactmap(refmap, cmplist,
prefix if prefix else "cmp",
distmap=self.refmap["distmap"],
human_idx=True,
outdir=outdir)
refmap.compareplot(cmpmap, outprefix=prefix,
LOG.info(prefix)
refmap.compareplot(cmpmap,
outprefix=prefix if prefix else "ref",
outdir=outdir,
save_fig=self.settings.maplot.config.get(
"save_fig"),
......
......@@ -490,7 +490,7 @@ class ProteinMap(Map):
Parameters
----------
outdir :
param outprefix: (Default value = '')
param outprefix: (Default value = 'protein')
size_fig :
param plot_ext: (Default value = 10)
plot_dpi :
......@@ -2470,16 +2470,6 @@ class MapFilter(object):
"""
# TODO: utiliser self.clash_dict au lieu de meta_clash
"""
:param clash_dict:
:param desc_dict:
:param contactlist:
:param outdir:
:param outprefix:
:param clashlist:
:param human_idx:
"""
meta_clash = {
"cons": {
"flag": 888, "msg": "", "warn": "",
......
......@@ -31,7 +31,7 @@ from __future__ import absolute_import, division, print_function
# from . import core.Settings as Settings
from . import Settings as Settings
from .ariabase import *
from .xmlutils import XMLBasePickler, safe_elt
from .xmlutils import XMLBasePickler
from .xmlutils import XMLElement
......@@ -370,7 +370,7 @@ class AnalyserXMLPickler(XMLBasePickler):
s['prosa_enabled'] = str(e.prosa.enabled)
s['cns_analyses'] = str(e.structures_analysis.enabled)
if safe_elt(e, 'clashlist'):
if hasattr(e, 'clashlist'):
s['clashlist_executable'] = str(e.clashlist.executable)
s['clashlist_enabled'] = str(e.clashlist.enabled)
else:
......
......@@ -29,9 +29,9 @@
from __future__ import absolute_import
# from .ariabase import AriaBaseClass
# from .TypeChecking import is_type, check_elements, LIST, TUPLE
# from .xmlutils import *
# from .tools import last_traceback
from .TypeChecking import is_type, check_elements, LIST, TUPLE
from .xmlutils import *
from .tools import last_traceback
from .ariabase import *
from .xmlutils import *
......@@ -230,10 +230,12 @@ class AriaXMLContentHandler(XMLContentHandler):
e : {:py:class:`dict`, :py:class:`.xmlutils.XMLElement`}
python structure or raw xml element related to ``name``
"""
# TODO: try to avoid this kind of except catch. For the moment, the
# pickler will not work if we catch only several errors like
# AttributeError or XMLTageError
try:
pickler = getattr(self.sub_pickler, name)
except AttributeError:
except:
return e
return pickler.load_from_element(e)
......
......@@ -101,7 +101,7 @@ class AssignmentXMLPickler(xmlutils.XMLBasePickler):
# TODO: move to unpickler for version 1.1
if xmlutils.safe_elt(e, 'assignment_type'):
if hasattr(e, 'assignment_type'):
type = str(e.assignment_type)
else:
type = ASSIGNMENT_TYPE_MANUAL
......@@ -109,4 +109,4 @@ class AssignmentXMLPickler(xmlutils.XMLBasePickler):
return Assignment(atoms, type)
Assignment._xml_state = AssignmentXMLPickler()._xml_state
\ No newline at end of file
Assignment._xml_state = AssignmentXMLPickler()._xml_state
......@@ -27,7 +27,7 @@
"""
from .ariabase import AriaBaseClass
from .xmlutils import XMLElement, XMLBasePickler, safe_elt
from .xmlutils import XMLElement, XMLBasePickler
from . import Settings as Settings
from . import TypeChecking as TCheck
......@@ -394,7 +394,7 @@ class ContributionAssignerXMLPickler(XMLBasePickler):
s['weight_cutoff'] = float(e.weight_threshold)
s['max_contributions'] = int(e.max_contributions)
if safe_elt(e, 'exponent'):
if hasattr(e, 'exponent'):
s['exponent'] = int(e.exponent)
else:
s['exponent'] = 6
......
......@@ -28,7 +28,7 @@
from .ariabase import AriaBaseClass
from .xmlutils import XMLBasePickler, safe_elt
from .xmlutils import XMLBasePickler
from .tools import as_tuple
from . import TypeChecking as TCheck
......@@ -505,7 +505,7 @@ class CrossPeakXMLPickler(XMLBasePickler):
p = CrossPeak(number, volume, intensity)
reliable = e.reliable
if safe_elt(e, 'ambiguity'):
if hasattr(e, 'ambiguity'):
a = str(e.ambiguity)
if not a:
a = None
......@@ -531,7 +531,7 @@ class CrossPeakXMLPickler(XMLBasePickler):
for dim, attr in d.items():
if not safe_elt(e, dim): continue
if not hasattr(e, dim): continue
dd = getattr(e, dim)
......
......@@ -29,7 +29,7 @@
from .ariabase import *
from .Settings import Settings
from .xmlutils import XMLElement, XMLBasePickler, safe_elt
from .xmlutils import XMLElement, XMLBasePickler
DATA_DEFAULT = 'default'
......@@ -1752,7 +1752,7 @@ class AnnealingParametersXMLPickler(XMLBasePickler):
[f(p) for p in as_tuple(e.rdc_restraints)]
# BARDIAUX 2.2
if safe_elt(e, 'symmetry_restraints'):
if hasattr(e, 'symmetry_restraints'):
[f(p) for p in as_tuple(e.symmetry_restraints)]
else:
......@@ -1762,28 +1762,28 @@ class AnnealingParametersXMLPickler(XMLBasePickler):
[f(p) for p in as_tuple(z)]
# BERNARD 2.3
if safe_elt(e, 'logharmonic_potential'):
if hasattr(e, 'logharmonic_potential'):
[f(p) for p in as_tuple(e.logharmonic_potential)]
else:
z = LogHarmonicParameters()
z.reset()
[f(p) for p in as_tuple(z)]
if safe_elt(e, 'rama_potential'):
if hasattr(e, 'rama_potential'):
[f(p) for p in as_tuple(e.rama_potential)]
else:
z = RamaParameters()
z.reset()
[f(p) for p in as_tuple(z)]
if safe_elt(e, 'hbdb_potential'):
if hasattr(e, 'hbdb_potential'):
[f(p) for p in as_tuple(e.hbdb_potential)]
else:
z = HBDBParameters()
z.reset()
[f(p) for p in as_tuple(z)]
if safe_elt(e, 'scoring'):
if hasattr(e, 'scoring'):
[f(p) for p in as_tuple(e.scoring)]
else:
z = ScoringParameters()
......@@ -1867,7 +1867,10 @@ class FileFormatXMLPickler(DataContainerXMLPickler):
s['format'] = str(e.format)
s['ccpn_id'] = safe_elt(e, "ccpn_id", "")
if hasattr(e, 'ccpn_id'):
s['ccpn_id'] = str(e.ccpn_id)
else:
s['ccpn_id'] = ''
return s
......@@ -1881,7 +1884,7 @@ class SimpleDCXMLPickler(FileFormatXMLPickler):
e.enabled = x['enabled']
enabled = safe_elt(e, 'enabled') and x['enabled'] == YES
enabled = hasattr(e, 'enabled') and x['enabled'] == YES
if enabled and e.format == 'ccpn' and e.ccpn_id == '':
self.error(ValueError,
......@@ -2068,7 +2071,7 @@ class ShiftDataXMLPickler(FFP):
x = FFP.load_from_element(self, e)
x['default_shift_error'] = float(e.default_shift_error)
if safe_elt(e, 'use_shift_error'):
if hasattr(e, 'use_shift_error'):
x['use_shift_error'] = str(e.use_shift_error)
else:
x['use_shift_error'] = YES
......@@ -2123,7 +2126,11 @@ class PeakDataXMLPickler(FFP):
s['volume_or_intensity'] = str(e.peak_size)
s['lower_bound_correction'] = e.lower_bound_correction
s['upper_bound_correction'] = e.upper_bound_correction
s['use_bounds'] = e.use_bounds if safe_elt(e, 'use_bounds') else NO
if hasattr(e, 'use_bounds'):
s['use_bounds'] = e.use_bounds
else:
s['use_bounds'] = NO
return s
......@@ -2189,22 +2196,22 @@ class DistanceDataXMLPickler(BASE):
def load_from_element(self, e):
s = BASE.load_from_element(self, e)
if safe_elt(e, 'add_to_network'):
if hasattr(e, 'add_to_network'):
s['add_to_network'] = str(e.add_to_network)
else:
s['add_to_network'] = NO
if safe_elt(e, 'calibrate'):
if hasattr(e, 'calibrate'):
s['calibrate'] = str(e.calibrate)
else:
s['calibrate'] = NO
if safe_elt(e, 'run_network_anchoring'):
if hasattr(e, 'run_network_anchoring'):
s['run_network_anchoring'] = str(e.run_network_anchoring)
else:
s['run_network_anchoring'] = NO
if safe_elt(e, 'filter_contributions'):
if hasattr(e, 'filter_contributions'):
s['filter_contributions'] = str(e.filter_contributions)
else:
s['filter_contributions'] = NO
......@@ -2243,7 +2250,7 @@ class AmbiguousDistanceDataXMLPickler(DistanceDataXMLPickler):
def load_from_element(self, e):
s = DistanceDataXMLPickler.load_from_element(self, e)
if safe_elt(e, 'avg_exponent'):
if hasattr(e, 'avg_exponent'):
s['avg_exponent'] = int(e.avg_exponent)
else:
s['avg_exponent'] = 6
......@@ -2274,17 +2281,17 @@ class AmbiguousDistanceDataXMLPickler(DistanceDataXMLPickler):
# def load_from_element(self, e):
# s = BASE.load_from_element(self, e)
# if safe_elt(e, 'add_to_network'):
# if hasattr(e, 'add_to_network'):
# s['add_to_network'] = str(e.add_to_network)
# else:
# s['add_to_network'] = NO
# if safe_elt(e, 'calibrate'):
# if hasattr(e, 'calibrate'):
# s['calibrate'] = str(e.calibrate)
# else:
# s['calibrate'] = NO
# if safe_elt(e, 'filter_contributions'):
# if hasattr(e, 'filter_contributions'):
# s['filter_contributions'] = str(e.filter_contributions)
# else:
# s['filter_contributions'] = NO
......@@ -2340,7 +2347,7 @@ class UnambiguousDistanceDataXMLPickler(DistanceDataXMLPickler):
# def load_from_element(self, e):
# s = BASE.load_from_element(self, e)
# if safe_elt(e, 'add_to_network'):
# if hasattr(e, 'add_to_network'):
# s['add_to_network'] = str(e.add_to_network)
# else:
# s['add_to_network'] = NO
......@@ -2547,7 +2554,7 @@ class SSBondDataXMLPickler(BASE):
s = BASE.load_from_element(self, e)
from .tools import as_tuple
if safe_elt(e, 'cyspatch'):
if hasattr(e, 'cyspatch'):
[s['cyspatch'].append(x) for x in as_tuple(e.cyspatch)]
else:
s['cyspatch'] = []
......@@ -2580,7 +2587,7 @@ class ExperimentDataXMLPickler(DataContainerXMLPickler):
s = DataContainerXMLPickler.load_from_element(self, e)
if safe_elt(e, 'ambiguity_type'):
if hasattr(e, 'ambiguity_type'):
s['ambiguity_type'] = str(e.ambiguity_type)
else:
s['ambiguity_type'] = 'intra'
......@@ -2643,25 +2650,25 @@ class SpectrumDataXMLPickler(DataContainerXMLPickler):
s['trust_assigned_peaks'] = str(e.trust_assigned_peaks)
# BARDIAUX 2.2
if safe_elt(e, 'structural_rules'):
if hasattr(e, 'structural_rules'):
s['structural_rules_enabled'] = str(e.structural_rules)
else:
s['structural_rules_enabled'] = NO
# BARDIAUX 2.2
if safe_elt(e, 'filter_diagonal_peaks'):
if hasattr(e, 'filter_diagonal_peaks'):
s['filter_diagonal_peaks'] = e.filter_diagonal_peaks
else:
s['filter_diagonal_peaks'] = NO
# BARDIAUX 2.2
if safe_elt(e, 'filter_unassigned_peaks'):
if hasattr(e, 'filter_unassigned_peaks'):
s['filter_unassigned_peaks'] = e.filter_unassigned_peaks
else:
s['filter_unassigned_peaks'] = NO
# BARDIAUX 2.2
if safe_elt(e, 'experiment_data'):
if hasattr(e, 'experiment_data'):
s['experiment_data'] = e.experiment_data
else:
exp = ExperimentData()
......@@ -2778,7 +2785,7 @@ class SymmetryXMLPickler(DataContainerXMLPickler):
x['ncs_enabled'] = str(e.ncs_enabled)
x['packing_enabled'] = str(e.packing_enabled)