genui.compounds package

Subpackages

Submodules

genui.compounds.admin module

class genui.compounds.admin.ActivitySetAdmin(model, admin_site)[source]

Bases: ModelAdmin

property media
readonly_fields = ['created', 'updated']
class genui.compounds.admin.MolAdmin(model, admin_site)[source]

Bases: ModelAdmin

property media
class genui.compounds.admin.MolSetAdmin(model, admin_site)[source]

Bases: ModelAdmin

property media
readonly_fields = ['created', 'updated']

genui.compounds.apps module

class genui.compounds.apps.CompoundsConfig(app_name, app_module)[source]

Bases: AppConfig

name = 'genui.compounds'
ready(force=False)[source]

Override this method in subclasses to run code when Django starts.

genui.compounds.genuisetup module

genuisetup

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

genui.compounds.genuisetup.discoverExporters(app, exporters_module='exporters')[source]
genui.compounds.genuisetup.setup(*args, **kwargs)[source]

genui.compounds.helpers module

helpers

Created by: Martin Sicho On: 02-03-20, 14:21

genui.compounds.helpers.createPic(mol: Molecule, format: PictureFormat)[source]

genui.compounds.models module

class genui.compounds.models.Activity(id, polymorphic_ctype, value, type, units, source, molecule, parent)[source]

Bases: PolymorphicModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

chemblactivity

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

children

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.

id

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

modelactivity

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

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
parent

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.

parent_id
polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
source

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.

source_id
type

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.

type_id
units

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.

units_id
value

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

class genui.compounds.models.ActivitySet(id, polymorphic_ctype, name, description, created, updated, project, molecules)[source]

Bases: TaskShortcutsMixIn, TaskMixin, DataSet

class ActivitySetSummary(activitySet: ActivitySet)[source]

Bases: object

generateTypeSummaries()[source]
getTypeInfo()[source]
class ActivityTypeSummary(activityType: ActivityTypes, compounds: Molecule, occurences: Activity)[source]

Bases: object

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activities

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.

chemblactivities

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

cleanForModelling(activity_type: ActivityTypes) tuple[source]

A procedure that returns molecules as Molecule instances and their activities to be used by QSAR and other models. This is a very basic implementation and should be overridden in children.

Returns

Tuple of list objects (same length) -> Molecule instances and their associated activity values for models

created

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

description

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

drugexenvironmentscores

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

getActivityTypes()[source]
getSummary()[source]
get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)
id

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

modelactivityset

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

molecules

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.

molecules_id
name

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

objects = <genui.utils.extensions.tasks.models.PolymorphicTaskManager object>
polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
project

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.

project_id
qsartrainingstrategy_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.

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.

updated

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

class genui.compounds.models.ActivityTypes(id, value)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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

id

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

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

value

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

class genui.compounds.models.ActivityUnits(id, value)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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

id

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

value

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

class genui.compounds.models.ChemicalEntity(id, canonicalSMILES, inchi, inchiKey, rdMol, morganFP)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

canonicalSMILES

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

property fingerprint
id

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

inchi

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

inchiKey

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

molecules

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.

morganFP

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>
rdMol

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

class genui.compounds.models.MolSet(id, polymorphic_ctype, name, description, created, updated, project)[source]

Bases: TaskShortcutsMixIn, TaskMixin, DataSet

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activities

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.

property allSmiles
chemblcompounds

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

created

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

csvcompounds

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

description

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

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

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

exports

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.

files

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.

generatedmolset

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)
id

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

maps

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.

models

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.

molecules

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 = <genui.utils.extensions.tasks.models.PolymorphicTaskManager object>
polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
project

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.

project_id
sdfcompounds

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

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.

updated

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

class genui.compounds.models.MolSetExport(id, name, description, molset, exporter)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

description

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

exporter

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.

exporter_id
files

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.

id

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

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
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>
class genui.compounds.models.MolSetExporter(id, name, classPath)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

classPath

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.

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

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>
class genui.compounds.models.MolSetFile(id, polymorphic_ctype, molset, file, export)[source]

Bases: PolymorphicModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

static create(molset, filename, file)[source]
export

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.

export_id
file

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
id

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

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_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class genui.compounds.models.Molecule(id, polymorphic_ctype, entity)[source]

Bases: PolymorphicModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

activities

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.

property canonicalSMILES
chemblmolecule

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

classmethod create(canonicalSMILES, inchiKey, rdMol, *args, **kwargs)[source]
csvmolecule

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

entity

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.

entity_id
property fingerprint
getPic(format)[source]
id

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

