Commit d5b75029 authored by Fabrice Allain's avatar Fabrice Allain
Browse files

Updated formatting function for setting parser (try to get absolute path if file field)

parent 3696334e
# Created by .ignore support plugin (hsz.mobi)
.venv
data/examples
.idea
\ No newline at end of file
.idea
data/
......@@ -124,11 +124,14 @@ def format_str(string):
elif re.search(r"^[\s\d-]+\.\d+\s*$", string):
return float(string)
elif re.search(r'^".+"$', string):
# remove " characters
return string[1:-1]
elif "," in string:
return string.split(',')
elif "+" in string:
return string.split('+')
elif "/" in string and os.path.exists(string):
return os.path.abspath(string)
elif re.search(r"[/\w]+", string):
return string
else:
......@@ -154,7 +157,8 @@ def format_dict(indict):
:return:
"""
for key in indict:
indict[key] = format_str(indict[key])
if type(indict[key]) == str:
indict[key] = format_str(indict[key])
return indict
......
No preview for this file type
......@@ -8,6 +8,7 @@ import os
import logging
import argparse as argp
from .base import format_dict
from .ecsettings import AriaEcSettings
from .maplot import AriaEcContactMap
from .econverter import AriaEcBbConverter
......@@ -203,7 +204,7 @@ class AriaEcCommand(object):
parser.add_argument("--merge", nargs="+", dest="merge",
choices=self.contact_types,
help="Merge given contact types with other maps")
parser.add_argument("--filter", dest="nofilter", action="store_true",
parser.add_argument("--filter", dest="filter", action="store_true",
default=False, help="Use contact list filter "
"and top n contacts selection")
parser.add_argument("--onlyreport", dest="onlyreport",
......@@ -242,10 +243,11 @@ class AriaEcCommand(object):
LOG.info("Updating settings with conf file")
settings.load_config(self.args.conf_file)
# Update settings associated to command section
LOG.info("Updating %s settings with args", self.args.command)
getattr(settings, self.args.command).args.update(self.args.__dict__)
LOG.info("Updating %s args settings", self.args.command)
getattr(settings, self.args.command).args.update(format_dict(self.args.__dict__))
LOG.debug(getattr(settings, self.args.command).args)
if self.args.output_directory:
LOG.info("Updating output directory")
LOG.info("Updating output directory %s", self.args.output_directory)
settings.infra = self.args.output_directory
return settings
......
No preview for this file type
......@@ -72,6 +72,7 @@ class Settings(object):
LOG.debug(config)
for section in config.sections():
if hasattr(self, section):
LOG.debug("Formatting items of %s section", section)
tmp = format_dict(dict(config.items(section)))
getattr(self, section).config.update(tmp)
LOG.debug("%s config updated", section)
......
No preview for this file type
......@@ -78,7 +78,11 @@ class AriaEcContactMap(object):
self.reftype = fo.filetype
self.refname = fo.filename if type(self.outprefix) != list \
else self.outprefix[idx]
if self.settings.contactmap.args.get("filter"):
if (self.settings.contactmap.args.get("filter") and idx != 0) or \
(self.settings.contactmap.args.get("filter")
and len(self.file_reader.filelist) == 1):
# Filtering all contactmap except the reference map
LOG.info("Filtering %s map", fo.filetype)
self.filter(fo.mapdict, fo.filetype, fo.contactlist,
self.protein, clashlist=fo.clashlist,
outprefix=self.outprefix[idx] if type(
......
No preview for this file type
......@@ -34,9 +34,9 @@ class AriaEcPdbqual(CommandProtocol):
for infile in self.settings.pdbqual["infiles"]:
if os.path.abspath(infile) != os.path.abspath(self.settings.pdbqual["output_directory"]):
shutil.copy(infile, self.settings.pdbqual["output_directory"])
LOG.info(self.settings.pdbqual["output_directory"])
QualityChecks.runChecks(
workingDirectory=os.path.abspath(
self.settings.pdbqual["output_directory"]),
workingDirectory=self.settings.pdbqual["output_directory"],
trashDirectory=self.settings.pdbqual["trash_directory"],
prosaOnOff=1 if self.settings.pdbqual["prosa"] else 0,
procheckExe=self.settings.main["procheck_executable"],
......@@ -52,8 +52,11 @@ class AriaEcPdbqual(CommandProtocol):
LOG.info("%s generated",
os.path.join(self.settings.pdbqual["output_directory"],
QualityChecks.FILENAME_REPORT))
LOG.info("Removing infile(s) in output directory")
LOG.info("Removing infile(s) in output directory %s", self.settings.pdbqual["output_directory"])
[os.remove(
os.path.join(os.path.abspath(self.settings.pdbqual["output_directory"]),
os.path.join(self.settings.pdbqual["output_directory"],
os.path.basename(infile)))
for infile in self.settings.pdbqual["infiles"]]
for infile in self.settings.pdbqual["infiles"]
if os.path.exists(os.path.join(
self.settings.pdbqual["output_directory"],
os.path.basename(infile)))]
No preview for this file type
......@@ -55,8 +55,8 @@ class CleanCommand(Command):
'./*.egg-info')
with open('README.rst') as f:
long_description = f.read()
# with open('README.rst') as f:
# long_description = f.read()
# with open('LICENSE') as f:
# license = f.read()
......@@ -72,7 +72,7 @@ setup(
author="Allain Fabrice",
author_email="fabrice.allain@pasteur.fr",
description="ARIA Evolutive Contact toolbox",
long_description=long_description,
# long_description=long_description,
# license="PSF",
# keywords="hello world example examples",
url="http://aria.pasteur.fr/", # project home page
......@@ -93,7 +93,6 @@ setup(
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :/home/raionic/Workspace/bis-aria/NEFparser/branches/fallain_branche/BMRB: 3.3',
'Programming Language :: Python :: 3.4',
],
......@@ -110,7 +109,8 @@ setup(
'matplotlib'],
install_requires=[
# 'configparser', # TODO: add this requiirement only if python v2
'configparser', # TODO: add this requiirement only if python v2
'Sphinx',
'docutils>=0.3',
'pandas',
'seaborn',
......
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