Commit 5978a311 authored by fabrice's avatar fabrice
Browse files

Reorganized/renamed output files in setup section

parent 9d6b5728
No preview for this file type
......@@ -7,7 +7,7 @@ ariaproject_template:
[contactdef]
; Contact definition section used to define contactmap from pdb file
default_cutoff: 7.0
default_cutoff: 8.0
; Add contact cutoff folowwing the syntax atm1_atm2
;ca_ca: 7.0
;cb_cb: 7.0
......@@ -71,8 +71,8 @@ nd_control: 0
runid: 1
cpus: 100
host_command: sbatch --cores-per-socket=10 -o /baycells/home/fallain/slurm.errors
working_directory: data/examples/out/aria_wd
temp_root: data/examples/out/aria_tmp
working_directory: data/examples/out/setup
temp_root: data/examples/out/setup
parameter_definition: automatic
ss_dist_format: tbl
ss_dist_enabled: yes
......@@ -106,7 +106,7 @@ md_parameters_random_seed: 89764443
md_parameters_steps_high: 10000
md_parameters_steps_cool1: 5000
md_parameters_steps_cool2: 4000
iteration_n_structures: 100
iteration_n_structures: 1000
iteration_n_best_structures: 15
iteration_n_kept_structures: 0
merging_method: standard
......
......@@ -353,7 +353,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
def __init__(self, settings):
self.restraint_list = []
self.settings = settings
self.outprefix = ""
self.protname = ""
super(AriaEcXMLConverter, self).__init__()
def targetdistmap(self, distype, sequence, distfile=None, groupby=None):
......@@ -605,7 +605,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
}
}
xml_file = self.settings.infra["xml"] + "/" + "_".join((
self.outprefix, listname)) + ".xml"
self.protname, listname)) + ".xml"
self.write_dist_xml(restraint_dict, xml_file)
return xml_file, pair_list
......@@ -631,11 +631,11 @@ class AriaEcXMLConverter(AriaXMLConverter):
:param hbmap: Extra hbond map (eg: metapsicov hbonds)
:return:
"""
dihed_file = os.path.join(self.settings.infra["tbl"], self.outprefix +
dihed_file = os.path.join(self.settings.infra["tbl"], self.protname +
"_dihed.tbl")
hb_file = os.path.join(self.settings.infra["tbl"], self.outprefix +
hb_file = os.path.join(self.settings.infra["tbl"], self.protname +
"_hbond.tbl")
ssdist_file = os.path.join(self.settings.infra["tbl"], self.outprefix +
ssdist_file = os.path.join(self.settings.infra["tbl"], self.protname +
"_ssdist.tbl")
self.write_dihedral_tbl(protein.sec_struct.ss_matrix, dihed_file)
self.write_hb_tbl(protein, hb_file,
......@@ -649,7 +649,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
return {'hbond': hb_file, 'dihed': dihed_file, 'ssdist': ssdist_file}
def write_xmlseq(self, seqpath):
xml_file = os.path.join(self.settings.infra["xml"], self.outprefix +
xml_file = os.path.join(self.settings.infra["xml"], self.protname +
".xml")
m = aria.conversion.MoleculeSettings()
......@@ -660,12 +660,12 @@ class AriaEcXMLConverter(AriaXMLConverter):
m['segid'] = ' '
m['first_residue_number'] = 1
m['naming_convention'] = ''
m['name'] = self.outprefix
m['name'] = self.protname
c = aria.conversion.ConverterSettings()
c.reset()
c['molecule'] = m
c['project_name'] = self.outprefix
c['project_name'] = self.protname
converter = aria.conversion.Converter()
converter.setSettings(c)
......@@ -710,7 +710,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
temp_root = os.path.abspath(aria_project_dict['temp_root'])
if not os.path.exists(work_dir) or not os.path.exists(temp_root):
logger.warning("Working dir %s and temp directory %s doesn't exist." % (
logger.info("Working dir %s and temp directory %s doesn't exist." % (
work_dir, temp_root))
logger.info("Create new directory %s" % work_dir)
os.makedirs(work_dir)
......@@ -719,21 +719,21 @@ class AriaEcXMLConverter(AriaXMLConverter):
for direct in (work_dir, temp_root):
if not os.path.exists(os.path.join(direct, self.outprefix)):
os.makedirs(os.path.join(direct, self.outprefix))
if not os.path.exists(os.path.join(direct, self.protname)):
os.makedirs(os.path.join(direct, self.protname))
if not os.path.exists(os.path.join(direct, self.outprefix, desc)):
os.makedirs(os.path.join(direct, self.outprefix, desc))
if not os.path.exists(os.path.join(direct, self.protname, desc)):
os.makedirs(os.path.join(direct, self.protname, desc))
work_dir = os.path.join(work_dir, self.outprefix, desc)
temp_root = os.path.join(temp_root, self.outprefix, desc)
work_dir = os.path.join(work_dir, self.protname, desc)
temp_root = os.path.join(temp_root, self.protname, desc)
aria_project_dict['working_directory'] = work_dir
aria_project_dict['temp_root'] = temp_root
project = {'project_name': self.outprefix,
project = {'project_name': "_".join((self.protname, desc)),
'date': datetime.date.today().isoformat(),
'file_root': self.outprefix}
'file_root': "_".join((self.protname, desc))}
aria_project_dict.update(project)
data_molecule = {'molecule_file': seqfile}
......@@ -792,7 +792,7 @@ class AriaEcXMLConverter(AriaXMLConverter):
else:
aria_project_dict['n_cpus'] = '20'
proj_file = "%s/%s_%s_aria_project.xml" % (work_dir, self.outprefix, desc)
proj_file = "%s/ariaproject.xml" % work_dir
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)
No preview for this file type
......@@ -25,6 +25,7 @@ class AriaEcContactMap(object):
self.outprefix = ''
self.allresmap = {}
self.refmap = None
self.refname = None
self.reftype = ''
def run(self):
......@@ -69,18 +70,19 @@ class AriaEcContactMap(object):
logger.info("%s map set as reference" % fo.filetype.capitalize())
self.refmap = fo.mapdict
self.reftype = fo.filetype
self.refname = fo.filename
if not self.settings.contactmap.args.get("nofilter"):
self.filter(fo.mapdict, fo.filetype, fo.contactlist,
self.protein, clashlist=fo.clashlist,
outprefix=self.outprefix,
outdir=self.settings.outdir)
else:
# Use only position filter
self.filter(fo.mapdict, fo.filetype, fo.contactlist,
self.protein, clashlist=fo.clashlist,
outprefix=self.outprefix,
outdir=self.settings.outdir, mapfilters="pos")
self.allresmap[fo.filetype] = fo.mapdict
# else:
# Use only position filter
# self.filter(fo.mapdict, fo.filetype, fo.contactlist,
# self.protein, clashlist=fo.clashlist,
# protname=self.protname,
# outdir=self.settings.outdir, mapfilters="pos")
self.allresmap[(fo.filename, fo.filetype)] = fo.mapdict
try:
refmap = self.refmap["contactmap"]
......@@ -104,10 +106,10 @@ class AriaEcContactMap(object):
# Combine merge maps with other maps
mergelist = self.settings.contactmap.args.get("merge")
for mergetype in mergelist:
if mergetype in self.allresmap:
if mergetype in zip(self.allresmap.keys())[0]:
mergemaps = self.allresmap.pop(mergetype)
mergecontactmap = mergemaps.get("contactmap")
for mapt in self.allresmap.keys():
for mapname, mapt in self.allresmap.keys():
if mapt != self.reftype:
# TODO: DON'T WORK !!!!
logger.info("Merging %s with %s map" % (
......@@ -118,18 +120,20 @@ class AriaEcContactMap(object):
self.allresmap[mergekey] = {}
self.allresmap[mergekey]["contactmap"] = up_map
for mapt in self.allresmap.keys():
for mapname, mapt in self.allresmap.keys():
prefix = "_".join((self.outprefix, mapt, self.reftype))
if mapt == self.reftype and not \
self.settings.contactmap.args.get("onlyreport", False):
prefix = "_".join((self.outprefix, mapname, self.refname))
if mapname == self.refname:
continue
if self.settings.contactmap.args.get("onlyreport", False):
refmap.write_contacts("_".join((self.outprefix, mapt)),
outdir=outdir,
scoremap=self.refmap.get("scoremap",
None))
continue
scoremap = self.allresmap[mapt].get('scoremap', None)
scoremap = self.allresmap[(mapname, mapt)].get('scoremap', None)
# if self.allresmap[mapt].get("contactmap") is not None and \
# self.allresmap[mapt].get("scoremap") is not None:
# Get top contact map/list
......@@ -139,8 +143,9 @@ class AriaEcContactMap(object):
# 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(
cmpmap = self.allresmap[(mapname, mapt)]["contactmap"]
cmplist = self.allresmap[(mapname, mapt)][
'contactmap'].contact_list(
human_idx=True)
# else:
# logger.warning("%s map doesn't have any score related. Can't "
......
No preview for this file type
......@@ -281,26 +281,26 @@ class ProteinMap(Map):
for i, flag in enumerate(flags):
conlist = [contact for contact in protmap.contact_flags if
protmap.contact_flags[contact] == flag]
xind = [x + .5 for x in
xind = [x - .5 for x in
zip(*conlist)[0] + zip(*conlist)[1]]
yind = [ymax - y + .5 for y in
yind = [ymax - y + 1.5 for y in
zip(*conlist)[1] + zip(*conlist)[0]]
color = pal[i]
mark = Line2D.filled_markers[i]
for x, y in zip(xind, yind):
self.maplot.axes.scatter(x, y, s=20, c=color,
self.maplot.axes.scatter(x, y, s=10, c=color,
linewidths=0, alpha=alpha,
marker=mark)
else:
xind = [x + .5 for x in
xind = [x - .5 for x in
zip(*cmplist)[0] + zip(*cmplist)[1]]
yind = [ymax - y + .5 for y in
yind = [ymax - y + 1.5 for y in
zip(*cmplist)[1] + zip(*cmplist)[0]]
color = "red"
# width = [0.3 for _ in xind]
# for x, y, h in zip(xind, yind, width):
for x, y in zip(xind, yind):
self.maplot.axes.scatter(x, y, s=20, c=color, linewidths=0,
self.maplot.axes.scatter(x, y, s=10, c=color, linewidths=0,
alpha=alpha)
if save_fig:
self.saveplot(**kwargs)
......@@ -804,7 +804,7 @@ class MapFilter:
self.settings["nd_alpha"],
self.settings["nd_control"]))
logger.warning("Not fully implemented !!")
logger.info(net_deconv(mapdict["contactmap"].as_matrix()))
# 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.
......@@ -1230,7 +1230,8 @@ class MapFilter:
for flt in ("nd", "pos", "cons", "ssclash", "cys"):
out.write('''
{filter_desc}
{hd}'''.format(filter_desc=meta_clash[flt]["desc"].capitalize(),
{hd}
'''.format(filter_desc=meta_clash[flt]["desc"].capitalize(),
hd="=" * len(meta_clash[flt]["desc"])))
if meta_clash[flt].get("warn"):
......
No preview for this file type
......@@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function
import os
import re
import logging
import os.path
import collections
import scipy.spatial.distance as distance
from .base import sort_2dict
......@@ -21,6 +22,7 @@ class RegexFile(object):
self.sort = sort
self.filepath = filepath
self.filetype = filetype
self.filename = os.path.basename(os.path.splitext(filepath)[0])
self.lines = {}
def load(self):
......
No preview for this file type
......@@ -54,7 +54,7 @@ class AriaEcSetup:
# -------------------------------------------------------------------- #
self.outprefix = get_filename(self.settings.setup.args.get("seq",
None))
self.converter.outprefix = self.outprefix
self.converter.protname = self.outprefix
# ------------------------- Load sequence ---------------------------- #
self.protein.set_aa_sequence(self.settings.setup.args.get("seq", None))
# -------------- Load secondary structure prediction ----------------- #
......@@ -82,7 +82,7 @@ class AriaEcSetup:
# s'applique sur l'humanidx contenant les residus)
self.filter(fo.mapdict, fo.filetype, fo.contactlist, self.protein,
clashlist=fo.clashlist, outprefix=self.outprefix,
outdir=self.settings.outdir)
outdir=self.settings.infra.get("others", ''))
self.allresmap[fo.filetype] = fo.mapdict
if fo.filetype != "pdb" and "pdb" in self.allresmap:
......
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