Skip to content

Commit 4620d3c

Browse files
committed
Modernize BioFSharp dependencies and adapt DPPOP IO usage
1 parent 1483031 commit 4620d3c

4 files changed

Lines changed: 41 additions & 29 deletions

File tree

build/build.fsproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
<ItemGroup>
2222
<PackageReference Include="BlackFox.Fake.BuildTask" Version="0.1.3" />
23-
<PackageReference Include="Fake.Api.Github" Version="6.0.0" />
24-
<PackageReference Include="Fake.Core.Process" Version="6.0.0" />
25-
<PackageReference Include="Fake.Core.ReleaseNotes" Version="6.0.0" />
26-
<PackageReference Include="Fake.Core.Target" Version="6.0.0" />
27-
<PackageReference Include="Fake.DotNet.Cli" Version="6.0.0" />
28-
<PackageReference Include="Fake.DotNet.MSBuild" Version="6.0.0" />
29-
<PackageReference Include="Fake.IO.FileSystem" Version="6.0.0" />
30-
<PackageReference Include="Fake.Tools.Git" Version="6.0.0" />
23+
<PackageReference Include="Fake.Api.Github" Version="6.1.4" />
24+
<PackageReference Include="Fake.Core.Process" Version="6.1.4" />
25+
<PackageReference Include="Fake.Core.ReleaseNotes" Version="6.1.4" />
26+
<PackageReference Include="Fake.Core.Target" Version="6.1.4" />
27+
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.4" />
28+
<PackageReference Include="Fake.DotNet.MSBuild" Version="6.1.4" />
29+
<PackageReference Include="Fake.IO.FileSystem" Version="6.1.4" />
30+
<PackageReference Include="Fake.Tools.Git" Version="6.1.4" />
3131
<PackageReference Include="Fake.Extensions.Release" Version="1.0.0" />
3232
</ItemGroup>
3333

src/BioFSharp.ML/BioFSharp.ML.fsproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<None Include="CNTKLoadScript.fsx">
3333
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3434
</None>
35+
<Compile Include="Library.fs" />
3536
<Compile Include="CNTK.fs" />
3637
<Compile Include="DPPOP.fs" />
3738
<!-- Resources -->
@@ -42,10 +43,9 @@
4243
</ItemGroup>
4344

4445
<ItemGroup>
45-
<PackageReference Include="BioFSharp" Version="2.0.0-preview.3" />
46-
<PackageReference Include="BioFSharp.IO" Version="2.0.0-preview.3" />
47-
<PackageReference Include="FSharpAux" Version="2.0.0" />
48-
<PackageReference Include="FSharpAux.IO" Version="2.0.0" />
46+
<PackageReference Include="BioFSharp" Version="2.0.0" />
47+
<PackageReference Include="FSharpAux" Version="2.1.0" />
48+
<PackageReference Include="FSharpAux.IO" Version="2.1.0" />
4949
<PackageReference Include="CNTK.CPUOnly" Version="2.8.0-rc0.dev20200201" />
5050
</ItemGroup>
5151
</Project>

src/BioFSharp.ML/DPPOP.fs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
namespace BioFSharp.ML
2+
open BioFSharp.FileFormats
3+
open BioFSharp.IO
24

