Skip to content

Commit

Permalink
CSBiology#30: Add amino acid tests (CSBiology#108)
Browse files Browse the repository at this point in the history
* Add "teset_rangePpm" to testList "BioFSharp.Mass"

* Add testCase "formula" to testList "AminoAcids"

* Add "formulaModifiedAA" to testList "AminoAcids"

* Fix "formulaModifiedAA" testCase

* Add "isTerminator" to testList "AminoAcids"

* Add "isGap" to testList "AminoAcids"

* Add "setModification" to testList "AminoAcids"

* Clean up tests

* Change error message for test "setModification"

* Add "setModifications" to "AminoAcids" testList

* Add "getModifications" to "AminoAcids" testList

* Add testCase "getAminoAcidWithoutMod"

* Add test "tryGetModifications"

* Add test "tryGetModifications_withNone"

* Add test "isotopicLabelFunc"

* Add "isotopicLabelFunc_withUnmodifiedAAs"

* Add "charToParsedAminoAcidChar"

* Add test "aminoAcidSetStandard"

* Add test "aminoAcidSetProteinogenic"

* Add test "aminoAcidSetProteinogenicEucaryotes"

* Add test "aminoAcidSetAmbiguity"

* Add test "aminoAcidSetGapTer"

* Add test "aminoAcidSetPosCharged"

* Add test "aminoAcidSetNegCharged"

* Add test "aminoAcidSetPolarUncharged"

* Add test "aminoAcidSetHydrophobic"

* Add test "aminoAcidSetSpecialCases"

* Add test "isPolarUncharged"

* Add test "isModified_withUnmodAAs"

* Add test "isModified_withModAAs"

* Add test "getModifications_withUnmodAAs"

* Delete coverage.xml.637327725072680050L.exn

Seems like these are artifacts from your testing process, i cant reproduce these when starting the tests from your branch, so i would delete these and merge the PR afterwards

* Delete coverage.xml.637330276045185520L.exn

see previous commit

* Fix merge commit for aa tests

Co-authored-by: Kevin Schneider <[email protected]>
Co-authored-by: Kevin Schneider <[email protected]>
  • Loading branch information
3 people authored and HLWeil committed Sep 21, 2020
1 parent 075d5e9 commit b9baf82
Showing 1 changed file with 192 additions and 0 deletions.
192 changes: 192 additions & 0 deletions tests/BioFSharp.Tests.NetCore/BioFSharp/AminoAcidTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ let allAAs = [
AminoAcid.Glx; AminoAcid.Asx; AminoAcid.Gap; AminoAcid.Ter
]

let allParsedAAs = [
StandardCodes AminoAcid.Ala; StandardCodes AminoAcid.Cys; StandardCodes AminoAcid.Asp
StandardCodes AminoAcid.Glu; StandardCodes AminoAcid.Phe; StandardCodes AminoAcid.Gly
StandardCodes AminoAcid.His; StandardCodes AminoAcid.Ile; StandardCodes AminoAcid.Lys
StandardCodes AminoAcid.Leu; StandardCodes AminoAcid.Met; StandardCodes AminoAcid.Asn
StandardCodes AminoAcid.Pyl; StandardCodes AminoAcid.Pro; StandardCodes AminoAcid.Gln
StandardCodes AminoAcid.Arg; StandardCodes AminoAcid.Ser; StandardCodes AminoAcid.Thr
StandardCodes AminoAcid.Sel; StandardCodes AminoAcid.Sel; StandardCodes AminoAcid.Val
StandardCodes AminoAcid.Trp; StandardCodes AminoAcid.Tyr; AmbiguityCodes AminoAcid.Xaa
AmbiguityCodes AminoAcid.Xle; AmbiguityCodes AminoAcid.Glx; AmbiguityCodes AminoAcid.Asx
GapTer AminoAcid.Gap; GapTer AminoAcid.Ter; NoAAChar '!'
]

let allModFormulas = (allFormulas |> List.map(fun f -> Formula.replaceElement f Elements.Table.N Elements.Table.Heavy.N15))

let allSingleModAAs = allAAs |> List.map (fun aa -> AminoAcids.Mod (aa, [ModificationInfo.Table.N15]))
let allDoubleModAAs = allAAs |> List.map (fun aa -> AminoAcids.Mod (aa, [ModificationInfo.Table.N15; ModificationInfo.Table.H2O]))

Expand Down Expand Up @@ -114,4 +129,181 @@ let aminoAcidTests =
allMods
"AminoAcids.getModifications did not return correct Modifications for all modified AminoAcids"
)

