Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 #252

Merged
merged 46 commits into from
Feb 10, 2021
Merged

3.0.0 #252

Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5295910
Merge pull request #242 from scipion-em/devel
azazellochg Oct 31, 2020
1928866
Merge pull request #248 from scipion-em/devel
azazellochg Nov 10, 2020
a6d0f47
update ClassLoader to include group params and NrSignSamples
azazellochg Nov 11, 2020
8e791a9
fix the first item
azazellochg Nov 12, 2020
ea768c0
testing new reader method
azazellochg Nov 12, 2020
cd401a9
set extra attrs for classification and ref3d
azazellochg Nov 12, 2020
064a9eb
fillRandomSubset by default
azazellochg Nov 12, 2020
fa2c138
autoscale refs using relion, not xmipp
azazellochg Nov 26, 2020
a9cc238
add resize volume protocol+test
azazellochg Nov 27, 2020
40acb6b
fix #253
azazellochg Nov 27, 2020
966d918
add new protocol to conf
azazellochg Nov 27, 2020
db6bcfa
display missing param
azazellochg Dec 3, 2020
59ce8c6
Merge remote-tracking branch 'origin/devel' into fix_extra_labels
azazellochg Dec 13, 2020
12d3ccd
fix #256, #258
azazellochg Dec 13, 2020
67ae858
update protocols.conf
azazellochg Dec 25, 2020
f9e2f08
hotfix for missing ctf attrs
azazellochg Dec 25, 2020
e8fd9a3
Merge pull request #263 from scipion-em/hotfix
azazellochg Dec 25, 2020
40830c5
Merge remote-tracking branch 'origin/master' into fix_extra_labels
azazellochg Dec 25, 2020
a667ed7
change version number
azazellochg Dec 25, 2020
491024f
add dm4 warning
azazellochg Dec 25, 2020
735b8f6
use abs path for tmp links
azazellochg Dec 26, 2020
0c06d26
fix label for 3.1
azazellochg Dec 28, 2020
fc2b986
fix label for 3.1
azazellochg Dec 28, 2020
4aa28ba
use abs path for symlink, tbd with @delarosatrevin
azazellochg Dec 29, 2020
37c6c10
optimize imports, avoid importing whole modules
azazellochg Dec 30, 2020
2a1bd2d
fix the mistake
azazellochg Dec 30, 2020
47b6ea6
optimize import 2
azazellochg Dec 30, 2020
849f9b0
optimize imports 3
azazellochg Dec 31, 2020
4b73207
use Object for CtfRefineMicInfo, small fixes
azazellochg Jan 28, 2021
817d659
removing some labels for performance
azazellochg Jan 30, 2021
4744209
remove rlnBfactor since it's gone from Relion
azazellochg Jan 30, 2021
ad85157
enough beta testing? :)
azazellochg Jan 30, 2021
6239c21
remove deleted func
azazellochg Jan 31, 2021
6dc904b
remove duplicated self._optics.toImages
azazellochg Jan 31, 2021
2b0a3a0
check if the first mic has ctf
azazellochg Jan 31, 2021
7f0152f
set PARTICLE_EXTRA_LABELS in ClassesLoader and updateParticle
azazellochg Jan 31, 2021
54d76ea
fix #268
azazellochg Jan 31, 2021
6b41823
update readme
azazellochg Jan 31, 2021
854e0df
fix the obj name
azazellochg Feb 1, 2021
528cf15
add Falcon 4 EC MTFs
azazellochg Feb 3, 2021
85b17da
fixing #269
azazellochg Feb 3, 2021
259a970
fix the typo
azazellochg Feb 3, 2021
f751929
Minor refactor handling extra labels
delarosatrevin Feb 5, 2021
c5bc825
replace pwutils.exists
azazellochg Feb 5, 2021
615d8c0
replace pwutils.join
azazellochg Feb 5, 2021
4f90e2c
use base func
azazellochg Feb 5, 2021
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
12 changes: 7 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ This plugin provide wrappers around several programs of `RELION <https://www3.mr
.. |devel| image:: http://scipion-test.cnb.csic.es:9980/badges/relion_devel.svg
.. |support| image:: http://scipion-test.cnb.csic.es:9980/badges/relion_support.svg

**IMPORTANT!**

If you have imported movies with a gain file in **DM4** format, you need to **flip the gain reference upside-down** in the motion correction protocol! (`bug details <https://github.com/I2PC/xmippCore/issues/39>`_)