35
///DPPOP - DeeP Peptide Observability Predictor.
46
///
@@ -320,7 +322,7 @@ module DPPOP =
320322
| Field AminoAcidSymbol.Arg -> Array.get ( [| -0.0206030273840874 ; -0.0245971841699276 ; -0.0427821442802085 ; -0.0566332092070675 ; -0.0559191548111558 ; -0.0455394380519306 ; -0.0541455813655727 ; -0.0538609149609292 ; 0.0112126601842253 ; |] ) index
321323
| Field AminoAcidSymbol.Ser -> Array.get ( [| -0.00414728931498034 ; -0.00607359115820411 ; 0.00688957312924048 ; -0.00101967408837821 ; 0.00155119425371577 ; -0.00188774397621617 ; -0.00179609780733301 ; 0.00120217171057805 ; 0.0 ; |] ) index
322324
| Field AminoAcidSymbol.Thr -> Array.get ( [| 0.0115728837855243 ; 0.00871709724548706 ; 0.00208777500908572 ; 3.77150826628033e-06 ; 0.00437580160216219 ; 0.00526322191736816 ; -0.0022521384724719 ; 0.00746782714495857 ; 0.0 ; |] ) index
323-
| Field AminoAcidSymbol.Sel -> 0.
325+
| Field AminoAcidSymbol.Sec -> 0.
324326
| Field AminoAcidSymbol.Val -> Array.get ( [| 0.00681194613657833 ; 0.0173429094275379 ; 0.00479136512294075 ; 0.00825865300614361 ; 0.00493316169438667 ; 0.00417320066605687 ; 0.00917321806055152 ; 0.00952970722162894 ; 0.0 ; |] ) index
325327
| Field AminoAcidSymbol.Trp -> Array.get ( [| 0.0306856368818309 ; 0.00282917821310596 ; 0.00730387808155344 ; 0.0120257729838156 ; 0.00693320815473958 ; 0.0181272910523906 ; 0.0254494100003613 ; 0.0354451553685568 ; 0.0 ; |] ) index
326328
| Field AminoAcidSymbol.Tyr -> Array.get ( [| 0.0194284810017644 ; 0.0127667737830556 ; 0.00498714111480968 ; 0.00476543997301542 ; -0.00523499887692041 ; 0.0152488432689032 ; 0.0194801608035318 ; 0.0168451463172139 ; 0.0 ; |] ) index
@@ -357,7 +359,7 @@ module DPPOP =
357359
| Field AminoAcidSymbol.Arg -> Array.get ( [| 0.0839923310796518 ; 0.098149568952218 ; 0.15594940772927 ; 0.193963194795178 ; 0.192111114311861 ; 0.163886132848834 ; 0.187463071487379 ; 0.186710603099994 ; -0.0557364696622383 ; |] ) index
358360
| Field AminoAcidSymbol.Ser -> Array.get ( [| 0.0186037055032237 ; 0.026922998856415 ; -0.0332190722669007 ; 0.00466508103872825 ; -0.00721584368297066 ; 0.00858895217038756 ; 0.00817672965188891 ; -0.00557951790496735 ; 0.0 ; |] ) index
359361
| Field AminoAcidSymbol.Thr -> Array.get ( [| -0.0576769689205623 ; -0.0425687027718217 ; -0.00974617373848127 ; -1.73687197929421e-05 ; -0.0207404654555115 ; -0.0250966660897753 ; 0.0102232743918174 ; -0.0361514776936105 ; 0.0 ; |] ) index
360-
| Field AminoAcidSymbol.Sel -> 0.
362+
| Field AminoAcidSymbol.Sec -> 0.
361363
| Field AminoAcidSymbol.Val -> Array.get ( [| -0.0328272141698239 ; -0.0902410077930348 ; -0.0227738520402987 ; -0.0402005991445456 ; -0.0234703056642569 ; -0.0197532660165449 ; -0.0449401919765487 ; -0.0468044755798308 ; 0.0 ; |] ) index
362364
| Field AminoAcidSymbol.Trp -> Array.get ( [| -0.178586262592309 ; -0.0132720175157153 ; -0.0353176592986856 ; -0.0601313220751986 ; -0.0334395263233619 ; -0.0948976405530249 ; -0.141415693210588 ; -0.215820560584245 ; 0.0 ; |] ) index
363365
| Field AminoAcidSymbol.Tyr -> Array.get ( [| -0.1027532603019 ; -0.0641827923770768 ; -0.0237357867488708 ; -0.0226466622914581 ; 0.0233253947565591 ; -0.0780881261688707 ; -0.103068708688225 ; -0.0873159356295266 ; 0.0 ; |] ) index
@@ -472,10 +474,10 @@ module DPPOP =
472474
|> digestTrypticWith 0 6
473475

474476
///Returns a distinct set of peptides that map uniquely to a single protein from the given fasta input
475-
let getDistinctTrypticPeptidesFromFasta (fa:seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>)=
477+
let getDistinctTrypticPeptidesFromFasta (fa:seq<Fasta.FastaItem<AminoAcids.AminoAcid>>)=
476478
//fileDir + "Chlamy_Cp.fastA"
477479
fa
478-
|> Seq.map (fun fi -> fi.Sequence |> Array.filter (not << AminoAcids.isTerminator))
480+
|> Seq.map (fun fi -> fi.Sequence |> Array.ofSeq |> Array.filter (not << AminoAcids.isTerminator))
479481
|> Seq.map digestTryptic
480482
|> Seq.collect (fun dig -> dig |> Seq.map BioArray.toString |> Set.ofSeq |> Set.toSeq)
481483
|> Seq.countBy id
@@ -487,7 +489,7 @@ module DPPOP =
487489
let getDistinctTrypticPeptidesFromFastaFile (filePath: string) =
488490
//fileDir + "Chlamy_Cp.fastA"
489491
filePath
490-
|> FastA.fromFile BioArray.ofAminoAcidString
492+
|> Fasta.read BioArray.ofAminoAcidString
491493
|> getDistinctTrypticPeptidesFromFasta
492494

