from chembl_webservices.resources.mechanism import MechanismResource from chembl_webservices.resources.protein_class import ProteinClassResource from chembl_webservices.resources.source import SourceResource from chembl_webservices.resources.molecule import MoleculeResource from chembl_webservices.resources.molecule_forms import MoleculeFormsResource from chembl_webservices.resources.target import TargetResource from chembl_webservices.resources.target_components import TargetComponentsResource from chembl_webservices.resources.status import StatusResource from chembl_webservices.resources.image import ImageResource from chembl_webservices.resources.substructure import SubstructureResource from chembl_webservices.resources.similarity import SimilarityResource from chembl_webservices.resources.chembl_id import ChemblIdLookupResource from django.conf import settings monkeypatch_tastypie_field() DEFAULT_API_NAME='chembl_ws' try: api_name = settings.WS_NAME except AttributeError: api_name = DEFAULT_API_NAME api = ChEMBLApi(api_name=api_name) api.register(StatusResource()) api.register(DocsResource()) api.register(ActivityResource()) api.register(AtcResource()) api.register(AssayResource()) api.register(BindingSiteResource())
from tastypie.resources import ALL, ALL_WITH_RELATIONS from tastypie import fields from chembl_webservices.core.resource import ChemblModelResource from chembl_webservices.core.serialization import ChEMBLApiSerializer from chembl_webservices.core.meta import ChemblResourceMeta from chembl_webservices.core.utils import NUMBER_FILTERS, CHAR_FILTERS from django.db.models import Prefetch from chembl_core_model.models import BindingSites from chembl_core_model.models import SiteComponents from chembl_core_model.models import Domains from chembl_core_model.models import ComponentSequences from chembl_webservices.core.fields import monkeypatch_tastypie_field monkeypatch_tastypie_field() # ---------------------------------------------------------------------------------------------------------------------- class ComponentDomainsResource(ChemblModelResource): class Meta(ChemblResourceMeta): queryset = Domains.objects.all() resource_name = 'domain' collection_name = 'domains' serializer = ChEMBLApiSerializer(resource_name, {collection_name: resource_name}) filtering = { 'domain_description': CHAR_FILTERS, 'domain_id': NUMBER_FILTERS,