Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions src/breeding-insight/model/import/germplasm/Pedigree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,18 @@ export class Pedigree {
}
}

/**
* Wrapper of parsePedigreeString that handles female/male parent unknown cases.
*
* @param pedigreeString
* @param femaleParentUnknown
* @param maleParentUnknown
*/
public static parsePedigreeStringWithUnknowns(pedigreeString: string, femaleParentUnknown: string, maleParentUnknown: string, gid: string) : Pedigree {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the femaleParentUnknown and maleParentUnknown additionalInfo fields are booleans. Can the types of the parameters in this method can be updated to reflect this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vue yells at me if I change the parameter type to boolean despite it being very clearly processed as a boolean in the method. It is strange.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks for looking into this!

let parsedPedigree = this.parsePedigreeString(pedigreeString);
if (femaleParentUnknown) parsedPedigree.femaleParent = "Unknown";
if (maleParentUnknown) parsedPedigree.maleParent = "Unknown";
return parsedPedigree;
}

}
3 changes: 3 additions & 0 deletions src/components/germplasm/GermplasmPedigreesView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default class GermplasmPedigreesView extends GermplasmBase {
let pedigree = PedigreeViewer(`${process.env.VUE_APP_BI_API_V1_PATH}/programs/${this.activeProgram!.id}/brapi/v2`, undefined, 'v2.0',
function (dbId: any, germplasm: any) {
const parsedName = parseGermplasmName(germplasm.value.name);
if (parsedName.gid === "0") {
return null;
}
return `${germplasmDetailsUrl}/gid-${parsedName.gid}`;
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/views/germplasm/GermplasmDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<GermplasmLink
v-if="germplasm.pedigree"
v-bind:germplasmUUID="Pedigree.parsePedigreeString(germplasm.additionalInfo.pedigreeByUUID).femaleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeString(germplasm.pedigree).femaleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeStringWithUnknowns(germplasm.pedigree,germplasm.additionalInfo.femaleParentUnknown,germplasm.additionalInfo.maleParentUnknown, germplasm.germplasmDbId).femaleParent"
> </GermplasmLink>
<template v-if="Pedigree.parsePedigreeString(germplasm.pedigree).maleParent">
/ <GermplasmLink
v-bind:germplasmUUID="Pedigree.parsePedigreeString(germplasm.additionalInfo.pedigreeByUUID).maleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeString(germplasm.pedigree).maleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeStringWithUnknowns(germplasm.pedigree,germplasm.additionalInfo.femaleParentUnknown,germplasm.additionalInfo.maleParentUnknown, germplasm.germplasmDbId).maleParent"
> </GermplasmLink></template>
</li>
<li><b>Synonyms: </b> {{ GermplasmUtils.formatSynonyms(germplasm.synonyms) }}</li>
Expand Down
4 changes: 2 additions & 2 deletions src/views/germplasm/GermplasmTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
<b-table-column field="femaleParentGID" label="Female Parent GID" sortable v-slot="props" :th-attrs="(column) => ({scope:'col'})" searchable>
<GermplasmLink
v-bind:germplasmUUID="Pedigree.parsePedigreeString(props.row.data.additionalInfo.pedigreeByUUID).femaleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeString(props.row.data.pedigree).femaleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeStringWithUnknowns(props.row.data.pedigree, props.row.data.additionalInfo.femaleParentUnknown, props.row.data.additionalInfo.maleParentUnknown, props.row.data.accessionNumber).femaleParent"
> </GermplasmLink>
</b-table-column>
<b-table-column field="maleParentGID" label="Male Parent GID" sortable v-slot="props" :th-attrs="(column) => ({scope:'col'})" searchable>
<GermplasmLink
v-bind:germplasmUUID="Pedigree.parsePedigreeString(props.row.data.additionalInfo.pedigreeByUUID).maleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeString(props.row.data.pedigree).maleParent"
v-bind:germplasmGID="Pedigree.parsePedigreeStringWithUnknowns(props.row.data.pedigree,props.row.data.additionalInfo.femaleParentUnknown,props.row.data.additionalInfo.maleParentUnknown, props.row.data.accessionNumber).maleParent"
> </GermplasmLink>
</b-table-column>
<b-table-column field="createdDate" label="Created Date" sortable v-slot="props" :th-attrs="(column) => ({scope:'col'})" searchable>
Expand Down
24 changes: 23 additions & 1 deletion src/views/import/ImportGermplasm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
{{ props.row.data.brAPIObject.seedSource }}
</b-table-column>
<b-table-column field="pedigree" label="Pedigree" v-slot="props" :th-attrs="(column) => ({scope:'col'})">
{{ props.row.data.brAPIObject.pedigree }}
{{ getPedigree(props.row.data.brAPIObject) }}
</b-table-column>
<b-table-column field="femaleParentGid" label="Female Parent GID" v-slot="props" :th-attrs="(column) => ({scope:'col'})">
{{ props.row.data.brAPIObject.additionalInfo.femaleParentGid }}
Expand Down Expand Up @@ -162,6 +162,7 @@ import ExpandableTable from "@/components/tables/expandableTable/ExpandableTable
import {ImportObjectState} from "@/breeding-insight/model/import/ImportObjectState";
import {ExternalUID} from "@/breeding-insight/model/import/germplasm/ExternalUID";
import {GermplasmUtils} from "@/breeding-insight/utils/GermplasmUtils";
import {Germplasm} from "@/breeding-insight/brapi/model/germplasm";

@Component({
components: {
Expand Down Expand Up @@ -217,5 +218,26 @@ export default class ImportGermplasm extends ProgramsBase {
importFinished() {
this.germplasmList = new GermplasmList();
}

getPedigree(germplasm: Germplasm) {
//return germplasm.pedigree;
let originalPedigree = germplasm.pedigree ? germplasm.pedigree.split('/') : [""];
let displayPedigree = "";
if (germplasm.additionalInfo && germplasm.additionalInfo.femaleParentUnknown){
displayPedigree = "Unknown";
} else {
displayPedigree = originalPedigree[0];
}
if (germplasm.additionalInfo && germplasm.additionalInfo.maleParentUnknown){
displayPedigree += "/Unknown";
} else if (originalPedigree.length == 2) {
displayPedigree +=`/${originalPedigree[1]}`;
}
//todo future card, handle case of unknown female/known male, which currently has null pedigree posted

return displayPedigree;

}

}
</script>