Skip to content

Commit

Permalink
filtered prs scores that failed qc
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenasandoval88 committed Sep 3, 2024
1 parent 73429ee commit cb286d0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
18 changes: 17 additions & 1 deletion sdk/prs.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,36 @@ PRS.Match2 = function (data){

PRS.calc = async function(matrix){
let arr =[]
const badIds = ["anyId"]
// todo remove qc from match2 function
// todo remove users with old chips
for (let i=0; i<matrix.my23.length; i++){
console.log("---------------------------")
console.log("processing user #...",i)

for(let j=0; j<matrix.PGS.length; j++){

let input = { "pgs":matrix.PGS[j], "my23":matrix.my23[i]}

let res = PRS.Match2(input)
if(res.QC==true ){
arr.push(res)
console.log("processing PGS model: ",matrix.PGS[j].id)
} else if(res.QC==false){
badIds.push(matrix.PGS[j].id)
}
}
}
return arr
console.log("badIds",badIds)
console.log("matrix.PGS",matrix.PGS)
console.log("matrix.my23",matrix.my23)
// if prs qc fails for one user, remove the connected pgs entry
const obj = {}
obj.users = matrix.my23
obj.pgs = matrix.PGS.filter(x=>!badIds.includes(x.id))
obj.prs = arr.filter(x=> !badIds.includes(x.pgsId))
console.log("arr",arr)
return obj
}
// data object defined here ---

Expand Down
10 changes: 5 additions & 5 deletions sdk/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const ui = async function (targetDiv) {
console.log("dt.users", dt.users)

dt.pgs = {}

let pgsIds = (await (getPgs.idsFromCategory(category))).sort().slice(3,6)
// TODO filter ids by variant number using get scoreFIles
let pgsIds = (await (getPgs.idsFromCategory(category))).sort().slice(5,7)
console.log("pgsIds", pgsIds)
let pgsTxts = await Promise.all( pgsIds.map(async x => {
let res = await getPgs.loadScoreHm(x)
Expand All @@ -155,8 +155,8 @@ const ui = async function (targetDiv) {
console.log("data",dt.users.txts.filter(x=> x.qc == true))

let prsDt = PRS.calc(data)
dt.prs = await prsDt
console.log("dt", dt)
// if prs qc failes for one user, remove the connected pgs entry
console.log("prsDt", prsDt)

}

Expand Down Expand Up @@ -202,7 +202,7 @@ const getUsersByPhenotypeId = async function (phenoId, keysLen, maxKeys) {
id
}) => userIds.includes(id));
let cleanUsers
let maxUsers = 8
let maxUsers = 3
if (userIds2.length < maxUsers) {
cleanUsers = getUsersByType("23andme", userIds2)
} else {
Expand Down

0 comments on commit cb286d0

Please sign in to comment.