493495
///returns a map mapping from a (proteinID*sequence) touple to the three digestion efficiency scores in the form of a (float*float*float) tuple
@@ -536,10 +538,10 @@ module DPPOP =
536538
// |> Seq.map calc
537539

538540
///returns a map mapping from a (proteinID*sequence) touple to the three digestion efficiency scores in the form of a (float*float*float) tuple from the input fasta item collection
539-
let createDigestionEfficiencyMapFromFasta (fa:seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) =
541+
let createDigestionEfficiencyMapFromFasta (fa:seq<Fasta.FastaItem<AminoAcids.AminoAcid>>) =
540542
fa
541-
|> Seq.map (fun fi -> {fi with Sequence=fi.Sequence |> Array.filter (not << AminoAcids.isTerminator)})
542-
|> Seq.collect (fun fi -> getDigestionEfficiency fi.Header fi.Sequence)
543+
|> Seq.map (fun fi -> {fi with Sequence=fi.Sequence |> Array.ofSeq |> Array.filter (not << AminoAcids.isTerminator)})
544+
|> Seq.collect (fun fi -> getDigestionEfficiency fi.Header (Array.ofSeq fi.Sequence))
543545
|> Map.ofSeq
544546

545547
///get the physicochemical properties of a peptide: length, MolecularWeight, NetCharge, PositiveCharge, NegativeCharge, piI, Relative frewuencies of polar, hydrophobic, and negatively charge amino acids
@@ -774,7 +776,14 @@ module DPPOP =
774776
res
775777

776778
///Returns relative observability scores for uniquely mapping peptides of proteins of interest given a model, normalization procedure for features, and the proteome of the organism.
777-
let scoreProteinsAgainstProteome (model:Model) (featureNormalization: PredictionInput -> PredictionInput) (proteome: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) (proteinsOfInterest: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) =
779+
let scoreProteinsAgainstProteome
780+
(model:Model)
781+
(featureNormalization: PredictionInput -> PredictionInput)
782+
(proteome: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>)
783+
(proteinsOfInterest: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>)
784+
785+
=
786+
778787
printfn "Determining distinct peptides..."
779788
//only uniquely mapping peptides in the given proteome will be considered candidate peptides.
780789
let distinctPeptides = Classification.getDistinctTrypticPeptidesFromFasta proteome
@@ -785,7 +794,7 @@ module DPPOP =
785794
let protId = protein.Header
786795
//uniquely mapping digested peptides
787796
let digested =
788-
Classification.digestTryptic protein.Sequence
797+
Classification.digestTryptic (Array.ofSeq protein.Sequence)
789798
|> Seq.map (fun x -> BioArray.toString x)
790799
|> List.ofSeq
791800
let candidatePeptides =
@@ -804,9 +813,9 @@ module DPPOP =
804813
)
805814

806815
///Returns relative observability scores for uniquely mapping peptides of proteins of interest using dppops plant model and feature normalization procedure, given the proteome of the organism.
807-
let scoreDppopPlant (proteome: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) (proteinsOfInterest: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) =
816+
let scoreDppopPlant (proteome: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>) (proteinsOfInterest: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>) =
808817
scoreProteinsAgainstProteome Model.Plant Classification.zNormalizePlantFeatureVector proteome proteinsOfInterest
809818

810819
///Returns relative observability scores for uniquely mapping peptides of proteins of interest using dppops non-plant model and feature normalization procedure, given the proteome of the organism.
811-
let scoreDppopNonPlant (proteome: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) (proteinsOfInterest: seq<FastA.FastaItem<BioArray<AminoAcids.AminoAcid>>>) =
812-
scoreProteinsAgainstProteome Model.NonPlant Classification.zNormalizeNonPlantFeatureVector proteome proteinsOfInterest
820+
let scoreDppopNonPlant (proteome: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>) (proteinsOfInterest: seq<Fasta.FastaItem<AminoAcids.AminoAcid>>) =
821+
scoreProteinsAgainstProteome Model.NonPlant Classification.zNormalizeNonPlantFeatureVector proteome proteinsOfInterest

tests/BioFSharp.ML.Tests/BioFSharp.ML.Tests.fsproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="coverlet.collector" Version="6.0.0" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
19-
<PackageReference Include="xunit" Version="2.5.3" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
17+
<PackageReference Include="coverlet.collector" Version="10.0.0" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
19+
<PackageReference Include="xunit" Version="2.9.3" />
20+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
23+
</PackageReference>
2124
</ItemGroup>
2225

2326
<ItemGroup>

0 commit comments

Comments
 (0)