Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
f39d3e9
added encore to release 0.12.1
mtiberti Jan 26, 2016
5d914cc
Merge branch 'master' of https://github.com/encore-similarity/mdanaly…
mtiberti Jan 26, 2016
d473b97
Merge branch 'master' into develop
mtiberti Jan 26, 2016
113a283
fixed regression
mtiberti Jan 26, 2016
4d6062f
fixed error and convergence estimation
mtiberti Feb 11, 2016
9c7b60c
tweaks to details output
mtiberti Feb 11, 2016
074f139
updated documentation and codestyle
tbengtsen Feb 16, 2016
1d4a337
fixed indentation
tbengtsen Feb 17, 2016
128a9e6
fixed indentation
tbengtsen Feb 17, 2016
024ed87
fixed cluster.py problem
tbengtsen Feb 17, 2016
f752ed5
added to Author information to docstrings; minor fixes
mtiberti Feb 17, 2016
1b55474
fixed conf. dist. matrix bug in dres and refactored similarity_mode o…
mtiberti Feb 18, 2016
7a07bb7
Added Encore unit-tests
Feb 18, 2016
1205f8c
change documentation
tbengtsen Feb 19, 2016
673dc82
modified output types and input types for parameters
mtiberti Feb 19, 2016
12885b0
partially revised documentation
mtiberti Feb 19, 2016
516ddd9
fixed load_matrix bug
mtiberti Feb 20, 2016
01704be
Fixed Encore unit tests in response to API change.
Feb 20, 2016
c001ada
changed docs
tbengtsen Feb 22, 2016
f9579b1
changed documentation
tbengtsen Feb 22, 2016
897060c
fixed import bug for utils module
mtiberti Mar 2, 2016
a4f3f50
Merge branch 'develop' of https://github.com/encore-similarity/mdanal…
mtiberti Mar 2, 2016
b5ace0f
added tests for convergence and error estimation and few changes in o…
mtiberti Mar 4, 2016
08633e9
fixed error message in tests
mtiberti Mar 4, 2016
7281e66
added mantainer name in similarity.py
mtiberti Mar 8, 2016
29b536d
Removed selections attributes from Ensemble object. Selections are no…
Mar 8, 2016
469766f
Merge branch 'develop' of https://github.com/encore-similarity/mdanal…
Mar 8, 2016
6d26f6d
Added unit tests for ArrayReader
Mar 9, 2016
0d21772
edited documentation
mtiberti Mar 10, 2016
b81cee4
Minor bugfix in ArrayReader
Mar 11, 2016
259e14c
Merge branch 'develop' of https://github.com/encore-similarity/mdanal…
Mar 11, 2016
11f5a5f
Merge remote-tracking branch 'upstream/develop' into develop
mtiberti Mar 14, 2016
0973a93
Merge branch 'develop' of https://github.com/encore-similarity/mdanal…
mtiberti Mar 14, 2016
138122c
removed useless is_int function
mtiberti Mar 15, 2016
487f855
Increased test coverage of Ensemble.py and array.py
Mar 17, 2016
cf5198b
fixed dobule RELEASE issue
mtiberti Mar 21, 2016
0126e27
Merge remote-tracking branch 'upstream/develop' into develop
mtiberti Mar 21, 2016
98db2b7
fixed regression from botched merge
mtiberti Mar 21, 2016
81f834a
Increased test coverage in encore.
Mar 22, 2016
96c7271
added test
mtiberti Mar 22, 2016
024d872
Removed topology_filename attribute from Ensemble class.
Mar 23, 2016
b83f4b9
Removed __iter__ from ArrayReader.
Mar 23, 2016
4e1cee0
Added Python3 support. Fixed import style.
Mar 24, 2016
349974c
Added decorators around scipy-dependent tests.
Mar 24, 2016
c857da9
Added decorators around scipy-dependent tests.
Mar 24, 2016
80af13e
removed debug print
mtiberti Mar 24, 2016
5b2971e
fixed code style according to pep8
mtiberti Mar 24, 2016
c539d54
solved most issues raised by flake8
mtiberti Mar 24, 2016
5447bdb
solved most issues raised by QuantifiedCode
mtiberti Mar 29, 2016
f2d6078
Switch to new-style string formatting.
Mar 29, 2016
a3a5f00
Merge branch 'feature-encore' of https://github.com/encore-similarity…
Mar 29, 2016
5461d12
fixed few other QuantifiedCode issues
mtiberti Mar 29, 2016
cd9bba2
Merge branch 'feature-encore' of https://github.com/encore-similarity…
mtiberti Mar 29, 2016
9b6ecb8
Switch to new-style string formatting.
Mar 29, 2016
667225d
ArrayReader renamed to MemoryReader
Apr 2, 2016
e9eb097
Removed Ensemble class
Apr 3, 2016
14b1627
Simplified coordinate extraction code in Universe.transfer_to_memory
Apr 4, 2016
c70dafe
Added dimensions and dt support to MemoryReader.
Apr 4, 2016
d319957
Changed dict.iteritems() to six.iteritems(dict)
mtiberti Apr 4, 2016
eb4e393
changed numpy.array to numpy.asarray to avoid making useless copies
mtiberti Apr 4, 2016
be24a91
defaulted number of cores to 1 in confdistmatrix
mtiberti Apr 4, 2016
f26cd38
Bugfix in coordinate extraction in Universe.transfer_to_memory().
Apr 4, 2016
f8733d5
Removed check for empty selection string in Universe.select_atoms()
Apr 4, 2016
bbcbd36
numpy -> np in covariance.py
Apr 4, 2016
ce6d6e5
Removed call to np.cov in covariance.py - ML case.
Apr 5, 2016
0608d16
Added special case in Selection.AllSelection to speed up "all" select…
Apr 5, 2016
434d8b1
Refactored the confdistmatrix module - functions instead of classes
mtiberti Apr 6, 2016
c3c1274
fixed parallel execution in conformational_distance_matrix
mtiberti Apr 6, 2016
4d97e18
Merge branch 'feature-encore' of https://github.com/encore-similarity…
mtiberti Apr 6, 2016
36f2949
Removed problematic test
mtiberti Apr 6, 2016
dfaf296
removed duplicate test
mtiberti Apr 6, 2016
a12a630
changed the AP algorithm to use floats instead of double for memory e…
mtiberti Apr 6, 2016
da57201
Changed slice convention in MemoryReader to follow that of numpy.
Apr 7, 2016
1fb0c92
removed debug print statement
mtiberti Apr 8, 2016
0f5de8a
Changed behavior so clusters are returned even when not fully converg…
Apr 15, 2016
f7a1eaf
removed debug prints
mtiberti Apr 26, 2016
0bf9c07
cosmetical changes
mtiberti Apr 29, 2016
92b5445
Merge branch 'feature-encore' of https://github.com/encore-similarity…
mtiberti May 3, 2016
190ed95
changed math.h import
mtiberti May 9, 2016
0f16831
removed all other flavours of SPE except for the classical one
mtiberti May 9, 2016
ba99fcb
moved cython/c file according to the new paradigm and modified setup.…
mtiberti May 20, 2016
50a9edc
Merge remote-tracking branch 'upstream/develop' into HEAD
mtiberti May 22, 2016
1b01462
Merge remote-tracking branch 'upstream/develop' into feature-encore
mtiberti May 23, 2016
f4936b9
Encore: Adjusted expected results for hes tests: test failures were d…
May 25, 2016
8bccc3a
Code reorganization, cleanup and bugfixes.
Aug 15, 2016
fc7e40f
Added cluster.py
Aug 15, 2016
f6ec6e1
streamlined convergence functions
mtiberti Aug 18, 2016
04c2fc2
Merge remote-tracking branch 'upstream/develop' into feature-encore
mtiberti Sep 3, 2016
930570e
Fixed test in test_encore to reflect change in slicing behavior of Me…
Sep 3, 2016
c60d69e
Decreased sensitivity of hes_align test.
Sep 6, 2016
9b9c607
Added missing warnings import
Sep 6, 2016
01424cc
Fixed test_reader_w_timeseries_frame_interval test
Sep 6, 2016
f8dafb5
Bugfix in similarity.py
Sep 6, 2016
5ba05a4
Added sklearn as optional requirement in setup.py and .travis.yml. Mi…
Sep 6, 2016
b8b5a36
Minor corrections to MemoryReader code, tests and documentation.
Sep 6, 2016
9355a6e
Removed debugging print statements.
Sep 6, 2016
cd12501
sklearn -> scikit-learn in setup.py
Sep 7, 2016
1c6fc9d
Added missing warnings import
Sep 7, 2016
2a421e1
Added sklearn availability tests to two tests.
Sep 7, 2016
7dea72d
Fixed QuantitiveCode issues. Added sklearn availability tests to seve…
Sep 7, 2016
5893b12
Fixed QuantitiveCode issue
Sep 7, 2016
c000a5c
Changed ParallellCalculation to run in main thread when ncores==1. Ad…
Sep 7, 2016
8f5f722
Inreased travis process timeout to 400s
Sep 8, 2016
04f459f
Speeded up tests. Reverted back to 300s process timeout. Bugfix in he…
Sep 9, 2016
27ecd99
Removed obsolete code.
Sep 9, 2016
f43c77b
Removed debugging print statements
Sep 9, 2016
291b462
Increased robustness of test
Sep 9, 2016
77abc7e
Inreased travis process timeout to 400s
Sep 10, 2016
1556203
Added documentation, and removed unused import
Sep 10, 2016
e56e6b5
Minor bugfixes and documentation updates related to MemoryReader.
wouterboomsma Sep 11, 2016
43c2159
Cleaned up merge_universes function.
wouterboomsma Sep 11, 2016
dcb72ba
changed reader format string: memory->MEMORY
wouterboomsma Sep 12, 2016
02441a3
Removed check for existence of group.universe
wouterboomsma Sep 12, 2016
16ae695
Use isinstance instead of checking against format class variable.
wouterboomsma Sep 12, 2016
abb55d2
Bugfix in MemoryReader. Minor cleanup in similarity.py
wouterboomsma Sep 12, 2016
4a73b24
first pass on documentation
mtiberti Sep 13, 2016
6cbed67
revised tests in documentation
mtiberti Sep 14, 2016
ddf87d5
Extra documentation and minor bugfix
wouterboomsma Sep 15, 2016
a71ef5e
Merge remote-tracking branch 'upstream/develop' into feature-encore
mtiberti Sep 16, 2016
d4eee36
added __imul__ and __iadd__ to TriangularMatrix
mtiberti Sep 20, 2016
232a0a5
added error messages and fixed error types
mtiberti Sep 20, 2016
96344fc
added test for * and + operators in utils.TriangularMatrix
mtiberti Sep 20, 2016
d50c3d7
Updated docstrings, updated/added examples
tbengtsen Sep 28, 2016
98f7c1f
Merge branch 'feature-encore' of https://github.com/encore-similarity…
tbengtsen Sep 28, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ before_install:
- conda config --add channels MDAnalysis
- conda update --yes conda
install:
- if [[ $SETUP == 'full' ]]; then conda create --yes -q -n pyenv python=$PYTHON_VERSION numpy scipy nose=1.3.7 sphinx=1.3 griddataformats six; fi
- if [[ $SETUP == 'full' ]]; then conda create --yes -q -n pyenv python=$PYTHON_VERSION numpy scipy nose=1.3.7 sphinx=1.3 griddataformats six scikit-learn; fi
- if [[ $SETUP == 'minimal' ]]; then conda create --yes -q -n pyenv python=$PYTHON_VERSION numpy nose=1.3.7 sphinx=1.3 griddataformats six; fi
- source activate pyenv
- |
Expand Down
36 changes: 36 additions & 0 deletions package/MDAnalysis/analysis/encore/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# __init__.py
# Copyright (C) 2014 Wouter Boomsma, Matteo Tiberti
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import

