Skip to content

Commit

Permalink
Merge pull request #224 from scipion-em/rc3.0.0b4
Browse files Browse the repository at this point in the history
Rc3.0.0b4
  • Loading branch information
azazellochg authored Oct 23, 2020
2 parents ad761d6 + ff07e2a commit ec72a60
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions relion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

_logo = "relion_logo.png"
_references = ['Scheres2012a', 'Scheres2012b', 'Kimanius2016', 'Zivanov2018']
_url = "https://github.com/scipion-em/scipion-em-relion"


class Plugin(pwem.Plugin):
Expand Down
12 changes: 10 additions & 2 deletions relion/convert/convert31.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,20 @@ def update(self, ogId, **kwargs):

def updateAll(self, **kwargs):
""" Update all Optics Groups with these values. """
missing = {k: v for k, v in kwargs.items() if not self.hasColumn(k)}
existing = {k: v for k, v in kwargs.items() if self.hasColumn(k)}

self.addColumns(**missing)

for og in self:
self.update(og.rlnOpticsGroup, **kwargs)
self.update(og.rlnOpticsGroup, **existing)

def add(self, newOg):
self.__store(newOg)

def hasColumn(self, colName):
return hasattr(self.first(), colName)

def addColumns(self, **kwargs):
""" Add new columns with default values (type inferred from it). """
items = self.first()._asdict().items()
Expand Down Expand Up @@ -395,7 +403,7 @@ def writeSetOfParticles(self, partsSet, starFile, **kwargs):
extraLabels = kwargs.get('extraLabels', [])
extraLabels.extend(PARTICLE_EXTRA_LABELS)
if kwargs.get('fillRandomSubset'):
extraLabels.append('_rlnRandomSubset')
extraLabels.append('rlnRandomSubset')

self._extraLabels = [l for l in extraLabels
if firstPart.hasAttribute('_%s' % l)]
Expand Down
7 changes: 4 additions & 3 deletions relion/protocols/protocol_autopick_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,13 @@ def _defineParams(self, form):
'in the micrographs.')

form.addParam('refsCtfCorrected', params.BooleanParam, default=True,
condition=refCondition,
label='Are References CTF corrected?',
help='Set to Yes if the references were created with '
'CTF-correction inside RELION.\n'
'If set to Yes, the input micrographs should contain '
'the CTF information.')

