diff --git a/ariaec/econverter.py b/ariaec/econverter.py index 12cb50b26b678082796509f45d005ac70456dc6c..43be5f89898b9a038cfe9e02ce993901cd2590fc 100644 --- a/ariaec/econverter.py +++ b/ariaec/econverter.py @@ -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) diff --git a/ariaec/econverter.pyc b/ariaec/econverter.pyc index 6bbbd21a23bd32173f036d4b551e8226d50e9e95..e26b3b94245c0af6e890d9401b7cd155d7e93ef7 100644 Binary files a/ariaec/econverter.pyc and b/ariaec/econverter.pyc differ diff --git a/ariaec/maplot.py b/ariaec/maplot.py index e6e84fab151fbf919d676333259435d66d4ed814..faf3c25ce7136d7ab19fd7b594e9c75a047f0570 100644 --- a/ariaec/maplot.py +++ b/ariaec/maplot.py @@ -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 diff --git a/ariaec/maplot.pyc b/ariaec/maplot.pyc index 9485feeaeea2116ee0f066de2f444a57e1df944f..87aacf7ef15a713f3eee8a8d13dd536a03ee12be 100644 Binary files a/ariaec/maplot.pyc and b/ariaec/maplot.pyc differ diff --git a/ariaec/protmap.py b/ariaec/protmap.py index 2c4d6c4bf219f013a0186828bb54be3b85e977ff..e7770cdf0f32226debd6dabab5b9b6a2adb764c8 100644 --- a/ariaec/protmap.py +++ b/ariaec/protmap.py @@ -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) diff --git a/ariaec/protmap.pyc b/ariaec/protmap.pyc index 54569b1adf071f90fae56777a2dd4412ab5688a0..8db6c48e6cb3a4ed54deb7dbb53520b93340ab44 100644 Binary files a/ariaec/protmap.pyc and b/ariaec/protmap.pyc differ diff --git a/ariaec/setup.py b/ariaec/setup.py index 3ef69fc732e5ef276a21a7399ef55bccb301bed0..1f7ebb4eb3004ec4424a023b4d3cf9785f2e6b7c 100644 --- a/ariaec/setup.py +++ b/ariaec/setup.py @@ -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) diff --git a/ariaec/setup.pyc b/ariaec/setup.pyc index 2c203fc610f2eb1c46dc83d36a578f3c6613219d..d391fe1f93828eeb4157994a6c5b300272ec3926 100644 Binary files a/ariaec/setup.pyc and b/ariaec/setup.pyc differ