Installation
------------

You will need to use `3.0 <https://github.com/I2PC/scipion/releases/tag/V3.0.0>`_ version of Scipion to be able to run these protocols. To install the plugin, you have two options:
You will need to use 3.0+ version of Scipion to be able to run these protocols. To install the plugin, you have two options:

a) Stable version

Expand All @@ -59,16 +63,14 @@ b) Developer's version

scipion installp -p path_to_scipion-em-relion --devel

RELION sources will be downloaded and compiled automatically with the plugin, but you can also link an existing installation. Default installation path assumed is ``software/em/relion-3.1.0``, if you want to change it, set *RELION_HOME* in ``scipion.conf`` file to the folder where the RELION is installed. If you need to use CUDA different from the one used during Scipion installation (defined by *CUDA_LIB*), you can add *RELION_CUDA_LIB* variable to the config file. Moreover, if you have to use a MPI for Relion different from Scipion MPI, you can set *RELION_MPI_BIN* and *RELION_MPI_LIB* variables in the config file.
RELION sources will be downloaded and compiled automatically with the plugin, but you can also link an existing installation. Default installation path assumed is ``software/em/relion-3.1.1``, if you want to change it, set *RELION_HOME* in ``scipion.conf`` file to the folder where the RELION is installed. If you need to use CUDA different from the one used during Scipion installation (defined by *CUDA_LIB*), you can add *RELION_CUDA_LIB* variable to the config file. Moreover, if you have to use a MPI for Relion different from Scipion MPI, you can set *RELION_MPI_BIN* and *RELION_MPI_LIB* variables in the config file.

To check the installation, simply run one of the tests. A complete list of tests can be displayed by executing ``scipion test --show --grep relion``

Supported versions
------------------

3.1.0

We are still working towards stable plugin release, so some things might not work yet. Handling optics groups needs more testing, you are welcome to be a volunteer.
3.1.0, 3.1.1

**IMPORTANT**: Relion-3.0 can be used with this plugin but we do not officially support it anymore, i.e. there will be no bugfixes for it.

Expand Down
19 changes: 10 additions & 9 deletions relion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@
# **************************************************************************

import os

import pyworkflow.utils as pwutils
import pwem

from .constants import *

__version__ = '3.0.0b7'
__version__ = '3.0.0'
_logo = "relion_logo.png"
_references = ['Scheres2012a', 'Scheres2012b', 'Kimanius2016', 'Zivanov2018']


class Plugin(pwem.Plugin):
_homeVar = RELION_HOME
_supportedVersions = [V3_0, V3_1]
_supportedVersions = [V3_0, V3_1, V3_1_1]
_url = "https://github.com/scipion-em/scipion-em-relion"

@classmethod
def _defineVariables(cls):
cls._defineEmVar(RELION_HOME, 'relion-%s' % V3_1)
cls._defineEmVar(RELION_HOME, 'relion-%s' % V3_1_1)
cls._defineVar(RELION_CUDA_LIB, pwem.Config.CUDA_LIB)

@classmethod
Expand All @@ -59,7 +60,7 @@ def getEnviron(cls):
if binPath not in environ['PATH']:
environ.update({'PATH': binPath,
'LD_LIBRARY_PATH': libPath,
#'SCIPION_MPI_FLAGS': os.environ.get('RELION_MPI_FLAGS', ''),
# 'SCIPION_MPI_FLAGS': os.environ.get('RELION_MPI_FLAGS', ''),
}, position=pwutils.Environ.BEGIN)

# Get Relion CUDA library path if defined
Expand All @@ -78,11 +79,6 @@ def getEnviron(cls):
def IS_30(cls):
return cls.getActiveVersion().startswith('3.0')

@classmethod
def IS_31(cls):
# avoid using this, IS_GT30 is preferred
return cls.getActiveVersion().startswith('3.1')

@classmethod
def IS_GT30(cls):
return not cls.getActiveVersion().startswith('3.0')
Expand All @@ -101,5 +97,10 @@ def defineBinaries(cls, env):
env.addPackage('relion', version='3.1.0',
url='https://github.com/3dem/relion/archive/3.1.0.tar.gz',
commands=relion_commands,
updateCuda=True)

env.addPackage('relion', version='3.1.1',
url='https://github.com/3dem/relion/archive/3.1.1.tar.gz',
commands=relion_commands,
updateCuda=True,
default=True)
8 changes: 4 additions & 4 deletions relion/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# Supported versions:
V3_0 = '3.0'
V3_1 = '3.1.0'
V3_1_1 = '3.1.1'