__all__ = [
'covariance',
'similarity',
'confdistmatrix',
'clustering'
]

from .similarity import hes, ces, dres, \
ces_convergence, dres_convergence

from .clustering.ClusterCollection import ClusterCollection, Cluster
from .clustering.ClusteringMethod import *
from .clustering.cluster import cluster
from .dimensionality_reduction.DimensionalityReductionMethod import *
from .dimensionality_reduction.reduce_dimensionality import (
reduce_dimensionality)
from .confdistmatrix import get_distance_matrix
from .utils import merge_universes
153 changes: 153 additions & 0 deletions package/MDAnalysis/analysis/encore/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# bootstrap.py --- Bootstrap analysis for ensembles and distance matrices
# Copyright (C) 2014 Wouter Boomsma, Matteo Tiberti
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""
bootstrap procedures --- :mod:`MDAnalysis.analysis.ensemble.bootstrap`
=====================================================================


The module contains functions for bootstrapping either ensembles (Universe
objects) or distance matrices, by resampling with replacement.

:Author: Matteo Tiberti, Wouter Boomsma, Tone Bengtsen
:Year: 2015--2016
:Copyright: GNU Public License v3
:Mantainer: Matteo Tiberti <matteo.tiberti@gmail.com>, mtiberti on github

.. versionadded:: 0.16.0

