Commit 02494b4e authored by fabrice's avatar fabrice
Browse files

Bug fixe: wrong conditionnal test when creating output directory

parent 232150ef
......@@ -59,16 +59,21 @@ ca_upper_bound: 7.0
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, net_deconv
; contactfilter : all or combinaison of pos, cons, cys, ssclash
; separated by "+" character [pos]. If empty, use only position
; filter (avoid short range restraints)
n_factor: 1.0
contactfilter: all
conservation_treshold: 95
position_treshold: 5
; nd_beta : eigenvalue scaling parameter for network deconvolution.
; Corresponding to propagation of indirect effects over
; longer indirect paths.
; nd_alpha : Network density parameter corresponding to the use of the
; full mutual information and direct information matrices
net_deconv: False
nd_beta: 0.99
nd_alpha: 1.0
nd_control: 0
; --------------------------- ARIA XML parameters ---------------------------- #
runid: 1
cpus: 100
......
......@@ -749,7 +749,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
work_dir = os.path.abspath(self.settings.outdir)
temp_root = os.path.abspath(aria_project_dict['temp_root'])
if not os.path.exists(work_dir) or not os.path.exists(temp_root):
if not os.path.exists(work_dir):
logger.info("Working dir %s doesn't exist." % work_dir)
logger.info("Create new directory %s" % work_dir)
os.makedirs(work_dir)
......
No preview for this file type
No preview for this file type
......@@ -18,7 +18,7 @@ import pandas as pd
import seaborn as sns
import numpy as np
import datetime
# from .ndconv import net_deconv
from .ndconv import net_deconv
from matplotlib import pyplot as plt
import aria.ConversionTable as ConversionTable
import aria.legacy.AminoAcid as AminoAcid
......@@ -767,6 +767,88 @@ class AtmMap(Map):
pass
class ProtMapCollections:
def __init__(self, settings):
self._alldistmap = None
self._allscoremap = None
self._allcontactmap = None
self._distmap = None
self._scoremap = None
self._contactmap = None
self.settings = settings
@property
def alldistmap(self):
"""
Atom level distance map.
:return:
"""
return self._alldistmap
@alldistmap.setter
def alldistmap(self, resatmap):
"""
Atom level distance map setter. The only way is to give resatmmap object
:param resatmap:
:type resatmap: ResAtmMap
:return:
"""
self._alldistmap = resatmap
@property
def allcontactmap(self):
"""
Atom level contact map. If alldistmap exists, return the contactmap
form
:return:
"""
if self._alldistmap:
# settings.contactdef.config
# settings.main.scsc_min_file
return self._alldistmap.contact_map(contactdef=self.settings[
"contactdef"], scsc_min=self.settings["scsc_min_file"])
else:
return self._allcontactmap
@allcontactmap.setter
def allcontactmap(self, resatmap):
"""
Atom level contact map setter
:param resatmap: binary res atm map
:return:
"""
self._allcontactmap = resatmap
@property
def allscoremap(self):
"""
Atom level score map
:return:
"""
return self._allscoremap
@allscoremap.setter
def allscoremap(self, resatmap):
"""
Atom level score map setter
:return:
"""
self._allscoremap = resatmap
@property
def distmap(self):
if self._alldistmap:
return self._alldistmap.reduce(groupby=self.settings[
"groupby_method"])
else:
return self._distmap
@distmap.setter
def distmap(self, resmap):
self._distmap = resmap
class MapFilter:
"""
Filter contactmap/distancemap
......@@ -776,11 +858,8 @@ class MapFilter:
cys-cys : unicity of ss contacts
ssclash : secondary structure conflict
"""
filter_types = ("nd", "pos", "cons", "ssclash", "cys")
filter_types = ("pos", "cons", "ssclash", "cys")
clash_dict = {
"nd": {
"clash": "nd",
"desc": "network deconvolution"},
"pos": {
"clash": "physical proximity",
"desc": "sequence position"},
......@@ -797,18 +876,17 @@ class MapFilter:
def __init__(self, settings):
self.settings = settings
def nd_filter(self, mapdict, **kwargs):
def nd_filter(self, mapdict):
# TODO: build ROC curve with number of top contacts as the parameter
logger.info("...Network deconvolution filter (alpha=%.2f, beta=%.2f, "
"control = %.2f)" % (self.settings["nd_beta"],
self.settings["nd_alpha"],
self.settings["nd_control"]))
logger.warning("Not fully implemented !!")
# logger.info(net_deconv(mapdict["contactmap"].as_matrix()))
# (if refmap given !!!!)
# To apply ND on regulatory networks, follow steps explained in
# Supplementary notes 1.4.1 and 2.1 and 2.3 of the paper.
return {'clash': None, 'desc': None}
logger.info("...Network deconvolution filter (alpha=%.2f, beta=%.2f)" %
(self.settings["nd_beta"], self.settings["nd_alpha"]))
scoremap = mapdict["scoremap"]
logger.info(net_deconv(mapdict["scoremap"].as_matrix(),
beta=self.settings["nd_beta"],
alpha=self.settings["nd_alpha"]))
# TODO: MAJ score map avec matrice obtenue !!!
# !!!! Verifier que scoremap est bien maj et UTILISEE !!
return scoremap
def pos_filter(self, mapdict, **kwargs):
"""
......@@ -1121,6 +1199,10 @@ class MapFilter:
mapfilters = self.settings.get("contactfilter") if mapfilters is None \
else mapfilters
if self.settings["net_deconv"]:
# TODO: maj scoremap ou maj mapcollection
mapdict["scoremap"] = self.nd_filter(mapdict)
if mapfilters == "all":
mapfilters = self.filter_types
elif not mapfilters:
......@@ -1171,6 +1253,8 @@ class MapFilter:
mapdict["scoremap"].remove(clash_list)
# Get nb_c top maps
logger.info("Select top %d contacts according to scoremap" % nb_c)
# TODO: deplacer cette partie dans l'appel de contactmap une fois
# la classe mapcollections utilisee
mapdict["contactmap"] = mapdict["contactmap"].topmap(mapdict["scoremap"],
nb_c)
if mapdict["distmap"] is not None:
......
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