Skip to content

Commit

Permalink
Merge pull request #125 from CSBiology/#124-fix-gsea-typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene authored Jan 18, 2022
2 parents 61c9c55 + a62cdc3 commit 08618f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions docs/GSEA.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ open BioFSharp.Stats
//specific group. If significantly altered proteins were identified, you can assign index '1' to
//all altered proteins and '0' to all other. The choice of the index is up to you, but you have
//to remind it for later steps.
let item = OntologyEnrichment.createOntologyItem "Cre06.g250100" "GMM:29.6.2.3;GMM:20.2.1" 1 "HSP70"
let item = OntologyEnrichment.createOntologyItem "Cre06.g250100" "protein.folding.chaperones and co-chaperones.HSP70s;stress.abiotic.heat" 1 "HSP70"


//If more than one ontology term is possible, you can use this function to split the item, so that
Expand All @@ -109,7 +109,7 @@ let splitItems = OntologyEnrichment.splitMultipleAnnotationsBy ';' item
let items = [splitItems(*...*)] |> Seq.concat

//When dealing with MapMan annotations all levels of the descriptions should be considered.
//GMM:26.6.2 -> [GMM:26.6.2;GMM:26.6;GMM:26]
//"stress.abiotic.heat" -> ["stress.abiotic.heat"; "stress.abiotic"; "stress"]
let expandedItems = OntologyEnrichment.expandOntologyTree items


Expand All @@ -132,8 +132,8 @@ let filterAndSortEnrichedModules =
//GseaResult:
// OntologyTerm : OntologyTerm(MapMan-Term/GO-Term/...)
// ItemsInBin : Sequence of single items belonging to the ontology term
// NumberOfDEsInBin : number of significantly altered items in 'OntologyItem' bin
// NumberInBin : number of items in 'OntologyItem' bin
// TotalNumberOfDE : number of significantly altered items
// TotalUnivers : number of all items (expanded)
// NumberOfDEsInBin : Number of significantly altered items in 'OntologyTerm' bin
// NumberInBin : Number of items in 'OntologyTerm' bin
// TotalNumberOfDE : Number of significantly altered items
// TotalUniverse : Number of all items (expanded)
// PValue : p value
12 changes: 9 additions & 3 deletions src/BioFSharp.Stats/OntologyEnrichment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@ module OntologyEnrichment =

/// Represents a gene set enrichment result
type GseaResult<'a> = {
///Ontology term e.g. MapMan term, GO term ...
OntologyTerm : string
///Sequence of single items associated to the ontology term
ItemsInBin : seq<OntologyItem<'a>>
///Number of significantly altered items in 'OntologyTerm' bin
NumberOfDEsInBin : int
NumberInBin : int
///Number of items in 'OntologyTerm' bin
NumberInBin : int
///Number of significantly altered items within the total data set
TotalNumberOfDE : int
TotalUnivers : int
///Number of all items (expanded)
TotalUniverse : int
PValue : float
}

/// Creates a gene set enrichment result
let createGseaResult ontologyTerm desInBin numberOfDEsInBin numberInBin totalNumberOfDE totalUnivers pValue =
{OntologyTerm = ontologyTerm;ItemsInBin = desInBin; NumberOfDEsInBin = numberOfDEsInBin;
NumberInBin = numberInBin; TotalNumberOfDE = totalNumberOfDE; TotalUnivers = totalUnivers; PValue = pValue}
NumberInBin = numberInBin; TotalNumberOfDE = totalNumberOfDE; TotalUniverse = totalUnivers; PValue = pValue}

///Splits an OntologyEntry with seperator concatenated TermIds
let splitMultipleAnnotationsBy (separator:char) (item:OntologyItem<'A>) =
Expand Down

0 comments on commit 08618f7

Please sign in to comment.