Skip to content

Commit

Permalink
make pedigree v1 and v2 friendl
Browse files Browse the repository at this point in the history
  • Loading branch information
MFlores2021 committed Sep 23, 2021
1 parent 01da4f1 commit acafcdb
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions js/source/legacy/brapi/PedigreeViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,46 @@ function PedigreeViewer(server,auth,version,urlFunc){
}).map(function(ped_pro_germId){
var mother = null,
father = null;
var i = ped_pro_germId[0].parents.map(function(e) { return e.parentType; }).indexOf('FEMALE');
var j = ped_pro_germId[0].parents.map(function(e) { return e.parentType; }).indexOf('MALE');

if(i>=0) mother = ped_pro_germId[0].parents[i].germplasmDbId;
if(j>=0) father = ped_pro_germId[0].parents[j].germplasmDbId;
if(version=='v1.3'){
if(ped_pro_germId[0].parent1Type=="FEMALE"){
mother = ped_pro_germId[0].parent1DbId;
}
if(ped_pro_germId[0].parent1Type=="MALE"){
father = ped_pro_germId[0].parent1DbId;
}
if(ped_pro_germId[0].parent2Type=="FEMALE"){
mother = ped_pro_germId[0].parent2DbId;
}
if(ped_pro_germId[0].parent2Type=="MALE"){
father = ped_pro_germId[0].parent2DbId;
}
return {
'id':ped_pro_germId[2],
'mother_id':mother,
'father_id':father,
'name':ped_pro_germId[1].defaultDisplayName,
'children':ped_pro_germId[1].progeny.filter(Boolean).map(function(d){
return d.germplasmDbId;
})
};
} else {
var i = ped_pro_germId[0].parents.map(function(e) { return e.parentType; }).indexOf('FEMALE');
var j = ped_pro_germId[0].parents.map(function(e) { return e.parentType; }).indexOf('MALE');

if(i>=0) mother = ped_pro_germId[0].parents[i].germplasmDbId;
if(j>=0) father = ped_pro_germId[0].parents[j].germplasmDbId;

return {
'id':ped_pro_germId[2],
'mother_id':mother,
'father_id':father,
'name':ped_pro_germId[1].germplasmName,
'children':ped_pro_germId[1].progeny.filter(Boolean).map(function(d){
return d.germplasmDbId;
})
};
return {
'id':ped_pro_germId[2],
'mother_id':mother,
'father_id':father,
'name':ped_pro_germId[1].germplasmName,
'children':ped_pro_germId[1].progeny.filter(Boolean).map(function(d){
return d.germplasmDbId;
})
};
}
}).each(function(node){
loaded_nodes[node.id] = node;
}).all(callback);
Expand Down

0 comments on commit acafcdb

Please sign in to comment.