testCase "getModifications_withUnmodAAs" (fun () ->
let allEmptyLists = [for i in 1 .. 29 -> []]
Expect.equal
(allAAs |> List.map (fun aa -> AminoAcids.getModifications aa))
allEmptyLists
"AminoAcids.getModifications did not return correct empty list for all unmodified AminoAcids"
)
testCase "getAminoAcidWithoutMod" (fun () ->
Expect.equal
(allSingleModAAs |> List.map (fun aa -> AminoAcids.getAminoAcidWithoutMod aa))
allAAs
"AminoAcids.getAminoAcidWithoutMod did not return correct AminoAcid for all AminoAcids"
)
testCase "tryGetModifications" (fun () ->
let allMods = [for i in 1 .. 29 -> Some [ModificationInfo.Table.N15]]
Expect.equal
(allSingleModAAs |> List.map (fun aa -> AminoAcids.tryGetModifications aa))
allMods
"AminoAcids.tryGetModifications did not return correct Modifications for all modified AminoAcids"
)
testCase "tryGetModifications_withNone" (fun () ->
Expect.equal
(allAAs |> List.map (fun aa -> AminoAcids.tryGetModifications aa))
[for i in 1 .. 29 -> None]
"AminoAcids.tryGetModifications did not return correct Modifications for all unmodified AminoAcids"
)
testCase "isotopicLabelFunc" (fun () ->
Expect.equal
(List.map2 (fun aa f -> AminoAcids.isotopicLabelFunc aa f) allSingleModAAs allFormulas)
allModFormulas
"AminoAcids.isotopicLabelFunc did not return correct function for all Modified AminoAcids"
)
testCase "isotopicLabelFunc_withUnmodifiedAAs" (fun () ->
Expect.equal
(List.map2 (fun aa f -> AminoAcids.isotopicLabelFunc aa f) allAAs allFormulas)
allFormulas
"AminoAcids.isotopicLabelFunc did not return correct function for all unmodified AminoAcids"
)
testCase "charToParsedAminoAcidChar" (fun () -> // This function currently matches to Sel, not Sec. Will eventually need chane
let testParsedSymbols = List.append allSymbols ['!']
Expect.equal
(List.map (fun c -> AminoAcids.charToParsedAminoAcidChar c) testParsedSymbols)
allParsedAAs
"AminoAcids.charToParsedAminoAcidChar did not return correct AminoAcid from all AminoAcid chars"
)
testCase "aminoAcidSetStandard" (fun () ->
let testAASetStandard = set [
AminoAcid.Ala; AminoAcid.Cys; AminoAcid.Asp; AminoAcid.Glu
AminoAcid.Phe; AminoAcid.Gly; AminoAcid.His; AminoAcid.Ile
AminoAcid.Lys; AminoAcid.Leu; AminoAcid.Met; AminoAcid.Asn
AminoAcid.Pro; AminoAcid.Gln; AminoAcid.Arg; AminoAcid.Ser
AminoAcid.Thr; AminoAcid.Val; AminoAcid.Trp; AminoAcid.Tyr
]
Expect.equal
AminoAcids.aminoAcidSetStandard
testAASetStandard
"AminoAcids.aminoAcidSetStandard did not return correct standard set of AminoAcids"
)
testCase "aminoAcidSetProteinogenic" (fun () ->
let testAASetProteinogenic = set [
AminoAcid.Ala; AminoAcid.Cys; AminoAcid.Asp; AminoAcid.Glu
AminoAcid.Phe; AminoAcid.Gly; AminoAcid.His; AminoAcid.Ile
AminoAcid.Lys; AminoAcid.Leu; AminoAcid.Met; AminoAcid.Asn
AminoAcid.Pro; AminoAcid.Gln; AminoAcid.Arg; AminoAcid.Ser
AminoAcid.Thr; AminoAcid.Val; AminoAcid.Trp; AminoAcid.Tyr
AminoAcid.Sel; AminoAcid.Sec; AminoAcid.Pyl
]
Expect.equal
AminoAcids.aminoAcidSetProteinogenic
testAASetProteinogenic
"AminoAcids.aminoAcidSetProteinogenic did not return correct set of AminoAcids"
)
testCase "aminoAcidSetProteinogenicEucaryotes" (fun () ->
let testAASetProteinogenicEucaryotes = set [
AminoAcid.Ala; AminoAcid.Cys; AminoAcid.Asp; AminoAcid.Glu
AminoAcid.Phe; AminoAcid.Gly; AminoAcid.His; AminoAcid.Ile
AminoAcid.Lys; AminoAcid.Leu; AminoAcid.Met; AminoAcid.Asn
AminoAcid.Pro; AminoAcid.Gln; AminoAcid.Arg; AminoAcid.Ser
AminoAcid.Thr; AminoAcid.Val; AminoAcid.Trp; AminoAcid.Tyr
AminoAcid.Sel; AminoAcid.Sec;
]
Expect.equal
AminoAcids.aminoAcidSetProteinogenicEucaryotes
testAASetProteinogenicEucaryotes
"AminoAcids.aminoAcidSetProteinogenicEucaryotes did not return correct set of AminoAcids"
)
testCase "aminoAcidSetAmbiguity" (fun () ->
let testAASetAmbiguity = set [
AminoAcid.Xaa; AminoAcid.Xle; AminoAcid.Glx; AminoAcid.Asx
]
Expect.equal
AminoAcids.aminoAcidSetAmbiguity
testAASetAmbiguity
"AminoAcids.aminoAcidSetAmbiguity did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetGapTer" (fun () ->
let testAASetGapTer = set [AminoAcid.Gap; AminoAcid.Ter]
Expect.equal
AminoAcids.aminoAcidSetGapTer
testAASetGapTer
"AminoAcids.aminoAcidSetGapTer did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetPosCharged" (fun () ->
let testAAPosCharged = set [AminoAcid.Arg; AminoAcid.Lys; AminoAcid.His]
Expect.equal
AminoAcids.aminoAcidSetPosCharged
testAAPosCharged
"AminoAcids.aminoAcidSetPosCharged did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetNegCharged" (fun () ->
let testAANegCharged = set [
AminoAcid.Asp; AminoAcid.Glu
]
Expect.equal
AminoAcids.aminoAcidSetNegCharged
testAANegCharged
"AminoAcids.aminoAcidSetNegCharged did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetPolarUncharged" (fun () ->
let testAASetPolarUncharged = set [
AminoAcid.Gln; AminoAcid.Asn; AminoAcid.Ser; AminoAcid.Thr
]
Expect.equal
AminoAcids.aminoAcidSetPolarUncharged
testAASetPolarUncharged
"AminoAcids.aminoAcidSetPolarUncharged did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetHydrophobic" (fun () ->
let testAASetHydrophobic = set [
AminoAcid.Ala; AminoAcid.Ile; AminoAcid.Leu; AminoAcid.Met
AminoAcid.Phe; AminoAcid.Trp; AminoAcid.Tyr; AminoAcid.Val
]
Expect.equal
AminoAcids.aminoAcidSetHydrophobic
testAASetHydrophobic
"AminoAcids.aminoAcidSetHydrophobic did not return the correct set of AminoAcids"
)
testCase "aminoAcidSetSpecialCases" (fun () ->
let testAASetSpecialCases = set [
AminoAcid.Cys; AminoAcid.Sel; AminoAcid.Sec; AminoAcid.Gly
AminoAcid.Pro
]
Expect.equal
AminoAcids.aminoAcidSetSpecialCases
testAASetSpecialCases
"AminoAcids.aminoAcidSetSpecialCases did not return the correct set of AminoAcids"
)
testCase "isPolarUncharged" (fun () ->
let testIsPolarUncharged = [
false; false; false; false
false; false; false; false
false; false; false; true
false; false; true; false
true; true; false; false; false
false; false; false; false
false; false; false; false
]
Expect.equal
(allAAs |> List.map (fun aa -> AminoAcids.isPolarUncharged aa))
testIsPolarUncharged
"AminoAcids.isPolarUncharged did not return correct boolean for each AminoAcid"
)
testCase "isModified_withUnmodAAs" (fun () ->
let testIsModifiedFalse = [for i in 1 .. 29 -> false]
Expect.equal
(allAAs |> List.map (fun aa -> AminoAcids.isModified aa))
testIsModifiedFalse
"AminoAcids.isModified did not return correct boolean for each unmodified AminoAcid"
)
testCase "isModified_withModAAs" (fun () ->
let testIsModifiedTrue = [for i in 1 .. 29 -> true]
Expect.equal
(allSingleModAAs |> List.map (fun aa -> AminoAcids.isModified aa))
testIsModifiedTrue
"AminoAcids.isModified did not return correct boolean for each modified AminoAcid"
)
]

0 comments on commit b9baf82

Please sign in to comment.