Commit 231377a6 authored by Fabrice  ALLAIN's avatar Fabrice ALLAIN
Browse files

refactor: update project tree for conda

parent 119b70d2
This diff is collapsed.
#!/usr/bin/env bash
$PYTHON -m pip install --no-deps .
{% set data = load_setup_py_data() %}
package:
name: ariaec
version: {{ data['version'] }}
source:
path: ..
build:
# If the installation is complex, or different between Unix and Windows, use
# separate bld.bat and build.sh files instead of this key. Add the line
# "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or
# "skip: True # [not win]" to limit to Windows.
# script: python setup.py install --single-version-externally-managed --record=record.txt
# number: {{ environ.get('CI_PIPELINE_ID', 0) }}
requirements:
build:
- python
- setuptools
run:
- python
- # dependencies are defined in setup.py
{% for dep in data['install_requires'] %}
- {{ dep.lower() }}
{% endfor %}
test:
requires:
- bandit
- pylint
- pytest
- pytest-cov
imports:
- ariaec
about:
summary: "de Novo Ambiguous Restraints for Iterative Assignment"
home: https://gitlab.pasteur.fr/bis-aria/ariaec
# license: Proprietary
extra:
sphinx:
language: en
intersphinx:
# project: Parent URL of the "objects.inv" file
# coding=utf-8
"""
.. .......................................................................... ..
.. ARIA -- Ambiguous Restraints for Iterative Assignment ..
.. ..
.. A software for automated NOE assignment ..
.. ..
.. Version 2.3 ..
.. ..
.. ..
.. Copyright (C) Benjamin Bardiaux, Michael Habeck, Therese Malliavin, ..
.. Wolfgang Rieping, and Michael Nilges ..
.. ..
.. All rights reserved. ..
.. ..
.. NO WARRANTY. This software package is provided 'as is' without warranty of ..
.. any kind, expressed or implied, including, but not limited to the implied ..
.. warranties of merchantability and fitness for a particular purpose or ..
.. a warranty of non-infringement. ..
.. ..
.. Distribution of substantively modified versions of this module is ..
.. prohibited without the explicit permission of the copyright holders. ..
.. ..
.. $Author: bardiaux $ ..
.. $Revision: 1.1.1.1 $ ..
.. $Date: 2010/03/23 15:27:24 $ ..
.. .......................................................................... ..
"""
import re
import os
import sys
import subprocess
from aria.core import *
from os.path import dirname, isdir, join
VERSION_RE = re.compile('^Version: (.+)$', re.M)
def get_version(full=True):
"""
Returns
-------
"""
d = dirname(dirname(__file__))
# TODO: actually no warning when git command is not available !!
if isdir(join(d, '.git')):
# Get the version using "git describe".
cmd = 'git describe --tags'.split()
try:
version = subprocess.check_output(cmd).decode().strip()
except subprocess.CalledProcessError:
print('Unable to get version number from git tags')
sys.exit(1)
# PEP 386 compatibility
if '-' in version and full:
version = '.post'.join(version.split('-')[:2])
else:
version = version.split('-')[0]
# Don't declare a version "dirty" merely because a time stamp has
# changed. If it is dirty, append a ".dev1" suffix to indicate a
# development revision after the release.
with open(os.devnull, 'w') as fd_devnull:
subprocess.call(['git', 'status'],
stdout=fd_devnull, stderr=fd_devnull)
cmd = 'git diff-index --name-only HEAD'.split()
try:
dirty = subprocess.check_output(cmd).decode().strip()
except subprocess.CalledProcessError:
print('Unable to get git index status')
sys.exit(1)
if dirty != '' and full:
version += '.dev1'
else:
# Extract the version from the PKG-INFO file.
with open(join(d, 'PKG-INFO')) as foo:
version = VERSION_RE.search(foo.read()).group(1)
return version
This diff is collapsed.
# coding=utf-8
"""
ARIA CNS tool
"""
from __future__ import absolute_import, division, print_function
import re
import os
import time
import shutil
import logging
import subprocess
import tempfile as tmp
import argparse as argp
import pkg_resources as pkgr
from .conbox.common import CustomLogging
from .conbox.commands import CLI, ReadableDir
CNS_PATH = 'CNS_SOLVE'
LOG = logging.getLogger(__name__)
class CNSPatchCommand(CLI):
"""
CLI for cns compilation with ARIA files
"""
command_list = ('patch', )
desc_list = (
u"Compile a new CNS executable according with ARIA CNS patches", )
def __init__(self):
super(CNSPatchCommand, self).__init__(logger=CustomLogging(desc=__doc__))
def _create_argparser(self):
"""Update default CLI"""
parser = super(CNSPatchCommand, self)._create_argparser()
self.add_subparsers(parser.add_subparsers(dest="command"))
return parser
@staticmethod
def _patch_argparser(desc):
"""CNS patch arguments & options"""
parser = argp.ArgumentParser(description=desc,
add_help=False)
parser.add_argument("cns_path", metavar="CNS_SOLVE",
action=ReadableDir,
help="CNS directory path. If CNS has been installed "
"correctly, this will correspond to the "
"CNS_SOLVE environment variable")
return parser
def patch(self):
"""
CNS patch command which compile a new CNS executable
"""
# Create temporary directory where CNS source will be copied
tmp.tempdir = ''
local_tempdir = tmp.mktemp()
local_tempdir += str(int(time.time()))
local_tempdir = os.path.join(self.args.output_directory, "tmp",
local_tempdir)
# Move CNS files in the temporary directory
LOG.info("Moving CNS files in the temporary directory (%s)", local_tempdir)
shutil.copytree(self.args.cns_path, local_tempdir)
# Overwrite CNS files with ARIA cns patches
LOG.info("Patching CNS files")
for cnsrc in pkgr.resource_listdir(__name__, "cns/src"):
if not pkgr.resource_isdir(__name__, "cns/src/" + cnsrc):
shutil.copy(pkgr.resource_filename(__name__, "cns/src/" + cnsrc),
os.path.join(local_tempdir, "source"))
# Edit cns_solve_env file
cns_solve_env = os.path.join(local_tempdir, "cns_solve_env")
if os.path.exists(cns_solve_env):
with open(cns_solve_env, 'r+') as cnsolve:
content = cnsolve.read()
cnsolve.seek(0)
cnsolve.write(
re.sub(r"(CNS_SOLVE\s+')(_CNSsolve_location_)(')",
r"\1%s\3" % local_tempdir, content, flags=re.M))
# Call Make install command
cmd = "cd {cns_solve}; make install".format(cns_solve=local_tempdir)
# Get executable file using CNS_INST env var (can get it from cns_solve_env)
# Move executable to the output directory
# Delete tmp directory
def main():
"""Launch ariaec command interface"""
command = CNSPatchCommand()
command.run()
#!/usr/bin/env python
# coding=utf-8
"""
.. .......................................................................... ..
.. ARIA -- Ambiguous Restraints for Iterative Assignment ..
.. ..
.. A software for automated NOE assignment ..
.. ..
.. Version 2.3 ..
.. ..
.. ..
.. Copyright (C) Benjamin Bardiaux ..
.. Structural Bioinformatics, Institut Pasteur, Paris ..
.. ..
.. All rights reserved. ..
.. ..
.. NO WARRANTY. This software package is provided 'as is' without warranty of ..
.. any kind, expressed or implied, including, but not limited to the implied ..
.. warranties of merchantability and fitness for a particular purpose or ..
.. a warranty of non-infringement. ..
.. ..
.. Distribution of substantively modified versions of this module is ..
.. prohibited without the explicit permission of the copyright holders. ..
.. ..
.. $Author: bardiaux $ ..
.. $Revision: 1.1.1.1 $ ..
.. $Date: 2010/03/23 15:27:24 $ ..
.. .......................................................................... ..
"""
import sys
from string import join
from distutils.version import LooseVersion
NUMPY_MIN_VERSION = LooseVersion('1.1')
PYLAB_NUMPY_MIN_VERSION = LooseVersion('1.1')
SCIPY_NUMPY_MIN_VERSION = LooseVersion('2.7.2')
CCPN_MIN_VERSION = LooseVersion('2.2')
def check_python():
print 'Python version ',
version = float(sys.version[:3])
if version < 2.4:
print 'Python version 2.4 or higher required.'
print 'Current version is', sys.version[:5]
else:
print 'ok.'
def check_numeric():
print 'Numpy module ',
msg = ""
failed = 0
try:
import numpy
version = LooseVersion(numpy.__version__)
if version >= NUMPY_MIN_VERSION:
msg = 'ok (numpy)'
print msg
return 'numpy'
else:
msg += 'version > %s required for Numpy' % str(NUMPY_MIN_VERSION)
except:
msg += 'could not import Numpy module.'
print msg
return None
def check_numeric_slice():
# BARDIAUX
msg_NUMERIC = "\nThe version of Numeric (%s) is known to be incompatible with ARIA.\nConsider reverting to a more stable version (like 23.8).\n"
msg_NUMPY = "\nThe version of numpy (%s) is known to be incompatible with ARIA.\nConsider reverting to a more stable version.\n"
msg = {'numpy' : msg_NUMPY,
'numeric' : msg_NUMERIC}
numerix = 'numpy'
try:
from numpy import ones
from numpy import __version__ as NUMERIC_VERSION
except:
print "No numpy found."
if not len(ones(10)[2:]):
print msg[numerix] % NUMERIC_VERSION
## def check_numeric_slice():
## msg = "\nWARNING: This version of Numeric (%s) is known to be incompatible with ARIA.\nConsider reverting to a more stable version (like 23.8).\n"
## from Numeric import ones, __version__ as NUMERIC_VERSION
## if not ones(10)[2:]:
## print msg % NUMERIC_VERSION
def check_tix():
print 'Tkinter and Tix modules...'
failed_modules = []
try:
import Tkinter
print 'Tkinter imported (Tk version %.3f)' % Tkinter.TkVersion
except:
failed_modules.append('Tkinter')
try:
import _tkinter
except:
failed_modules.append('_tkinter')
try:
import Tix
Tix.Tk()
print 'Tix imported.'
except:
failed_modules.append('Tix')
if len(failed_modules):
print 'could not import module(s) ' + join(failed_modules, '/')
def check_scientific():
print 'ScientificPython module ',
result = 0
try:
import Scientific.IO.PDB
print 'ok.'
result = 1
except:
print 'could not import ScientificPython module.'
return result
def check_pylab():
print 'Matplotlib (optional):',
result = 0
try:
import matplotlib.pylab
print 'ok.'
result = 1
except:
print 'could not import Matplotlib module.'
return result
def check_ccpn():
print '\nCCPN distribution:',
missing = []
try:
import ccpnmr
#from memops.general.Constants import currentModelVersion
from ccpnmr.analysis.Version import version
ccpn_version = LooseVersion(str(version))
if ccpn_version < CCPN_MIN_VERSION:
print ' failed.'
print 'CCPN Analysis version >= 2.2 required (current version %s).' % ccpn_version
return
else:
print 'ok.'
except:
missing.append('ccpnmr')
print
try:
import ccpnmr.format
print 'CCPN Format converter: ok.'
except:
missing.append('ccpnmr.format')
try:
import ccpnmr.analysis
print 'CCPN Anaysis: ok.'
except:
missing.append('ccpnmr.analysis')
if missing:
print 'Could not import the following modules:',
print ', '.join(missing)
print 'This does not matter, as long as you do not intend to use the CCPN data model. Otherwise, please make sure that the environment variables CCPNMR_TOP_DIR and PYTHONPATH are set correctly.'
if __name__ == '__main__':
print 'Checking Python environment...\n'
check_python()
numeric = check_numeric()
check_numeric_slice()
#scientific = check_scientific()
scientific = 1
check_tix()
check_ccpn()
pylab = check_pylab()
# some infos
if not scientific or not pylab:
if numeric == 'numpy':
print "\nNOTE:"
if not scientific:
print 'Using ScientificPython with Numpy requires version >= %s of ScientificPython' % str(SCIPY_NUMPY_MIN_VERSION)
if not pylab:
print 'Using Matplotlib with Numpy requires version >= %s of Matplotlib' % str(PYLAB_NUMPY_MIN_VERSION)
!$Revision: 1.1.1.1 $
!$Date: 2010/03/23 15:27:16 $
!$RCSfile: cop.inp,v $
! cop.inp
! circular order parameter and ramachandran plot
! ************************************
! * Authors and copyright: *
! * Michael Nilges, Jens Linge, EMBL *
! * No warranty implied or expressed *
! * All rights reserved *
! ************************************
!@RUN:protocols/initialize.cns
!(spectrum=$spectrum;iteration=$iteration;)
!@NEWIT:iteration.cns(iteration=$iteration;)
!!!@SPECTRUM:spectrum.cns(spectrum=$spectrum;)
@RUN_CNS:run.cns(
spectrum =$spectrum;
!iteration =$iteration;
filenames =$filenames;
spectra =$spectra;
data =$data;
iterations=$iterations;
saprotocol=$saprotocol;
refine =$refine;
relax =$relax;
toppar =$toppar;
analysis =$analysis;
)
evaluate ($structurefile = "RUN:" + "begin/" + $filenames.structure)
structure @@$structurefile end
do (store1 = 0) (all)
do (store2 = 0) (all)
do (store3 = 0) (all)
evaluate ($nstruc1 = 0)
set display ANALYSIS:cop.disp end
@RUN_CNS:file.cns(
filenames=$filenames;
iterations=$iterations;
)
evaluate ($count = 1)
evaluate ($TotalNstruct = 0)
while ($count le $iterations.Assignstruct) loop main
evaluate ($file = $filenames.bestfile_$count)
! if ($file ne "") then
evaluate ($TotalNstruct = $TotalNstruct + 1)
! end if
evaluate ($count=$count+1)
end loop main
if ($Iterations.Assignstruct > $TotalNstruct) then
evaluate ($Iterations.Assignstruct = $TotalNstruct)
end if
evaluate ($count = 1)
evaluate ($nstruc1 = 0)
while ($count le $Iterations.Assignstruct) loop file
evaluate ($file = $filenames.bestfile_$count)
evaluate ($count = $count + 1)
! display $file
coor init end
if ($file ne "") then
coor @@$file
evaluate ($nstruc1 = $nstruc1 + 1)
end if
{* initialize atom numbers *}
evaluate ($N_atom_id = 0)
evaluate ($atom_id = 0)
{* loop over all residues *}
for $C_atom_id in id ( name ca ) loop main
evaluate ($phi = 360)
evaluate ($psi = 360)
if ( $atom_id > 0 ) then
if ( $N_atom_id > 0 ) then
pick dihedral
( byresidue ( id $N_atom_id ) and name C )
( byresidue ( id $atom_id ) and name N )
( byresidue ( id $atom_id ) and name CA )
( byresidue ( id $atom_id ) and name C )
geometry
evaluate ($phi=$result)
do (store1 = store1 + sin($phi))
(byres(id $atom_id) and name N)
do (store2 = store2 + cos($phi))
(byres(id $atom_id) and name N)
do (store3 = store3 + 1)
(byres(id $atom_id) and name N)
end if
if ( $C_atom_id > 0 ) then
pick dihedral
( byresidue ( id $atom_id ) and name N )
( byresidue ( id $atom_id ) and name CA )
( byresidue ( id $atom_id ) and name C )
( byresidue ( id $C_atom_id ) and name N )
geometry
evaluate ($psi=$result)
do (store1 = store1 + sin($psi))
(byres(id $atom_id) and name C)
do (store2 = store2 + cos($psi))
(byres(id $atom_id) and name C)
do (store3 = store3 + 1)
(byres(id $atom_id) and name C)
end if
end if
evaluate ($N_atom_id = $atom_id)
evaluate ($atom_id = $C_atom_id)
end loop main
pick dihedral
( byresidue ( id $N_atom_id ) and name C )
( byresidue ( id $atom_id ) and name N )
( byresidue ( id $atom_id ) and name CA )
( byresidue ( id $atom_id ) and name C )
geometry
evaluate ($phi=$result)
do (store1 = store1 + sin($phi))
(byres(id $atom_id) and name N)
do (store2 = store2 + cos($phi))
(byres(id $atom_id) and name N)
do (store3 = store3 + 1)
(byres(id $atom_id) and name N)
set message on echo on end
end loop file
do (store3 = max(store3, 1)) (all)
do (store4 = sqrt((store1/store3)**2 + (store2/store3)**2)) (name N or name C)
do (store5 = asin(store1 / store3)) (name C or name N)
do (store6 = acos(store2 / store3)) (name C or name N)
show element (store1) (name c or name n)
show element (store2) (name c or name n)
show element (store3) (name c or name n)
show element (store4) (name c or name n)