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

BI-1741 - Genotype Import #305

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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