property inchi
property inchiKey
property mainPic
pics

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.

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

polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
providers

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.

property rdMol
sdfmolecule

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

In the example:

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

Place.restaurant is a ReverseOneToOneDescriptor instance.

property smiles

A shorthand to get a nice human readable SMILES string directly from representation.

class genui.compounds.models.MoleculePic(id, format, molecule, image)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

format

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.

format_id
id

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

image

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

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>
class genui.compounds.models.PictureFormat(id, extension)[source]

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

FILE_TYPES = [('.png', 'PNG'), ('.svg', 'SVG')]
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

PNG = '.png'
SVG = '.svg'
extension

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

get_extension_display(*, field=<django.db.models.fields.CharField: extension>)
id

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

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

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

genui.compounds.serializers module

serializers

Created by: Martin Sicho On: 18-12-19, 10:27

class genui.compounds.serializers.ActivitySerializer(*args, **kwargs)[source]

Bases: GenericModelSerializerMixIn, HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'value', 'type', 'units', 'source', 'molecule', 'parent', 'className', 'extraArgs')
model

alias of Activity

class genui.compounds.serializers.ActivitySetSerializer(*args, **kwargs)[source]

Bases: GenericModelSerializerMixIn, HyperlinkedModelSerializer

class Meta[source]

Bases: object

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

alias of ActivitySet

read_only_fields = ('created', 'updated', 'className')
class genui.compounds.serializers.ActivitySetSummarySerializer(*args, **kwargs)[source]

Bases: Serializer

class genui.compounds.serializers.ActivityTypeSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

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

alias of ActivityTypes

read_only_fields = ('id',)
class genui.compounds.serializers.ActivityTypeSummary(*args, **kwargs)[source]

Bases: Serializer

class genui.compounds.serializers.ActivityUnitsSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

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

alias of ActivityUnits

read_only_fields = ('id',)
class genui.compounds.serializers.GenericMolSetSerializer(*args, **kwargs)[source]

Bases: GenericModelSerializerMixIn, MolSetSerializer

class Meta[source]

Bases: object

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

alias of MolSet

read_only_fields = ('created', 'updated', 'extraArgs', 'activities')
class genui.compounds.serializers.MolSetExportSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'molset', 'files', 'exporter')
model

alias of MolSetExport

read_only_fields = ('molset', 'files')
create(validated_data)[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.compounds.serializers.MolSetExporterSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

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

alias of MolSetExporter

class genui.compounds.serializers.MolSetFileSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'molset', 'file')
model

alias of MolSetFile

read_only_fields = ('id',)
create(validated_data)[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.compounds.serializers.MolSetSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class AutoSchemaMixIn[source]

Bases: object

get_operation(path, method)[source]
class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'activities', 'files')
model

alias of MolSet

read_only_fields = ('created', 'updated', 'activities', 'files')
class genui.compounds.serializers.MolSetUpdateSerializer(*args, **kwargs)[source]

Bases: MolSetSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'activities', 'files', 'updateData')
model

alias of MolSet

read_only_fields = ('created', 'updated', 'activities', 'files')
update(instance, validated_data)[source]
class genui.compounds.serializers.MoleculePicSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('format', 'image', 'molecule')
model

alias of MoleculePic

class genui.compounds.serializers.MoleculeSerializer(*args, **kwargs)[source]

Bases: GenericModelSerializerMixIn, HyperlinkedModelSerializer

class Meta[source]

Bases: object

fields = ('id', 'smiles', 'inchi', 'inchiKey', 'providers', 'mainPic', 'properties', 'className', 'extraArgs')
model

alias of Molecule

get_properties(obj)[source]
class genui.compounds.serializers.PictureFormatSerializer(*args, **kwargs)[source]

Bases: HyperlinkedModelSerializer

class Meta[source]

Bases: object

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

alias of PictureFormat

genui.compounds.signals module

signals

Created by: Martin Sicho On: 1/5/20, 5:40 PM

genui.compounds.signals.delete_molset_files(sender, instance, using, **kwargs)[source]
genui.compounds.signals.delete_molset_finish_tasks(sender, instance, using, **kwargs)[source]
genui.compounds.signals.delete_pic_files(sender, instance, using, **kwargs)[source]

genui.compounds.tasks module

tasks

Created by: Martin Sicho On: 18-12-19, 13:14

genui.compounds.tasks.populate(self, molset_id, initializer_class, initializer_kwargs=None)[source]

genui.compounds.tests module

tests

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

class genui.compounds.tests.CompoundsMixIn[source]

Bases: ProjectMixIn

