Skip to content

Commit

Permalink
Merge pull request #1162 from ersinciftci/mutex-bugfix
Browse files Browse the repository at this point in the history
Fix mutex filtering bug
  • Loading branch information
ersinciftci authored May 10, 2018
2 parents d7bed8e + 4360bd4 commit 5bd9a3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ const exampleData = [
"adjustedPValue": 0.023809523809523704,
"association": "Mutual exclusivity"
},
{
"geneA": "TP53",
"geneB": "BRAF",
"neitherCount": 6,
"aNotBCount": 0,
"bNotACount": 1,
"bothCount": 3,
"logOddsRatio": Infinity,
"pValue": 0.03333333333333314,
"adjustedPValue": 0.19999999999999885,
"association": "Co-occurrence"
},
{
"geneA": "EGFR",
"geneB": "TP53",
Expand Down Expand Up @@ -73,18 +85,6 @@ const exampleData = [
"pValue": 0.2619047619047609,
"adjustedPValue": 1,
"association": "Co-occurrence"
},
{
"geneA": "TP53",
"geneB": "BRAF",
"neitherCount": 6,
"aNotBCount": 0,
"bNotACount": 1,
"bothCount": 3,
"logOddsRatio": Infinity,
"pValue": 0.03333333333333314,
"adjustedPValue": 0.19999999999999885,
"association": "Co-occurrence"
}
];

Expand Down Expand Up @@ -242,8 +242,8 @@ describe("MutualExclusivityUtil", () => {
"bNotACount": 5,
"bothCount": 0,
"logOddsRatio": -6.51,
"pValue": 0.04,
"adjustedPValue": 0.08,
"pValue": 0.02,
"adjustedPValue": 0.04,
"association": "Mutual exclusivity"
},
{
Expand Down Expand Up @@ -277,8 +277,8 @@ describe("MutualExclusivityUtil", () => {
"bNotACount": 5,
"bothCount": 0,
"logOddsRatio": -6.51,
"pValue": 0.04,
"adjustedPValue": 0.08,
"pValue": 0.02,
"adjustedPValue": 0.04,
"association": "Mutual exclusivity"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getCumulativePValue } from "../../../shared/lib/FisherExactTestCalculat
import { MutualExclusivity } from "../../../shared/model/MutualExclusivity";
import Combinatorics from 'js-combinatorics';
import Dictionary = _.Dictionary;
import * as _ from 'lodash';

export function calculateAssociation(logOddsRatio: number): string {
return logOddsRatio > 0 ? "Co-occurrence" : "Mutual exclusivity";
Expand Down Expand Up @@ -55,7 +56,7 @@ export function getMutuallyExclusiveCounts(data: MutualExclusivity[],
let significantCount = null;

const exclusiveData = data.filter(mutualExclusivity => exclusive(mutualExclusivity.logOddsRatio));
const significantData = exclusiveData.filter(mutualExclusivity => mutualExclusivity.pValue < 0.05);
const significantData = exclusiveData.filter(mutualExclusivity => mutualExclusivity.adjustedPValue < 0.05);

const exclusiveLength = exclusiveData.length;
const significantLength = significantData.length;
Expand Down Expand Up @@ -105,7 +106,7 @@ export function getData(isSampleAlteredMap: Dictionary<boolean[]>): MutualExclus
bothCount: counts[3], logOddsRatio, pValue,
adjustedPValue: calculateAdjustedPValue(pValue, combinations.length), association });
});
return data;
return _.sortBy(data, ["pValue"]);
}

export function getFilteredData(data: MutualExclusivity[], mutualExclusivityFilter: boolean, coOccurenceFilter: boolean,
Expand All @@ -120,7 +121,7 @@ export function getFilteredData(data: MutualExclusivity[], mutualExclusivityFilt
result = result || mutualExclusivity.logOddsRatio > 0;
}
if (significantPairsFilter) {
result = result && mutualExclusivity.pValue < 0.05;
result = result && mutualExclusivity.adjustedPValue < 0.05;
}
return result;
});
Expand Down

0 comments on commit 5bd9a3e

Please sign in to comment.