Commit 34b074a5 authored by fabrice's avatar fabrice

bug fixes when template or contactfilter fields are empty in ini file

parent 35d8304e
......@@ -7,10 +7,10 @@ ariaproject_template:
[contactdef]
; Contact definition section used to define contactmap from pdb file
default_cutoff: 8.0
ca_ca:
cb_cb:
sc_sc:
default_cutoff: 7.0
ca_ca: 7.0
cb_cb: 7.0
sc_sc: 5.0
; Add other contact cutoff below folowwing the syntax atm1_atm2
[setup]
......@@ -60,9 +60,10 @@ cb_upper_bound: 7.0
; ---------------------------- Filter parameters ----------------------------- #
; n_factor : Number of EC selected: n * n_factor (n: sequence length)
; contactfilter : all or combinaison of pos, cons, cys, ssclash, nd
; separated by "+" character [all]
; separated by "+" character [all]. If empty, use only position
; filter (avoid short range restraints)
n_factor: 1.0
contactfilter:
contactfilter: all
conservation_treshold: 95
position_treshold: 5
nd_beta: 0.99
......
......@@ -13,7 +13,7 @@ import os
import sys
import json
import re
import pkg_resources as pkgr
import aria.legacy.AminoAcid as AminoAcid
import aria.ConversionTable as ConversionTable
import aria.conversion
......@@ -127,6 +127,7 @@ reliable="{reliable}" list_name="{list_name}">
for contrib_id in restraint_dict[restraint_id]["contrib"]:
res_id = restraint_dict[restraint_id]["contrib"][contrib_id][
"spin_pair"].keys()
print(res_id)
xml_file.write('''\
<contribution id="{id}" weight="{weight}">
<spin_pair>
......@@ -500,7 +501,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
for contactidx, contact in enumerate(pair_list):
# /!\ humanidx in contact must start at 1 !n_factor
print(contact)
# Add neighbors if neigh_flag
resx_idx = range(min_ind(contact[0] - 1),
max_ind(contact[0] + 2, max_seqidx)) if \
......@@ -610,6 +611,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
}
xml_file = self.settings.infra["xml"] + "/" + "_".join((
self.outprefix, listname)) + ".xml"
print(restraint_dict)
self.write_dist_xml(restraint_dict, xml_file)
return xml_file, pair_list
......@@ -685,14 +687,20 @@ class AriaEcXMLConverter(AriaXMLConverter):
def write_project(self, aria_template, seqfile, dist_files, tbl_files,
desc=""):
template = os.path.abspath(aria_template)
if aria_template:
template = os.path.abspath(aria_template)
try:
t = open(template, 'r')
except IOError:
sys.exit("""Can't open "%s" file.""" % template)
try:
t = open(template, 'r')
except IOError:
sys.exit("""Can't open "%s" file.""" % template)
aria_project_template = t.read()
aria_project_template = t.read()
t.close()
else:
logger.info("Reading default aria template file %s" % self.settings.ARIAPROJ_TEMPLATE)
aria_project_template = pkgr.resource_string(
__name__, self.settings.ARIAPROJ_TEMPLATE)
aria_project_dict = {}
......@@ -794,5 +802,3 @@ class AriaEcXMLConverter(AriaXMLConverter):
with open(proj_file, 'w') as proj_xml:
logger.info("Writing ARIA project file (%s)" % proj_file)
proj_xml.write(aria_project_template % aria_project_dict)
t.close()
No preview for this file type
......@@ -946,8 +946,7 @@ class MapFilter:
if mapfilters == "all":
mapfilters = self.filter_types
elif not mapfilters:
logger.info("No filter with %s map!" % mtype)
return mapdict
mapfilters = ("pos",)
else:
mapfilters = [elm for elm in mapfilters if elm in self.filter_types]
logger.info("Filtering %s contact map" % mtype)
......
No preview for this file type
......@@ -154,8 +154,9 @@ class AriaEcSetup:
# ---------------------- ARIA XML project file ----------------------- #
aria_template = self.settings.main.config["ariaproject_template"] if \
self.settings.main.config["ariaproject_template"] and \
os.path.exists(self.settings.main.config["ariaproject_template"])\
else self.settings.template
else None
self.converter.write_project(aria_template,
seq_file, dist_files, tbl_files,
desc="_".join(sorted(self.allresmap.keys())))
......
No preview for this file type
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