diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 196c206f..ba66840a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,6 +2,10 @@ (preview packages available on nuget) **Additions:** + + * **BioFSharp**: + * [Conversion extensions for BioCollections]() + * **BioFSharp.BioContainers** * BLAST biocontainer : * full blastn, blastn-short, megablast, and dc-megablast DSLs diff --git a/src/BioFSharp/BioCollectionsExtensions.fs b/src/BioFSharp/BioCollectionsExtensions.fs new file mode 100644 index 00000000..16bd939b --- /dev/null +++ b/src/BioFSharp/BioCollectionsExtensions.fs @@ -0,0 +1,43 @@ +namespace BioFSharp + +open BioSeq +open BioArray +open BioList + +[] +module BioCollectionsExtensions = + module BioSeq = + + [] + let toBioArray (bioSeq:BioSeq<_>) : BioArray<_> = Seq.toArray bioSeq + [] + let toBioList (bioSeq:BioSeq<_>) : BioList<_> = Seq.toList bioSeq + + [] + let ofBioArray (bioArray:BioArray<_>) : BioSeq<_> = Seq.ofArray bioArray + [] + let ofBioList (bioList :BioList<_>) : BioSeq<_> = Seq.ofList bioList + + module BioList = + + [] + let toBioArray (bioList:BioList<_>) : BioArray<_> = List.toArray bioList + [] + let toBioSeq (bioList:BioList<_>) : BioSeq<_> = List.toSeq bioList + + [] + let ofBioArray (bioArray:BioArray<_>) : BioList<_> = List.ofArray bioArray + [] + let ofBioSeq (bioSeq:BioSeq<_>) : BioList<_> = List.ofSeq bioSeq + + module BioArray = + + [] + let toBioList (bioArray:BioArray<_>) : BioList<_> = Array.toList bioArray + [] + let toBioSeq (bioArray:BioArray<_>) : BioSeq<_> = Array.toSeq bioArray + + [] + let ofBioList (bioList :BioList<_>) : BioArray<_> = Array.ofList bioList + [] + let ofBioSeq (bioSeq :BioSeq<_>) : BioArray<_> = Array.ofSeq bioSeq \ No newline at end of file diff --git a/src/BioFSharp/BioFSharp.fsproj b/src/BioFSharp/BioFSharp.fsproj index fbb21ff5..11f26e48 100644 --- a/src/BioFSharp/BioFSharp.fsproj +++ b/src/BioFSharp/BioFSharp.fsproj @@ -44,6 +44,7 @@ + @@ -75,6 +76,7 @@ + diff --git a/src/BioFSharp/Playground/BioCollectionsExtensions.fsx b/src/BioFSharp/Playground/BioCollectionsExtensions.fsx new file mode 100644 index 00000000..b00d81d0 --- /dev/null +++ b/src/BioFSharp/Playground/BioCollectionsExtensions.fsx @@ -0,0 +1,53 @@ +#r "../../../packages/FSharpAux/lib/netstandard2.0/FSharpAux.dll" + +#load "../PhysicalConstants.fs" +#load "../BioID.fs" +#load "../Isotopes.fs" +#load "../Elements.fs" +#load "../Formula.fs" +#load "../Mass.fs" +#load "../IBioItem.fs" +#load "../TaggedSequence.fs" +#load "../IsotopicDistribution.fs" +#load "../ModificationInfo.fs" +#load "../AminoAcidSymbols.fs" +#load "../AminoAcids.fs" +#load "../Nucleotides.fs" +#load "../GlobalModificationInfo.fs" +#load "../BioItemsConverter.fs" +#load "../BioSeq.fs" +#load "../BioArray.fs" +#load "../BioList.fs" +#load "../BioCollectionsExtensions.fs" + +open BioFSharp + +let testSeq = + BioSeq.ofAminoAcidString "TESTESTESTLUL" + +testSeq |> BioSeq.toString + +let meem = + + testSeq + + |> BioList.ofBioSeq + |> BioSeq.toBioList + + |> BioArray.ofBioList + |> BioArray.toBioList + + |> BioSeq.ofBioList + |> BioSeq.toBioArray + + |> BioList.ofBioArray + |> BioList.toBioArray + + |> BioSeq.ofBioArray + |> BioSeq.toBioList + + |> BioList.toBioSeq + |> BioArray.ofBioSeq + |> BioArray.toBioSeq + +(BioSeq.isEqual testSeq meem ) = 0 \ No newline at end of file