Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change references to "populations" in API to "ancestry groups" #1457

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
27 changes: 27 additions & 0 deletions graphql-api/src/graphql/resolvers/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ const resolvers = {
ac_hom: fieldAliasResolver('homozygote_count'),
ac_hemi: fieldAliasResolver('hemizygote_count'),
af: (obj: any) => (obj.an === 0 ? 0 : obj.ac / obj.an),
ancestry_groups: fieldAliasResolver('populations'),
},
VariantDetailsSequencingTypeData: {
qualityMetrics: fieldAliasResolver('quality_metrics'),
ac_hom: fieldAliasResolver('homozygote_count'),
ac_hemi: fieldAliasResolver('hemizygote_count'),
af: (obj: any) => (obj.an === 0 ? 0 : obj.ac / obj.an),
ancestry_groups: fieldAliasResolver('populations'),
local_ancestry_groups: fieldAliasResolver('local_ancestry_populations'),
},
VariantPopulation: {
ac_hom: fieldAliasResolver('homozygote_count'),
Expand All @@ -84,6 +87,7 @@ const resolvers = {
consequence: fieldAliasResolver('major_consequence'),
ac_hom: fieldAliasResolver('homozygote_count'),
ac_hemi: fieldAliasResolver('hemizygote_count'),
ancestry_groups: fieldAliasResolver('populations'),
},
StructuralVariantPopulation: {
ac_hom: fieldAliasResolver('homozygote_count'),
Expand All @@ -106,6 +110,29 @@ const resolvers = {
MitochondrialVariantDetails: {
// Single rsID
rsid: (obj: any) => (obj.rsids || [])[0],
ancestry_groups: fieldAliasResolver('populations'),
},
CopyNumberVariantDetails: {
ancestry_groups: fieldAliasResolver('populations'),
},
ShortTandemRepeatAlleleSizeDistribution: {
ancestry_groups: fieldAliasResolver('populations'),
},
ShortTandemRepeatAlleleSizeDistributionRepeatUnit: {
ancestry_groups: fieldAliasResolver('populations'),
},
ShortTandemRepeatGenotypeDistribution: {
ancestry_groups: fieldAliasResolver('populations'),
},
ShortTandemRepeatGenotypeDistributionRepeatUnit: {
ancestry_groups: fieldAliasResolver('populations'),
},
VariantCooccurrence: {
ancestry_groups: fieldAliasResolver('populations'),
},
VariantFilteringAlleleFrequency: {
grpmax: fieldAliasResolver('popmax'),
grpmax_ancestry_group: fieldAliasResolver('popmax_population'),
},
}

Expand Down
86 changes: 47 additions & 39 deletions graphql-api/src/graphql/types/copy-number-variant.graphql
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
type CopyNumberVariantAncestryGroup {
id: String!
sc: Float!
sn: Float!
sf: Float!
}

type CopyNumberVariantPopulation {
id: String!
sc: Float!
sn: Float!
sf: Float!
id: String! @deprecated(reason: "Use CopyNumberVariantAncestryGroup.id")
sc: Float! @deprecated(reason: "Use CopyNumberVariantAncestryGroup.sc")
sn: Float! @deprecated(reason: "Use CopyNumberVariantAncestryGroup.sn")
sf: Float! @deprecated(reason: "Use CopyNumberVariantAncestryGroup.sf")
}

type CopyNumberVariant {
sc: Float!
sn: Float!
sf: Float!
reference_genome: ReferenceGenomeId!
chrom: String!
end: Int!
filters: [String!]
length: Int
pos: Int!
type: String
posmin: Int
posmax: Int
endmin: Int
endmax: Int
variant_id: String!
sc: Float!
sn: Float!
sf: Float!
reference_genome: ReferenceGenomeId!
chrom: String!
end: Int!
filters: [String!]
length: Int
pos: Int!
type: String
posmin: Int
posmax: Int
endmin: Int
endmax: Int
variant_id: String!
}

type CopyNumberVariantDetails {
alts: [String!]
sc: Float!
sn: Float!
sf: Float!
chrom: String!
end: Int!
filters: [String!]
genes: [String!]
length: Int
populations: [CopyNumberVariantPopulation!]
pos: Int!
qual: Float
reference_genome: ReferenceGenomeId!
type: String
posmin: Int
posmax: Int
endmin: Int
endmax: Int
variant_id: String!
alts: [String!]
sc: Float!
sn: Float!
sf: Float!
chrom: String!
end: Int!
filters: [String!]
genes: [String!]
length: Int
ancestry_groups: [CopyNumberVariantAncestryGroup!]
populations: [CopyNumberVariantPopulation!] @deprecated(reason: "Use ancestry_groups")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field deprecation story is one of the nice things about GraphQL I have to say.

pos: Int!
qual: Float
reference_genome: ReferenceGenomeId!
type: String
posmin: Int
posmax: Int
endmin: Int
endmax: Int
variant_id: String!
}

type CNVTrackCallableCoverageBin {
xpos: Float!
percent_callable: Float
}
}
14 changes: 12 additions & 2 deletions graphql-api/src/graphql/types/mitochondria.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ type MitochondrialVariantAgeDistribution {
hom: Histogram
}

type MitochondrialVariantPopulation {
type MitochondrialVariantAncestryGroup {
id: String!
an: Int!
ac_het: Int!
ac_hom: Int!
heteroplasmy_distribution: Histogram!
}

type MitochondrialVariantPopulation {
id: String! @deprecated(reason: "Use MitochondrialVariantAncestryGroup.id")
an: Int! @deprecated(reason: "Use MitochondrialVariantAncestryGroup.an")
ac_het: Int! @deprecated(reason: "Use MitochondrialVariantAncestryGroup.ac_het")
ac_hom: Int! @deprecated(reason: "Use MitochondrialVariantAncestryGroup.ac_hom")
heteroplasmy_distribution: Histogram!
@deprecated(reason: "Use MitochondrialVariantAncestryGroup.heteroplasmy_distribution")
}

type MitochondrialVariantHaplogroup {
id: String
an: Float
Expand Down Expand Up @@ -79,7 +88,8 @@ type MitochondrialVariantDetails {
mitotip_trna_prediction: String
pon_ml_probability_of_pathogenicity: Float
pon_mt_trna_prediction: String
populations: [MitochondrialVariantPopulation!]!
ancestry_groups: [MitochondrialVariantAncestryGroup!]!
populations: [MitochondrialVariantPopulation!]! @deprecated(reason: "Use ancestry_groups")
pos: Int!
ref: String!
reference_genome: ReferenceGenomeId!
Expand Down
24 changes: 22 additions & 2 deletions graphql-api/src/graphql/types/short-tandem-repeat.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,57 @@ type ShortTandemRepeatRepeatUnit {
classification: String!
}

type ShortTandemRepeatAlleleSizeDistributionPopulation {
type ShortTandemRepeatAlleleSizeDistributionAncestryGroup {
id: String!
distribution: [[Int!]!]!
}

type ShortTandemRepeatAlleleSizeDistributionPopulation {
id: String! @deprecated(reason: "Use ShortTandemRepeatAlleleSizeDistributionAncestryGroup.id")
distribution: [[Int!]!]!
@deprecated(reason: "Use ShortTandemRepeatAlleleSizeDistributionAncestryGroup.distribution")
}

type ShortTandemRepeatAlleleSizeDistributionRepeatUnit {
repeat_unit: String!
distribution: [[Int!]!]!
ancestry_groups: [ShortTandemRepeatAlleleSizeDistributionAncestryGroup!]!
populations: [ShortTandemRepeatAlleleSizeDistributionPopulation!]!
@deprecated(reason: "Use ancestry_groups")
}

type ShortTandemRepeatAlleleSizeDistribution {
distribution: [[Int!]!]!
ancestry_groups: [ShortTandemRepeatAlleleSizeDistributionAncestryGroup!]!
populations: [ShortTandemRepeatAlleleSizeDistributionPopulation!]!
@deprecated(reason: "Use ancestry_groups")
repeat_units: [ShortTandemRepeatAlleleSizeDistributionRepeatUnit!]!
}

type ShortTandemRepeatGenotypeDistributionPopulation {
type ShortTandemRepeatGenotypeDistributionAncestryGroup {
id: String!
distribution: [[Int!]!]!
}

type ShortTandemRepeatGenotypeDistributionPopulation {
id: String! @deprecated(reason: "Use ShortTandemRepeatGenotypeDistributionAncestryGroup.id")
distribution: [[Int!]!]!
@deprecated(reason: "Use ShortTandemRepeatGenotypeDistributionAncestryGroup.distribution")
}

type ShortTandemRepeatGenotypeDistributionRepeatUnit {
repeat_units: [String!]!
distribution: [[Int!]!]!
ancestry_groups: [ShortTandemRepeatGenotypeDistributionAncestryGroup!]!
populations: [ShortTandemRepeatGenotypeDistributionPopulation!]!
@deprecated(reason: "Use ancestry_groups")
}

type ShortTandemRepeatGenotypeDistribution {
distribution: [[Int!]!]!
ancestry_groups: [ShortTandemRepeatGenotypeDistributionAncestryGroup!]!
populations: [ShortTandemRepeatGenotypeDistributionPopulation!]!
@deprecated(reason: "Use ancestry_groups")
repeat_units: [ShortTandemRepeatGenotypeDistributionRepeatUnit!]!
}

Expand Down
19 changes: 14 additions & 5 deletions graphql-api/src/graphql/types/structural-variant.graphql
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
type StructuralVariantPopulation {
type StructuralVariantAncestryGroup {
id: String!
ac: Int!
an: Int!
homozygote_count: Int
hemizygote_count: Int
ac_hemi: Int @deprecated(reason: "Use hemizygote_count")
ac_hom: Int @deprecated(reason: "Use homozygote_count")
}

# Deprecated - replaced by homozygote/hemizygote count
ac_hemi: Int
ac_hom: Int
type StructuralVariantPopulation {
id: String! @deprecated(reason: "Use StructuralVariantAncestryGroup.id")
ac: Int! @deprecated(reason: "Use StructuralVariantAncestryGroup.ac")
an: Int! @deprecated(reason: "Use StructuralVariantAncestryGroup.an")
homozygote_count: Int @deprecated(reason: "Use StructuralVariantAncestryGroup.homozygote_count")
hemizygote_count: Int @deprecated(reason: "Use StructuralVariantAncestryGroup.hemizygote_count")
ac_hemi: Int @deprecated(reason: "Use StructuralVariantAncestryGroup.hemizygote_count")
ac_hom: Int @deprecated(reason: "Use StructuralVariantAncestryGroup.homozygote_count")
}

type StructuralVariantAgeDistribution {
Expand Down Expand Up @@ -87,7 +95,8 @@ type StructuralVariantDetails {
genes: [String!]
genotype_quality: StructuralVariantGenotypeQuality
length: Int
populations: [StructuralVariantPopulation!]
ancestry_groups: [StructuralVariantAncestryGroup!]
populations: [StructuralVariantPopulation!] @deprecated(reason: "Use ancestry_groups")
pos: Int!
pos2: Int
qual: Float
Expand Down
15 changes: 13 additions & 2 deletions graphql-api/src/graphql/types/variant-cooccurrence.graphql
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
type VariantCooccurrenceInPopulation {
type VariantCooccurrenceInAncestryGroup {
id: String!
genotype_counts: [Int!]!
haplotype_counts: [Float!]!
p_compound_heterozygous: Float
}

type VariantCooccurrenceInPopulation {
id: String! @deprecated(reason: "Use VariantCooccurrenceInAncestryGroup.id")
genotype_counts: [Int!]!
@deprecated(reason: "Use VariantCooccurrenceInAncestryGroup.genotype_counts")
haplotype_counts: [Float!]!
@deprecated(reason: "Use VariantCooccurrenceInAncestryGroup.haplotype_counts")
p_compound_heterozygous: Float
@deprecated(reason: "Use VariantCooccurrenceInAncestryGroup.p_compound_heterozygous")
}

type VariantCooccurrence {
variant_ids: [String!]!
genotype_counts: [Int!]!
haplotype_counts: [Float!]!
p_compound_heterozygous: Float
populations: [VariantCooccurrenceInPopulation!]!
ancestry_groups: [VariantCooccurrenceInAncestryGroup!]!
populations: [VariantCooccurrenceInPopulation!]! @deprecated(reason: "Use ancestry_groups")
}
Loading
Loading