"""

import numpy as np
import logging
import MDAnalysis as mda
from .utils import TriangularMatrix, ParallelCalculation


def bootstrapped_matrix(matrix, ensemble_assignment):
"""
Bootstrap an input square matrix. The resulting matrix will have the same
shape as the original one, but the order of its elements will be drawn
(with repetition). Separately bootstraps each ensemble.

Parameters
----------

matrix : encore.utils.TriangularMatrix
similarity/dissimilarity matrix

ensemble_assignment: numpy.array
array of ensemble assignments. This array must be matrix.size long.

Returns
-------

this_m : encore.utils.TriangularMatrix
bootstrapped similarity/dissimilarity matrix
"""
ensemble_identifiers = np.unique(ensemble_assignment)
this_m = TriangularMatrix(size=matrix.size)
indexes = []
for ens in ensemble_identifiers:
old_indexes = np.where(ensemble_assignment == ens)[0]
indexes.append(np.random.randint(low=np.min(old_indexes),
high=np.max(old_indexes) + 1,
size=old_indexes.shape[0]))

indexes = np.hstack(indexes)
for j in range(this_m.size):
for k in range(j):
this_m[j, k] = matrix[indexes[j], indexes[k]]

logging.info("Matrix bootstrapped.")
return this_m


def get_distance_matrix_bootstrap_samples(distance_matrix,
ensemble_assignment,
samples=100,
ncores=1):
"""
Calculates distance matrices corresponding to bootstrapped ensembles, by
resampling with replacement.

