Skip to content
Snippets Groups Projects
structurefactors_model.py 1.64 KiB
Newer Older
root's avatar
root committed
# Python imports
from uuid import uuid4
root's avatar
root committed
# Third-party imports
from neomodel import StructuredNode, StringProperty, IntegerProperty, UniqueIdProperty, RelationshipTo

# Models imports
# from api.models.dpstep_model import DPStep
root's avatar
root committed
from api.models.mtzfile_model import MTZ
from api.models.scalepackfile_model import ScalepackFile
from api.models.reference_model import Reference
# from api.models.construct_model import Construct

class StructureFactors(StructuredNode):
root's avatar
root committed
	
	"""
	Defines node properties and relationships
	Provides data serializer
	"""

	# Properties
root's avatar
root committed
	uuid=StringProperty(unique_index=True, default=uuid4)
	# processingtype=StringProperty()
	gamma=IntegerProperty()
	a=IntegerProperty()
	alpha=IntegerProperty()
	b=IntegerProperty()
	beta=IntegerProperty()
	c=IntegerProperty()
	# rsf_source=StringProperty()
	# rsf_filesize=StringProperty()
	# rsf_filepath=StringProperty()
root's avatar
root committed
	# Relationships
root's avatar
root committed
	is_scalepack=RelationshipTo('ScalepackFile', 'IS')
	is_mtz=RelationshipTo('MTZfile', 'IS')
	labelled_ref=RelationshipTo('Reference', 'LABELLED_AS')
	# input_as_ref=RelationshipTo('DPStep', 'INPUT_AS_REFERENCE')
	# input_of=RelationshipTo('DPStep', 'INPUT')
	# belongs=RelationshipTo('Construct', 'BELONGS')
root's avatar
root committed
	@property
	def serialize(self):
root's avatar
root committed
		"""
		Serializer for node properties
		"""
		
		return {
root's avatar
root committed
		'structurefactors_node_properties': {
		'uuid': self.uuid,
		# 'rsf_source': self.rsf_source,
		# 'rsf_filesize': self.rsf_filesize,
		# 'rsf_filepath': self.rsf_filepath,
		# 'datatype': self.datatype,
		# 'processingtype': self.processingtype,
		'gamma': self.gamma,
		'a': self.alpha,
		'b': self.b,
		'beta': self.beta,
		'c': self.c,
		'alpha': self.alpha,
root's avatar
root committed
		}