diff --git a/src/hub/dataload/sources/civic/graphql_contributor_avatars.py b/src/hub/dataload/sources/civic/graphql_contributor_avatars.py index 34d98fab..5d45ce0e 100644 --- a/src/hub/dataload/sources/civic/graphql_contributor_avatars.py +++ b/src/hub/dataload/sources/civic/graphql_contributor_avatars.py @@ -7,35 +7,29 @@ class GraphqlContributorAvatars(): OPERATION_NAME = "ContributorAvatars" QUERY = """ - query ContributorAvatars($subscribable: SubscribableInput!) { + query ContributorAvatars($subscribable: SubscribableInput!) { contributors(subscribable: $subscribable) { editors { - ...ContributorFields - __typename + ...ContributorFields } curators { - ...ContributorFields - __typename + ...ContributorFields } - __typename - } } + } - fragment ContributorFields on ContributingUser { + fragment ContributorFields on ContributingUser { user { id profileImagePath(size: 12) - __typename } uniqueActions { action count - __typename } lastActionDate totalActionCount - __typename - } + } """ def gql(self, variant_id: int): diff --git a/src/hub/dataload/sources/civic/graphql_detail.py b/src/hub/dataload/sources/civic/graphql_detail.py index d87b2d84..39d379ef 100644 --- a/src/hub/dataload/sources/civic/graphql_detail.py +++ b/src/hub/dataload/sources/civic/graphql_detail.py @@ -7,24 +7,21 @@ class GraphqlVariantDetail(): OPERATION_NAME = "VariantDetail" QUERY = """ - query VariantDetail($variantId: Int!) { + query VariantDetail($variantId: Int!) { variant(id: $variantId) { ...VariantDetailFields - __typename - } } + } - fragment VariantDetailFields on VariantInterface { + fragment VariantDetailFields on VariantInterface { id name deprecated deprecationReason deprecationActivity { parsedNote { - ...parsedCommentFragment - __typename + ...parsedCommentFragment } - __typename } feature { id @@ -32,23 +29,18 @@ class GraphqlVariantDetail(): link deprecated flagged - __typename } variantAliases flags(state: OPEN) { totalCount - __typename } openRevisionCount comments { totalCount - __typename - } - __typename } + } - fragment parsedCommentFragment on CommentBodySegment { - __typename + fragment parsedCommentFragment on CommentBodySegment { ... on CommentTagSegment { entityId displayName @@ -56,14 +48,12 @@ class GraphqlVariantDetail(): link revisionSetId feature { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } - __typename } ... on CommentTagSegmentFlagged { entityId @@ -73,14 +63,12 @@ class GraphqlVariantDetail(): link revisionSetId feature { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } - __typename } ... on CommentTagSegmentFlaggedAndWithStatus { entityId @@ -91,14 +79,12 @@ class GraphqlVariantDetail(): link revisionSetId feature { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } - __typename } ... on CommentTagSegmentFlaggedAndDeprecated { entityId @@ -109,26 +95,22 @@ class GraphqlVariantDetail(): link revisionSetId feature { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } - __typename } ... on CommentTextSegment { text - __typename } ... on User { id displayName role - __typename - } } + } """ def gql(self, variant_id: int): diff --git a/src/hub/dataload/sources/civic/graphql_dump.py b/src/hub/dataload/sources/civic/graphql_dump.py index 7fe158d9..6043bb49 100644 --- a/src/hub/dataload/sources/civic/graphql_dump.py +++ b/src/hub/dataload/sources/civic/graphql_dump.py @@ -1,7 +1,7 @@ from hub.dataload.sources.civic.graphql_variants import GraphqlVariants -from hub.dataload.sources.civic.graphql_molecular_profiles import ( - GraphqlMolecularProfiles, -) +# from hub.dataload.sources.civic.graphql_molecular_profiles import ( +# GraphqlMolecularProfiles, +# ) from hub.dataload.sources.civic.graphql_detail import GraphqlVariantDetail from hub.dataload.sources.civic.graphql_contributor_avatars import ( GraphqlContributorAvatars, @@ -37,9 +37,9 @@ def dump_variant(self, api_url: str, variant_id: int): res_detail = GraphqlVariantDetail().fetch( api_url=api_url, variant_id=variant_id ) - res_molecular_profiles = GraphqlMolecularProfiles().fetch( - api_url=api_url, variant_id=variant_id - ) + # res_molecular_profiles = GraphqlMolecularProfiles().fetch( + # api_url=api_url, variant_id=variant_id + # ) res_contributor_avatars = GraphqlContributorAvatars().fetch( api_url=api_url, variant_id=variant_id ) @@ -48,7 +48,7 @@ def dump_variant(self, api_url: str, variant_id: int): ) variant_data = {} - variant_data = self.merge_dicts(variant_data, res_molecular_profiles["data"]) + # variant_data = self.merge_dicts(variant_data, res_molecular_profiles["data"]) variant_data = self.merge_dicts(variant_data, res_contributor_avatars["data"]) variant_data = self.merge_dicts(variant_data, res_gene_variant["data"]["variant"]) variant_data = self.merge_dicts(variant_data, res_detail["data"]["variant"]) diff --git a/src/hub/dataload/sources/civic/graphql_gene.py b/src/hub/dataload/sources/civic/graphql_gene.py index ed519028..5046462c 100644 --- a/src/hub/dataload/sources/civic/graphql_gene.py +++ b/src/hub/dataload/sources/civic/graphql_gene.py @@ -7,85 +7,101 @@ class GraphqlGeneVariant(): OPERATION_NAME = "GeneVariant" QUERY = """ - query GeneVariant($variantId: Int!) { + query GeneVariant($variantId: Int!) { variant(id: $variantId) { - __typename id + feature { + id + name + } name molecularProfiles { - nodes { - name - id - evidenceItems { - edges { - node { - description - id + nodes { name - phenotypes { - description - hpoId - id - link - name - url - } - disease { - myDiseaseInfo { - omim - mondoId - mesh - icd10 - icdo - ncit - doDef - } - name - diseaseAliases - diseaseUrl - displayName - doid - id - link - } - variantOrigin - evidenceDirection - evidenceLevel - evidenceRating - evidenceType - flagged - significance - molecularProfile { - id - } - source { - citation + id + molecularProfileScore + molecularProfileAliases + variants { id name - sourceUrl - title - sourceType link - journal - pmcId - openAccess - publicationDate - retracted - retractionDate - retractionNature - retractionReasons - citationId - authorString - abstract } + evidenceItems { + edges { + node { + description + id + name + phenotypes { + description + hpoId + id + link + name + url + } + disease { + myDiseaseInfo { + omim + mondoId + mesh + icd10 + icdo + ncit + doDef + } + name + diseaseAliases + diseaseUrl + displayName + doid + id + link + } + variantOrigin + evidenceDirection + evidenceLevel + evidenceRating + evidenceType + flagged + significance + molecularProfile { + id + } + source { + citation + id + name + sourceUrl + title + sourceType + link + journal + pmcId + openAccess + publicationDate + retracted + retractionDate + retractionNature + retractionReasons + citationId + authorString + abstract + } + therapies { + id + name + link + deprecated + } + } + } + totalCount } } - totalCount - } } - } - } } + } """ def gql(self, variant_id: int): diff --git a/src/hub/dataload/sources/civic/graphql_summary.py b/src/hub/dataload/sources/civic/graphql_summary.py index dbceda65..7853cc20 100644 --- a/src/hub/dataload/sources/civic/graphql_summary.py +++ b/src/hub/dataload/sources/civic/graphql_summary.py @@ -7,18 +7,16 @@ class GraphqlVariantSummary(): OPERATION_NAME = "VariantSummary" QUERY = """ - query VariantSummary($variantId: Int!) { + query VariantSummary($variantId: Int!) { variant(id: $variantId) { ...VariantSummaryFields - __typename - } } + } - fragment VariantSummaryFields on VariantInterface { + fragment VariantSummaryFields on VariantInterface { id name feature { - __typename id name link @@ -31,78 +29,62 @@ class GraphqlVariantSummary(): link soid name - __typename } flags(state: OPEN) { totalCount - __typename } revisions(status: NEW) { totalCount - __typename } comments { totalCount - __typename } lastSubmittedRevisionEvent { originatingUser { - id - displayName - role - profileImagePath(size: 32) - __typename + id + displayName + role + profileImagePath(size: 32) } - __typename } lastAcceptedRevisionEvent { originatingUser { - id - displayName - role - profileImagePath(size: 32) - __typename + id + displayName + role + profileImagePath(size: 32) } - __typename } creationActivity { user { - id - displayName - role - profileImagePath(size: 32) - __typename + id + displayName + role + profileImagePath(size: 32) } createdAt - __typename } deprecationActivity { user { - id - displayName - role - profileImagePath(size: 32) - __typename + id + displayName + role + profileImagePath(size: 32) } createdAt - __typename } ... on GeneVariant { ...GeneVariantSummaryFields - __typename } ... on FactorVariant { ...FactorVariantSummaryFields - __typename } ... on FusionVariant { ...FusionVariantSummaryFields - __typename - } - __typename } + } - fragment GeneVariantSummaryFields on GeneVariant { + fragment GeneVariantSummaryFields on GeneVariant { alleleRegistryId openCravatUrl maneSelectTranscript @@ -110,16 +92,13 @@ class GraphqlVariantSummary(): clinvarIds coordinates { ...CoordinateFields - __typename } myVariantInfo { ...MyVariantInfoFields - __typename - } - __typename } + } - fragment CoordinateFields on VariantCoordinate { + fragment CoordinateFields on VariantCoordinate { referenceBuild ensemblVersion chromosome @@ -129,10 +108,9 @@ class GraphqlVariantSummary(): referenceBases variantBases coordinateType - __typename - } + } - fragment MyVariantInfoFields on MyVariantInfo { + fragment MyVariantInfoFields on MyVariantInfo { myVariantInfoId caddConsequence caddDetail @@ -195,83 +173,67 @@ class GraphqlVariantSummary(): siphy snpeffSnpEffect snpeffSnpImpact - __typename - } + } - fragment FactorVariantSummaryFields on FactorVariant { + fragment FactorVariantSummaryFields on FactorVariant { ncitId ncitDetails { ...NcitDetails - __typename - } - __typename } + } - fragment NcitDetails on NcitDetails { + fragment NcitDetails on NcitDetails { synonyms { name source - __typename } definitions { definition source - __typename - } - __typename } + } - fragment FusionVariantSummaryFields on FusionVariant { + fragment FusionVariantSummaryFields on FusionVariant { viccCompliantName fusion { fivePrimePartnerStatus fivePrimeGene { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } threePrimePartnerStatus threePrimeGene { - id - name - link - deprecated - flagged - __typename + id + name + link + deprecated + flagged } - __typename } fivePrimeCoordinates { ...CoordinateFields - __typename } threePrimeCoordinates { ...CoordinateFields - __typename } fivePrimeStartExonCoordinates { ...ExonCoordinateFields - __typename } fivePrimeEndExonCoordinates { ...ExonCoordinateFields - __typename } threePrimeStartExonCoordinates { ...ExonCoordinateFields - __typename } threePrimeEndExonCoordinates { ...ExonCoordinateFields - __typename - } - __typename } + } - fragment ExonCoordinateFields on ExonCoordinate { + fragment ExonCoordinateFields on ExonCoordinate { referenceBuild ensemblVersion chromosome @@ -284,8 +246,7 @@ class GraphqlVariantSummary(): ensemblId strand coordinateType - __typename - } + } """ def gql(self, variant_id: int):