def rowToCoordinate(coordRow): """ Create a Coordinate from a row of a meta """ # Check that all required labels are present in the row if coordRow.containsAll(COOR_DICT): coord = Coordinate() rowToObject(coordRow, coord, COOR_DICT, extraLabels=COOR_EXTRA_LABELS) # Gautomatch starts _rlnClassNumber at 0, but relion at 1 # so let's increment its value if coord.hasAttribute('_rlnClassNumber'): coord._rlnClassNumber.increment() micName = None if coordRow.hasLabel(md.RLN_MICROGRAPH_ID): micId = int(coordRow.getValue(md.RLN_MICROGRAPH_ID)) coord.setMicId(micId) # If RLN_MICROGRAPH_NAME is not present, use the id as a name micName = micId if coordRow.hasLabel(md.RLN_MICROGRAPH_NAME): micName = coordRow.getValue(md.RLN_MICROGRAPH_NAME) coord.setMicName(micName) else: coord = None return coord
def getParticleList(start=1, end=3): """ Mocks a Particle dict""" newPartDict = {} for index in range(start, end + 1): part = Particle() coord = Coordinate() coord.setMicId(index) coord.setMicName(getMicNameFromId(index)) part.setCoordinate(coord) newPartDict[index] = part return newPartDict