Skip to content

Commit bc50077

Browse files
committed
playground: add decompile script
playground/decompile.fsx loads the locally-built BioFSharp.INSDC assemblies (plus their NuGet dependencies) and decompiles a test fixture into structural-ontology terms — a quick way to eyeball generated term names against a real record.
1 parent e44511c commit bc50077

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

playground/decompile.fsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Playground: load the locally-built BioFSharp.INSDC assemblies (plus their NuGet dependencies) and
2+
// decompile one of the test fixtures into structural-ontology terms.
3+
//
4+
// Build the libraries first so the referenced DLLs exist (Debug output):
5+
// dotnet build src/BioFSharp.IO.INSDC/BioFSharp.IO.INSDC.fsproj
6+
//
7+
// Then run from the repo root:
8+
// dotnet fsi playground/decompile.fsx
9+
//
10+
// A "Could not resolve assembly: BioFSharp.FileFormats.INSDC.XmlSerializers" line may print first —
11+
// that is .NET's XmlSerializer probing for an optional pre-generated serializer and falling back to
12+
// runtime generation. It is harmless and does not affect the output.
13+
14+
// NuGet dependencies of the project assemblies. `#r "nuget:"` restores them; referencing a local DLL
15+
// does not pull in its package deps, so they are listed explicitly. Versions match the .fsproj/.csproj.
16+
#r "nuget: BioFSharp, 2.0.0-preview.3"
17+
#r "nuget: OBO.NET, 0.6.0"
18+
#r "nuget: System.ComponentModel.Annotations, 5.0.0"
19+
20+
// Locally-built project assemblies. Paths are relative to this script's directory (playground/).
21+
#r "../src/BioFSharp.FileFormats.INSDC/bin/Debug/netstandard2.0/BioFSharp.FileFormats.INSDC.dll"
22+
#r "../src/BioFSharp.IO.INSDC/bin/Debug/netstandard2.0/BioFSharp.IO.INSDC.dll"
23+
24+
open System.IO
25+
26+
open BioFSharp.IO.INSDC
27+
28+
// __SOURCE_DIRECTORY__ is playground/, so the fixtures live one level up under tests/fixtures.
29+
let fixture =
30+
Path.Combine(__SOURCE_DIRECTORY__, "..", "tests", "fixtures", "PRJDB5192.xml")
31+
32+
let project = BioProject.read fixture |> Seq.head
33+
34+
let decompiled = BioProject.decompile project
35+
36+
printfn "Decompiled %s -> %d structural-ontology terms:\n" (Path.GetFileName fixture) decompiled.Length
37+
38+
for d in decompiled do
39+
printfn "%-50s = %s" d.Term.Name d.Value
40+
printfn " xpath %s" d.XPath

0 commit comments

Comments
 (0)