genui.qsar package

Subpackages

Submodules

genui.qsar.admin module

class genui.qsar.admin.QSARModelAdmin(model, admin_site)[source]

Bases: ModelAdmin

inlines = [<class 'genui.qsar.admin.UnitsInline'>]
property media
readonly_fields = ['created', 'updated']
class genui.qsar.admin.UnitsInline(parent_model, admin_site)[source]

Bases: TabularInline

property media
model

alias of QSARTrainingStrategy

genui.qsar.apps module

class genui.qsar.apps.QsarConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'genui.qsar'

genui.qsar.genuisetup module

genuisetup

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

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

genui.qsar.models module

class genui.qsar.models.DescriptorGroup(id, name, corePackage)[source]

Bases: ImportableModelComponent

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

corePackage

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

id

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

mappingstrategy_set

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.

name

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

objects = <django.db.models.manager.Manager object>
qsartrainingstrategy_set

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.

class genui.qsar.models.ModelActivity(id, polymorphic_ctype, value, type, units, source, molecule, parent, activity_ptr)[source]

Bases: Activity

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activity_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.

activity_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class genui.qsar.models.ModelActivitySet(id, polymorphic_ctype, name, description, created, updated, project, molecules, activityset_ptr, model)[source]

Bases: ActivitySet

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activityset_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.

activityset_ptr_id
model

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.

model_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
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.qsar.models.QSARModel(id, polymorphic_ctype, name, description, created, updated, project, builder, model_ptr, molset, predictionsType, predictionsUnits)[source]

Bases: Model

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

genuimodelscorer_set

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.

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
molset

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.

molset_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
predictions

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.

predictionsType

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.

predictionsType_id
predictionsUnits

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.

predictionsUnits_id
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.qsar.models.QSARTrainingStrategy(id, polymorphic_ctype, algorithm, mode, modelInstance, trainingstrategy_ptr, activityThreshold, activitySet, activityType)[source]

Bases: TrainingStrategy

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activitySet

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.

activitySet_id
activityThreshold

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

activityType

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.

activityType_id
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

genui.qsar.serializers module

serializers

Created by: Martin Sicho On: 13-01-20, 11:07

class genui.qsar.serializers.DescriptorGroupSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'name')
model

alias of DescriptorGroup

class genui.qsar.serializers.ModelActivitySetSerializer(*args, **kwargs)[source]

Bases: ActivitySetSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'molecules', 'className', 'extraArgs', 'model', 'taskID')
model

alias of ModelActivitySet

read_only_fields = ('created', 'updated', 'className', 'taskID', 'model', 'project')
class genui.qsar.serializers.QSARModelInitSerializer(*args, **kwargs)[source]

Bases: QSARModelSerializer

class Meta[source]

Bases: object

fields = ['id', 'name', 'description', 'created', 'updated', 'project', 'trainingStrategy', 'validationStrategy', 'modelFile', 'build', 'taskID', 'molset', 'predictionsType', 'predictionsUnits']
model

alias of QSARModel

read_only_fields = ('id', 'created', 'updated', 'modelFile', 'taskID', 'predictions')
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.

is_valid(raise_exception=True)[source]
class genui.qsar.serializers.QSARModelSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'trainingStrategy', 'validationStrategy', 'modelFile', 'build', 'taskID', 'molset', 'predictions', 'predictionsType', 'predictionsUnits')
model

alias of QSARModel

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

Bases: TrainingStrategyInitSerializer

class Meta[source]

Bases: object

fields = ('algorithm', 'mode', 'parameters', 'descriptors', 'activityThreshold', 'activityType', 'activitySet')
model

alias of QSARTrainingStrategy

class genui.qsar.serializers.QSARTrainingStrategySerializer(*args, **kwargs)[source]

Bases: TrainingStrategySerializer

class Meta[source]

Bases: object

fields = ('algorithm', 'mode', 'parameters', 'descriptors', 'activityThreshold', 'activityType', 'activitySet')
model

alias of QSARTrainingStrategy

genui.qsar.tasks module

tasks

Created by: Martin Sicho On: 29-11-19, 13:44

genui.qsar.tests module

class genui.qsar.tests.ModelInitTestCase(methodName='runTest')[source]

Bases: QSARModelInit, APITestCase

test_create_view_classification()[source]
test_create_view_from_file_classification()[source]
test_create_view_regression()[source]
class genui.qsar.tests.QSARModelInit[source]

Bases: CompoundsMixIn

createTestQSARModel(activitySet=None, activityType=None, mode=None, algorithm=None, parameters=None, descriptors=None, metrics=None)[source]
predictWithModel(model, to_predict)[source]
setUp()[source]
uploadModel(filePath, algorithm, mode, descriptors, predictionsType, predictionsUnits)[source]

genui.qsar.urls module

urls

Created by: Martin Sicho On: 02-12-19, 17:18

genui.qsar.views module

class genui.qsar.views.DescriptorGroupsViewSet(**kwargs)[source]

Bases: ListModelMixin, RetrieveModelMixin, GenericViewSet

basename = None
description = None
detail = None
name = None
queryset
serializer_class

alias of DescriptorGroupSerializer

suffix = None
class genui.qsar.views.QSARAlgorithmViewSet(**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.qsar.views.QSARMetricsViewSet(**kwargs)[source]

Bases: MetricsViewSet

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.qsar.views.QSARModelViewSet(**kwargs)[source]

Bases: PredictMixIn, ModelViewSet

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

alias of BasicQSARModelBuilder

description = None
detail = None
init_serializer_class

alias of QSARModelInitSerializer

name = None
predict_task = <@task: PredictWithQSARModel of genui>
predictions(request, pk=None)[source]
queryset
serializer_class

alias of QSARModelSerializer

suffix = None

Module contents