MASK_FILL_ZERO = 0
MASK_FILL_NOISE = 1
Expand Down Expand Up @@ -169,11 +170,10 @@


PARTICLE_EXTRA_LABELS = [
'rlnBfactor',
'rlnCtfBfactor',
'rlnCtfScalefactor',
'rlnPhaseShift',
'rlnParticleSelectZScore',
'rlnMovieFrameNumber',
'rlnGroupName'
'rlnGroupName',
'rlnGroupNumber',
'rlnRandomSubset'
]
27 changes: 10 additions & 17 deletions relion/convert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
# *
# **************************************************************************

import math

from .convert_utils import *
from .convert_deprecated import *
from .convert_coordinates import *
from .dataimport import *
import relion
import math


# Writing of star files will be handle by the Writer class
# We have a new implementation of it for Relion > 3.1 since
Expand Down Expand Up @@ -74,7 +76,6 @@ def writeSetOfParticles(imgSet, starFile, **kwargs):
blockName: The name of the data block (default particles)
fillMagnification: If True set magnification values (default False)
alignType:
fillRandomSubset:
extraLabels:
postprocessImageRow:
format: string value to specify STAR format, if '30' it will use
Expand Down Expand Up @@ -107,6 +108,7 @@ class ClassesLoader:
def __init__(self, protocol, alignType):
self._protocol = protocol
self._alignType = alignType
self._reader = None # Will be created later

def _loadClassesInfo(self, iteration):
""" Read some information about the produced Relion 3D classes
Expand Down Expand Up @@ -144,27 +146,18 @@ def _updateParticle(self, item, row):
item.setClassId(row.rlnClassNumber)
self._reader.setParticleTransform(item, row)

# Try to create extra objects only once if item is reused
azazellochg marked this conversation as resolved.
Show resolved Hide resolved
if not hasattr(item, '_rlnNormCorrection'):
item._rlnNormCorrection = Float()
item._rlnLogLikeliContribution = Float()
item._rlnMaxValueProbDistribution = Float()

item._rlnNormCorrection.set(row.rlnNormCorrection)
item._rlnLogLikeliContribution.set(row.rlnLogLikeliContribution)
item._rlnMaxValueProbDistribution.set(row.rlnMaxValueProbDistribution)

if hasattr(item, '_rlnGroupName'):
item._rlnGroupName.set(row.rlnGroupName)
elif hasattr(row, 'rlnGroupName'):
item._rlnGroupName = String(row.rlnGroupName)
if getattr(self, '__updatingFirst', True):
self._reader.createExtraLabels(item, row, PARTICLE_EXTRA_LABELS)
self.__updatingFirst = False
else:
self._reader.setExtraLabels(item, row)

def _updateClass(self, item):
classId = item.getObjId()
if classId in self._classesInfo:
index, fn, row = self._classesInfo[classId]
item.setAlignment(self._alignType)
if self._alignType == pwem.ALIGN_PROJ:
if self._alignType == ALIGN_PROJ:
fn += ':mrc' # mark reference as a MRC volume
item.getRepresentative().setLocation(index, fn)
item._rlnClassDistribution = Float(row.rlnClassDistribution)
Expand Down
7 changes: 6 additions & 1 deletion relion/convert/convert30.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def _writeSetOfMoviesOrMics(self, imgIterable,
micRow[imgLabelName] = '' # Just to add label, proper value later
iterMics = iter(imgIterable)
mic = next(iterMics)
self._setCtf = mic.hasCTF()
self._micToRow(mic, micRow)

micsTable = self._createTableFromDict(micRow)
Expand All @@ -87,6 +88,10 @@ def _writeSetOfMoviesOrMics(self, imgIterable,
def _micToRow(self, mic, row):
WriterBase._micToRow(self, mic, row)

# Set CTF values
if self._setCtf:
self._ctfToRow(mic.getCTF(), row)

# Add now the Acquisition labels
acq = mic.getAcquisition()
row.update({
Expand Down Expand Up @@ -140,7 +145,7 @@ def setParticleTransform(self, particle, row):
elif self._alignType == pwem.ALIGN_PROJ:
self.setParticleTransform = self.__setParticleTransformProj
else:
raise Exception("Unexpected alignment type: %s"
raise TypeError("Unexpected alignment type: %s"
% self._alignType)

# Call again the modified function
Expand Down
Loading