Parameters
----------

distance_matrix : encore.utils.TriangularMatrix
Conformational distance matrix

ensemble_assignment : str
Mapping from frames to which ensemble they are from (necessary because
ensembles are bootstrapped independently)

samples : int, optional
How many bootstrap samples to create.

ncores : int, optional
Maximum number of cores to be used (default is 1)

Returns
-------

confdistmatrix : list of encore.utils.TriangularMatrix
"""

bs_args = \
[([distance_matrix, ensemble_assignment]) for i in range(samples)]

pc = ParallelCalculation(ncores, bootstrapped_matrix, bs_args)

pc_results = pc.run()

bootstrap_matrices = zip(*pc_results)[1]

return bootstrap_matrices


def get_ensemble_bootstrap_samples(ensemble,
samples=100):
"""
Generates a bootstrapped ensemble by resampling with replacement.

Parameters
----------

ensemble : MDAnalysis.Universe
Conformational distance matrix

samples : int, optional
How many bootstrap samples to create.

Returns
-------

list of MDAnalysis.Universe objects
"""

ensemble.transfer_to_memory()

ensembles = []
for i in range(samples):
indices = np.random.randint(
low=0,
high=ensemble.trajectory.timeseries().shape[1],
size=ensemble.trajectory.timeseries().shape[1])
ensembles.append(
mda.Universe(ensemble.filename,
ensemble.trajectory.timeseries(format='afc')[:,indices,:],
format=mda.coordinates.memory.MemoryReader))
return ensembles
Loading