genui.maps package

Subpackages

Submodules

genui.maps.admin module

class genui.maps.admin.MapAdmin(model, admin_site)[source]

Bases: ModelAdmin

property media

genui.maps.apps module

class genui.maps.apps.MapsConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'genui.maps'

genui.maps.genuisetup module

genuisetup

Created by: Martin Sicho On: 4/28/20, 5:02 PM

genui.maps.genuisetup.setup(*args, **kwargs)[source]

genui.maps.models module

class genui.maps.models.Map(id, polymorphic_ctype, name, description, created, updated, project, builder, model_ptr)[source]

Bases: Model

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

property chemspaceJSON
getChemSpaceJSDict(properties=('AMW', 'NUMHEAVYATOMS', 'NUMAROMATICRINGS', 'HBA', 'HBD', 'LOGP', 'TPSA'), file=None)[source]
model_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

model_ptr_id
molsets

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

points

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
saveChemSpaceJSON()[source]
tasks

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

class genui.maps.models.MappingStrategy(id, polymorphic_ctype, algorithm, mode, modelInstance, trainingstrategy_ptr)[source]

Bases: TrainingStrategy

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

descriptors

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
trainingstrategy_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

trainingstrategy_ptr_id
class genui.maps.models.Point(id, map, molecule, x, y)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

property compoundSets
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

map

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

map_id
molecule

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

molecule_id
objects = <django.db.models.manager.Manager object>
property smiles
x

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

y

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

genui.maps.serializers module

serializers

Created by: Martin Sicho On: 25-02-20, 16:35

class genui.maps.serializers.MapInitSerializer(*args, **kwargs)[source]

Bases: MapSerializer

class Meta[source]

Bases: object

fields = ['id', 'name', 'description', 'created', 'updated', 'project', 'trainingStrategy', 'modelFile', 'build', 'taskID', 'molsets', 'chemspaceJSON']
model

alias of Map

read_only_fields = ['id', 'created', 'updated', 'modelFile', 'taskID']
create(validated_data, **kwargs)[source]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.

class genui.maps.serializers.MapSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ['id', 'name', 'description', 'created', 'updated', 'project', 'trainingStrategy', 'modelFile', 'build', 'taskID', 'molsets', 'chemspaceJSON']
model

alias of Map

read_only_fields = ['id', 'created', 'updated', 'modelFile', 'taskID']
class genui.maps.serializers.MappingStrategyInitSerializer(*args, **kwargs)[source]

Bases: TrainingStrategyInitSerializer

class Meta[source]

Bases: object

fields = ('algorithm', 'mode', 'parameters', 'descriptors')
model

alias of MappingStrategy

class genui.maps.serializers.MappingStrategySerializer(*args, **kwargs)[source]

Bases: TrainingStrategySerializer

class Meta[source]

Bases: object

fields = ('algorithm', 'mode', 'parameters', 'descriptors')
model

alias of MappingStrategy

class genui.maps.serializers.PointSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'x', 'y', 'map', 'molecule', 'smiles', 'compoundSets')
model

alias of Point

genui.maps.tasks module

tasks

Created by: Martin Sicho On: 25-02-20, 16:37

genui.maps.tests module

class genui.maps.tests.MapTestCase(methodName='runTest')[source]

Bases: CompoundsMixIn, APITestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_create_map()[source]

genui.maps.urls module

urls

Created by: Martin Sicho On: 25-02-20, 16:29

genui.maps.views module

class genui.maps.views.MapViewSet(**kwargs)[source]

Bases: ModelViewSet

basename = None
build_task = <@task: CreateMap of genui>
builder_class

alias of MapBuilder

description = None
detail = None
init_serializer_class

alias of MapInitSerializer

name = None
queryset
serializer_class

alias of MapSerializer

suffix = None
class genui.maps.views.MappingAlgViewSet(**kwargs)[source]

Bases: AlgorithmViewSet

basename = None
description = None
detail = None
get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

name = None
suffix = None
class genui.maps.views.PointPagination[source]

Bases: GenuiPagination

page_size = 250
class genui.maps.views.PointsView(**kwargs)[source]

Bases: FilterToModelMixin, FilterToUserMixIn, ListAPIView

lookup_field = 'map'
owner_relation = 'map__project__owner'
pagination_class

alias of PointPagination

queryset
serializer_class

alias of PointSerializer

Module contents