Skip to content

Commit

Permalink
Merge pull request #305 from Breeding-Insight/bug/BI-1741
Browse files Browse the repository at this point in the history
BI-1741 - Genotype Import
  • Loading branch information
timparsons authored Mar 16, 2023
2 parents 04a0561 + 71e80fa commit 1c2e5c6
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/components/germplasm/GermplasmGenotypeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
v-bind:details="true"
v-if="!loading && callsetOptions.length > 0"
>
<b-table-column field="variantName" label="Variant" sortable searchable :customSearch="filterByVariant" :customSort="sortVariantName" :th-attrs="(column) => ({scope:'col'})">
<b-table-column field="variantName" label="Chromosome" sortable searchable :customSearch="filterByVariant" :customSort="sortVariantName" :th-attrs="(column) => ({scope:'col'})">
<template v-slot="props">
{{ getVariant(props.row.data.variantDbId).referenceName }}
</template>
Expand Down Expand Up @@ -94,7 +94,7 @@
</b-table-column>

<b-table-column label="Genotype(s)" v-slot="props" :th-attrs="(column) => ({scope:'col'})">
<span class="tag alt-allele" v-for="(allele, index) in getGenotypes(props.row.data)" :class="alleleType(allele)" :key="allele+'-'+index+'-'+props.index">
<span class="tag alt-allele" v-for="(allele, index) in getGenotypes(props.row.data)" :class="alleleType(allele, props.row.data.variantDbId)" :key="allele+'-'+index+'-'+props.index">
{{ genotypeVal(allele, props.row.data.variantDbId) }}
</span>
</b-table-column>
Expand Down Expand Up @@ -280,27 +280,17 @@ export default class GermplasmGenotypeView extends GermplasmBase {
}
}

alleleType(genotypeStr: string) {
const genotype: number = parseInt(genotypeStr);
if(genotype === 0) {
alleleType(genotypeStr: string, variantId: string) {
const variant = this.genotypeData!.variants[variantId];
if(genotypeStr === variant.referenceBases) {
return 'is-success';
} else {
return 'is-warning';
}
}

genotypeVal(genotypeStr: string, variantId: string) {
const genotype: number = parseInt(genotypeStr);
const variant = this.genotypeData!.variants[variantId];

const ref: string = variant.referenceBases;
const alts: Array<string> = variant.alternate_bases;

if(genotype === 0) {
return ref;
} else if(genotype > 0) {
return alts[genotype-1];
}
return genotypeStr;
}

getGenotypes(call: Call) {
Expand Down

0 comments on commit 1c2e5c6

Please sign in to comment.