Skip to content
Snippets Groups Projects
Commit 34b074a5 authored by fabrice's avatar fabrice
Browse files

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

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