Skip to content

Commit

Permalink
feat: subtract thresholds when calculating QC scores
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov committed Jul 15, 2020
1 parent f15af21 commit 7f5013b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/web/src/algorithms/QC/ruleMissingData.ts
Expand Up @@ -17,7 +17,7 @@ export function ruleMissingData(

let scoreRaw = 0
if (totalMissing > missingDataThreshold) {
scoreRaw = totalMissing * scoreWeight - scoreBias
scoreRaw = (totalMissing - missingDataThreshold) * scoreWeight - scoreBias
}
const score = clamp(scoreRaw, 0, scoreMax)

Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/algorithms/QC/ruleMixedSites.ts
Expand Up @@ -21,7 +21,7 @@ export function ruleMixedSites(

let scoreRaw = 0
if (totalMixedSites > mixedSitesThreshold) {
scoreRaw = totalMixedSites * scoreWeight - scoreBias
scoreRaw = (totalMixedSites - mixedSitesThreshold) * scoreWeight - scoreBias
}
const score = clamp(scoreRaw, 0, scoreMax)

Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/algorithms/QC/ruleSnpClusters.ts
Expand Up @@ -76,7 +76,7 @@ export function ruleSnpClusters(data: QCInputData, config: QCRulesConfigSNPClust

let scoreRaw = 0
if (totalSNPs > totalSNPsThreshold) {
scoreRaw = totalSNPs * scoreWeight - scoreBias
scoreRaw = (totalSNPs - totalSNPsThreshold) * scoreWeight - scoreBias
}
const score = clamp(scoreRaw, 0, scoreMax)

Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/algorithms/QC/ruleTotalMutations.ts
Expand Up @@ -17,8 +17,8 @@ export function ruleTotalMutations(
Object.keys(substitutions).length + Object.keys(insertions).length + Object.keys(deletions).length

let scoreRaw = 0
if (totalNumberOfMutations) {
scoreRaw = totalNumberOfMutations * scoreWeight - scoreBias
if (totalNumberOfMutations > divergenceThreshold) {
scoreRaw = (totalNumberOfMutations - divergenceThreshold) * scoreWeight - scoreBias
}
const score = clamp(scoreRaw, 0, scoreMax)

Expand Down

0 comments on commit 7f5013b

Please sign in to comment.