form.addParam('ignoreCTFUntilFirstPeak', params.BooleanParam,
condition=refCondition,
default=False,
label='Ignore CTFs until first peak?',
help='Set this to Yes, only if this option was also used '
Expand Down Expand Up @@ -399,7 +397,7 @@ def getAutopickParams(self):
else: # 3D reference
params += ' --ref ../../reference_3d.mrc'
params += ' --sym %s' % self.symmetryGroup
params += ' --healpix_order %s' % self.angularSamplingDeg
params += ' --healpix_order %d' % (int(self.angularSamplingDeg.get()) + 1)

ps = self.getInputReferences().getSamplingRate()
params += ' --angpix_ref %0.5f' % ps
Expand All @@ -410,6 +408,9 @@ def getAutopickParams(self):
if self.refsCtfCorrected:
params += ' --ctf'

if self.ignoreCTFUntilFirstPeak:
params += ' --ctf_intact_first_peak'

params += ' --ang %d' % self.angularSampling
# Negative values for filters means no-filter
if self.lowpassFilterRefs > 0:
Expand Down
17 changes: 10 additions & 7 deletions relion/protocols/protocol_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def _defineParams(self, form):
'of input particles will be put into the'
'star file that is generated.')
form.addParam('maskDiameterA', IntParam, default=-1,
condition='not doContinue',
label='Particle mask diameter (A)',
help='The experimental images will be masked with a '
'soft circular mask with this <diameter>. '
Expand Down Expand Up @@ -289,6 +288,7 @@ def _defineParams(self, form):
'when the mask contains only a relatively '
'small volume inside the box.')
form.addParam('isMapAbsoluteGreyScale', BooleanParam, default=False,
condition='not doContinue',
label="Is initial 3D map on absolute greyscale?",
help='The probabilities are based on squared differences,'
' so that the absolute grey scale is important. \n'
Expand Down Expand Up @@ -317,7 +317,7 @@ def _defineParams(self, form):
self.addSymmetry(form)

form.addParam('initialLowPassFilterA', FloatParam, default=60,
condition='not is2D',
condition='not is2D and not doContinue',
label='Initial low-pass filter (A)',
help='It is recommended to strongly low-pass filter your '
'initial reference map. If it has not yet been '
Expand Down Expand Up @@ -477,14 +477,14 @@ def _defineParams(self, form):
label='Perform image alignment?', condition="isClassify",
help='If set to No, then rather than performing both alignment '
'and classification, only classification will be performed. '
'This allows the use of very focused masks.This requires '
'This allows the use of very focused masks. This requires '
'that the optimal orientations of all particles are already '
'calculated.')
if self.IS_3D:
form.addParam('angularSamplingDeg', EnumParam, default=2,
choices=ANGULAR_SAMPLING_LIST,
label='Initial angular sampling (deg)',
condition='not isClassify or doImageAlignment',
condition='doImageAlignment and (isClassify or not doContinue)',
help='There are only a few discrete angular samplings'
' possible because we use the HealPix library to'
' generate the sampling of the first two Euler '
Expand All @@ -505,7 +505,7 @@ def _defineParams(self, form):
'the sampling rate will be increased \n'
'automatically after that.')
form.addParam('offsetSearchRangePix', FloatParam, default=5,
condition='not isClassify or doImageAlignment',
condition='doImageAlignment and (isClassify or not doContinue)',
label='Initial offset range (pix)',
help='Probabilities will be calculated only for '
'translations in a circle with this radius (in '
Expand All @@ -514,7 +514,7 @@ def _defineParams(self, form):
'translation for each image in the previous '
'iteration.')
form.addParam('offsetSearchStepPix', FloatParam, default=1.0,
condition='not isClassify or doImageAlignment',
condition='doImageAlignment and (isClassify or not doContinue)',
label='Initial offset step (pix)',
help='Translations will be sampled with this step-size '
'(in pixels). Translational sampling is also done '
Expand Down Expand Up @@ -548,6 +548,7 @@ def _defineParams(self, form):
'get higher weights than those further away.')
else:
form.addParam('localSearchAutoSamplingDeg', EnumParam,
condition='not doContinue',
default=4, choices=ANGULAR_SAMPLING_LIST,
label='Local search from auto-sampling (deg)',
help='In the automated procedure to increase the '
Expand Down Expand Up @@ -578,6 +579,7 @@ def _defineParams(self, form):

if self.IS_CLASSIFY and self.IS_GT30():
form.addParam('allowCoarserSampling', BooleanParam,
condition='doImageAlignment',
default=False,
label='Allow coarser sampling?',
help='If set to Yes, the program will use '
Expand Down Expand Up @@ -614,6 +616,7 @@ def _defineParams(self, form):

def addSymmetry(self, container):
container.addParam('symmetryGroup', StringParam, default='c1',
condition='not doContinue',
label="Symmetry",
help='See [[Relion Symmetry][http://www2.mrc-lmb.cam.ac.uk/'
'relion/index.php/Conventions_%26_File_formats#Symmetry]] '
Expand Down Expand Up @@ -930,7 +933,7 @@ def _setNormalArgs(self, args):
args['--i'] = self._getFileName('input_star')
args['--particle_diameter'] = maskDiameter

# Since Relion 3.1 --angpix is not longer a valid argument
# Since Relion 3.1 --angpix is no longer a valid argument
if relion.Plugin.IS_30():
args['--angpix'] = ps

Expand Down
5 changes: 4 additions & 1 deletion relion/protocols/protocol_initialmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def _defineParams(self, form):
label="Input particles",
help='Select the input images from the project.')
form.addParam('maskDiameterA', IntParam, default=-1,
condition='not doContinue',
label='Particle mask diameter (A)',
help='The experimental images will be masked with a '
'soft circular mask with this <diameter>. '
Expand Down Expand Up @@ -155,6 +154,7 @@ def _defineParams(self, form):

form.addSection('Optimisation')
form.addParam('numberOfClasses', IntParam, default=1,
condition='not doContinue',
label='Number of classes',
help='The number of classes (K) for a multi-reference '
'ab initio SGD refinement. These classes will be '
Expand All @@ -165,12 +165,14 @@ def _defineParams(self, form):
'iterations.')

form.addParam('doFlattenSolvent', BooleanParam, default=True,
condition='not doContinue',
label='Flatten and enforce non-negative solvent?',
help='If set to Yes, the job will apply a spherical '
'mask and enforce all values in the reference '
'to be non-negative.')

form.addParam('symmetryGroup', StringParam, default='c1',
condition='not doContinue',
label="Symmetry",
help='SGD sometimes works better in C1. If you make an '
'initial model in C1 but want to run Class3D/Refine3D '
Expand Down Expand Up @@ -208,6 +210,7 @@ def _defineParams(self, form):
self._defineSGD3(form)

form.addParam('sgdNoiseVar', IntParam, default=-1,
condition='not doContinue',
expertLevel=LEVEL_ADVANCED,
label='Increased noise variance half-life',
help='When set to a positive value, the initial '
Expand Down
4 changes: 4 additions & 0 deletions relion/tests/test_convert_relion.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,10 @@ def test_fromStar(self):
og = OpticsGroups.fromStar(partsStar)
fog = og.first()

# test hasColumn method
for colName in ['rlnMtfFileName', 'rlnOpticsGroupName']:
self.assertTrue(og.hasColumn(colName))

# acq = first.getAcquisition()
self.assertEqual(fog.rlnMtfFileName, 'mtf_k2_200kV.star')
self.assertEqual(fog.rlnOpticsGroupName, 'opticsGroup1')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='3.0.0b3', # Required
version='3.0.0b4', # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down

0 comments on commit ec72a60

Please sign in to comment.