Added LocusIsPhased information to the local user profile creation process.

This commit is contained in:
Simon Sarasova 2024-08-05 21:29:14 +00:00
parent b71b994dc4
commit d538afc7a2
No known key found for this signature in database
GPG key ID: EEDA4103C9C36944
3 changed files with 32 additions and 26 deletions

View file

@ -6,6 +6,7 @@ Small and insignificant changes may not be included in this log.
## Unversioned Changes
* Added LocusIsPhased information to the local user profile creation process. - *Simon Sarasova*
* Added the Height trait the traits package. Migrated locus metadata from json encoding to gob encoding. - *Simon Sarasova*
* Upgraded Fyne to version 2.5.0. - *Simon Sarasova*
* Added neural network trait prediction to genetic analyses. - *Simon Sarasova*

View file

@ -9,4 +9,4 @@ Many other people have written code for modules which are imported by Seekia. Th
Name | Date Of First Commit | Number Of Commits
--- | --- | ---
Simon Sarasova | June 13, 2023 | 269
Simon Sarasova | June 13, 2023 | 270

View file

@ -198,6 +198,10 @@ func UpdateMyExportedProfile(myProfileType string, networkType byte)error{
polygenicDiseaseObjectsList, err := polygenicDiseases.GetPolygenicDiseaseObjectsList()
if (err != nil) { return err }
// This map stores the rsIDs to share in our profile
// We use a map to avoid duplicates
myLociToShareMap := make(map[int64]struct{})
for _, diseaseObject := range polygenicDiseaseObjectsList{
diseaseName := diseaseObject.DiseaseName
@ -219,18 +223,7 @@ func UpdateMyExportedProfile(myProfileType string, networkType byte)error{
locusRSID := locusObject.LocusRSID
locusValueObject, exists := myGenomeLocusValuesMap[locusRSID]
if (exists == true){
rsIDString := helpers.ConvertInt64ToString(locusRSID)
locusBase1 := locusValueObject.Base1Value
locusBase2 := locusValueObject.Base2Value
basePairValue := locusBase1 + ";" + locusBase2
profileMap["LocusValue_rs" + rsIDString] = basePairValue
}
myLociToShareMap[locusRSID] = struct{}{}
}
}
@ -256,19 +249,31 @@ func UpdateMyExportedProfile(myProfileType string, networkType byte)error{
for _, rsID := range lociList{
myLociToShareMap[rsID] = struct{}{}
}
}
for rsID, _ := range myLociToShareMap{
locusValueObject, exists := myGenomeLocusValuesMap[rsID]
if (exists == true){
if (exists == false){
continue
}
rsIDString := helpers.ConvertInt64ToString(rsID)
locusBase1 := locusValueObject.Base1Value
locusBase2 := locusValueObject.Base2Value
locusIsPhased := locusValueObject.LocusIsPhased
basePairValue := locusBase1 + ";" + locusBase2
locisIsPhasedString := helpers.ConvertBoolToYesOrNoString(locusIsPhased)
profileMap["LocusValue_rs" + rsIDString] = basePairValue
}
}
locusValueAttributeName := "LocusValue_rs" + rsIDString
locusIsPhasedAttributeName := "LocusIsPhased_rs" + rsIDString
profileMap[locusValueAttributeName] = basePairValue
profileMap[locusIsPhasedAttributeName] = locisIsPhasedString
}
return nil