createMolSet(url, appendData)[source]
class genui.compounds.tests.DuplicateEntitiesTest(methodName='runTest')[source]

Bases: ProjectMixIn, APITestCase

class InitializerWithMultipleEntities(instance: MolSet, progress_recorder=None, standardizer=None)[source]

Bases: MolSetInitializer

populateInstance() int[source]
updateInstance() int[source]
test_create()[source]

genui.compounds.urls module

urls

Created by: Martin Sicho On: 04-12-19, 15:01

genui.compounds.views module

class genui.compounds.views.ActivityPagination[source]

Bases: GenuiPagination

page_size = 10
class genui.compounds.views.ActivitySetViewSet(**kwargs)[source]

Bases: FilterToProjectMixIn, FilterToUserMixIn, ListModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet

activities(request, pk=None)[source]
basename = None
description = None
detail = None
list(request, *args, **kwargs)[source]
mols_param = {'description': 'Only return activities for the given molecule IDs.', 'in': 'query', 'items': {'type': 'integer'}, 'name': 'mols', 'type': 'array'}
name = None
owner_relation = 'project__owner'
project_id_param = {'description': 'Return activity sets related to just this project.', 'in': 'query', 'name': 'project_id', 'type': 'number'}
queryset
serializer_class

alias of ActivitySetSerializer

suffix = None
summary(request, pk)[source]
class genui.compounds.views.BaseMolSetViewSet(**kwargs)[source]

Bases: FilterToProjectMixIn, FilterToUserMixIn, NestedViewSetMixin, ModelViewSet

class Schema(tags=None, operation_id_base=None, component_name=None)[source]

Bases: AutoSchemaMixIn, AutoSchema

create(request, *args, **kwargs)[source]
files(request, pk=None)[source]
get_initializer_additional_arguments(validated_data)[source]

This needs to return a JSON-parsable object.

Parameters

validated_data

Returns

get_initializer_class()[source]
get_updater_additional_arguments(validated_data)[source]

This needs to return a JSON-parsable object.

Parameters

validated_data

Returns

get_updater_class()[source]
gpu_support = False
initializer_class = None
list(request, *args, **kwargs)[source]
owner_relation = 'project__owner'
project_id_param = {'description': 'Return compound sets related to just the project with a given ID.', 'in': 'query', 'name': 'project_id', 'type': 'number'}
schema
update(request, *args, **kwargs)[source]
updater_class = None
class genui.compounds.views.MolSetExportViewSet(**kwargs)[source]

Bases: NestedViewSetMixin, ModelViewSet

basename = None
description = None
detail = None
model

alias of MolSetExport

name = None
queryset
serializer_class

alias of MolSetExportSerializer

suffix = None
class genui.compounds.views.MolSetExporterViewSet(**kwargs)[source]

Bases: GenericViewSet, RetrieveModelMixin, ListModelMixin

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

alias of MolSetExporterSerializer

suffix = None
class genui.compounds.views.MolSetMoleculesView(**kwargs)[source]

Bases: ListAPIView

get(request, pk)[source]
pagination_class

alias of MoleculePagination

queryset
class genui.compounds.views.MolSetViewSet(**kwargs)[source]

Bases: FilterToProjectMixIn, FilterToUserMixIn, RetrieveModelMixin, ListModelMixin, DestroyModelMixin, GenericViewSet

basename = None
description = None
detail = None
list(request, *args, **kwargs)[source]
name = None
owner_relation = 'project__owner'
project_id_param = {'description': 'Return compound sets related to just this project.', 'in': 'query', 'name': 'project_id', 'type': 'number'}
queryset
serializer_class

alias of GenericMolSetSerializer

suffix = None
class genui.compounds.views.MoleculePagination[source]

Bases: GenuiPagination

page_size = 5
class genui.compounds.views.MoleculeViewSet(**kwargs)[source]

Bases: FilterToUserMixIn, RetrieveModelMixin, GenericViewSet

activities(request, pk=None)[source]
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)

molset_id_param = {'description': 'Return only activities that belong to a certain activity set.', 'in': 'query', 'name': 'activity_set', 'type': 'number'}
name = None
owner_relation = 'providers__project__owner'
pagination_class

alias of MoleculePagination

properties = {'description': 'Attach specified physchem properties to the response. You should be able to use all properties listed here: https://django-rdkit.readthedocs.io/en/latest/functions.html', 'in': 'query', 'items': {'type': 'string'}, 'name': 'properties', 'type': 'array'}
queryset
retrieve(request, *args, **kwargs)[source]
serializer_class

alias of MoleculeSerializer

suffix = None

Module contents