Commit 29f95816 authored by fabrice's avatar fabrice
Browse files

Moving nb_c selection criteria in mapfilter object

parent 57556cc5
......@@ -609,13 +609,13 @@ class AriaEcXMLConverter(AriaXMLConverter):
self.write_dist_xml(restraint_dict, xml_file)
return xml_file, pair_list
def write_maplist_restraints(self, maplist, nb_c, targetmap):
def write_maplist_restraints(self, maplist, targetmap):
out = ([], [])
for maptype in maplist:
logger.info("Writing %s ARIA XML distance restraints" % maptype)
outfile, pairlist = self.write_map_restraint(
maplist[maptype]['contactmap'], nb_c,
maplist[maptype]['contactmap'], maplist[maptype]["nb_c"],
targetmap, listname=maptype,
scoremap=maplist[maptype].get("scoremap"))
out[0].append(outfile)
......
No preview for this file type
......@@ -88,8 +88,8 @@ class AriaEcContactMap(object):
logger.error("First contact map should be a valid file")
sys.exit(1)
nb_c = int(len(self.protein.aa_sequence.sequence) *
self.settings.setup.config.get("n_factor"))
# nb_c = int(len(self.protein.aa_sequence.sequence) *
# self.settings.setup.config.get("n_factor"))
plotparams = {k: self.settings.contactmap.config.get(k, None)
for k in ('size_fig', 'plot_ext', 'plot_dpi')}
outdir = self.settings.outdir
......@@ -109,8 +109,11 @@ class AriaEcContactMap(object):
mergecontactmap = mergemaps.get("contactmap")
for mapt in self.allresmap.keys():
if mapt != self.reftype:
# TODO: DON'T WORK !!!!
logger.info("Merging %s with %s map" % (
mergetype, mapt))
up_map = self.allresmap[mapt]["contactmap"]
up_map[:] = up_map.add(mergecontactmap)
up_map[:] = up_map[:] + mergecontactmap[:]
mergekey = "%s_%s" % (mapt, mergetype)
self.allresmap[mergekey] = {}
self.allresmap[mergekey]["contactmap"] = up_map
......@@ -127,29 +130,22 @@ class AriaEcContactMap(object):
continue
scoremap = self.allresmap[mapt].get('scoremap', None)
if self.allresmap[mapt].get("contactmap") is not None and \
self.allresmap[mapt].get("scoremap") is not None:
if not self.settings.contactmap.args.get("nofilter"):
# Get top contact map/list
cmpmap = self.allresmap[mapt]["contactmap"].topmap(
self.allresmap[mapt]["scoremap"], nb_c)
cmplist = self.allresmap[mapt]['scoremap'].sortedset(
human_idx=True)[:nb_c]
else:
cmpmap = self.allresmap[mapt]["contactmap"]
cmplist = self.allresmap[mapt]['scoremap'].sortedset(
human_idx=True)
elif self.allresmap[mapt].get("contactmap") is not None:
# If no score given, use all contact list
cmpmap = self.allresmap[mapt]["contactmap"]
cmplist = self.allresmap[mapt]['contactmap'].contact_list(
human_idx=True)
else:
logger.warning("%s map doesn't have any score related. Can't "
"define top list related to this map" % mapt)
continue
# if self.allresmap[mapt].get("contactmap") is not None and \
# self.allresmap[mapt].get("scoremap") is not None:
# Get top contact map/list
# cmpmap = self.allresmap[mapt]["contactmap"].topmap(
# self.allresmap[mapt]["scoremap"], nb_c)
# cmplist = self.allresmap[mapt]['scoremap'].sortedset(
# human_idx=True)[:nb_c]
# elif self.allresmap[mapt].get("contactmap") is not None:
# If no score given, use all contact list
cmpmap = self.allresmap[mapt]["contactmap"]
cmplist = self.allresmap[mapt]['contactmap'].contact_list(
human_idx=True)
# else:
# logger.warning("%s map doesn't have any score related. Can't "
# "define top list related to this map" % mapt)
# continue
# TODO: only one function for output files
# Write contact list in txt file
......
No preview for this file type
......@@ -1154,13 +1154,23 @@ class MapFilter:
outprefix=outprefix, clashlist=clashlist)
# Contactmap always filtered
# TODO: could set a treshold instead of n_factor
nb_c = int(len(mapdict["contactmap"].sequence) * int(
self.settings.get("n_factor")))
nb_c = nb_c if nb_c < len(mapdict["contactmap"].contactset()) else len(
mapdict["contactmap"].contactset())
mapdict["nb_c"] = nb_c
logger.info("Update %s contactmap" % mtype)
mapdict["contactmap"].remove(clash_list)
if mapdict["scoremap"] is not None:
logger.info("Update %s scoremap" % mtype)
mapdict["scoremap"].remove(clash_list)
# Get nb_c top maps
logger.info("Select top %d contacts according to scoremap" % nb_c)
mapdict["contactmap"] = mapdict["contactmap"].topmap(mapdict["scoremap"],
nb_c)
if mapdict["distmap"] is not None:
logger.info("Update %s distmap" % mtype)
mapdict["distmap"].remove(clash_list)
......
No preview for this file type
......@@ -152,10 +152,11 @@ class AriaEcSetup:
# --------------------------- XML restraints ------------------------- #
# Setting contact number limit for map restraints (native, ec, ...)
nb_c = int(len(self.protein.aa_sequence.sequence) *
self.settings.setup.config.get("n_factor"))
# nb_c = int(len(self.protein.aa_sequence.sequence) *
# self.settings.setup.config.get("n_factor"))
dist_files, pair_lists = self.converter.write_maplist_restraints(
self.allresmap, nb_c, self.targetmap)
self.allresmap, self.targetmap)
# --------------------------- XML SEQ file --------------------------- #
seq_file = self.converter.write_xmlseq(self.protein.seqfile_path)
......
No preview for this file type
Supports Markdown
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