Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Mar 18, 2024
1 parent 60d575e commit 1cd68ea
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "4.13.0",
"version": "4.15.0",
"commands": [
"fable"
]
Expand Down
21 changes: 12 additions & 9 deletions docs/scripts_js/ARC.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {ARC} from "@nfdi4plants/arctrl";
import {fulfillWriteContract, fulfillReadContract} from "./Contracts.js";
import {fulfillWriteContract, fulfillReadContract, normalizePathSeparators} from "./Contracts.js";
import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/ArcTypes/ArcInvestigation.js"
import fs from "fs";
import path from "path";

// # Create

let arc = new ARC()

// # Write
const arcRootPath = "C:/Users/Kevin/Desktop/NewTestARCJS"
const arcRootPath = "TestArc"

async function write(arcPath, arc) {
let contracts = arc.GetWriteContracts()
Expand All @@ -16,15 +19,11 @@ async function write(arcPath, arc) {
};
}

await write(arcRootPath, arc)
// await write(arcRootPath, arc)

// # Read

// Setup
function normalizePathSeparators (str) {
const normalizedPath = path.normalize(str)
return normalizedPath.replace(/\\/g, '/');
}

export function getAllFilePaths(basePath) {
const filesList = []
Expand Down Expand Up @@ -55,7 +54,7 @@ async function read(basePath) {
let arc = ARC.fromFilePaths(allFilePaths)
// Read contracts will tell us what we need to read from disc.
let readContracts = arc.GetReadContracts()
console.log(readContracts)
// console.log(readContracts)
let fcontracts = await Promise.all(
readContracts.map(async (contract) => {
let content = await fulfillReadContract(basePath, contract)
Expand All @@ -69,4 +68,8 @@ async function read(basePath) {

// Execution

await read(arcRootPath).then(arc => console.log(arc))
await read(arcRootPath).then(arc => {
// let json = ArcInvestigation_toJsonString(arc.ISA)
// console.log(json)
console.log(arc)
})
4 changes: 2 additions & 2 deletions docs/scripts_js/ArcInvestigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ArcInvestigation, Comment$ as Comment} from "@nfdi4plants/arctrl"
import {Xlsx} from "@fslab/fsspreadsheet";
// Import ARCtrl Investigation to Spreadsheet transformation
import {toFsWorkbook, fromFsWorkbook} from "@nfdi4plants/arctrl/ISA/ISA.Spreadsheet/ArcInvestigation.js"
import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/Investigation.js"
import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/ArcTypes/ArcInvestigation.js"

// # Comments

Expand All @@ -23,7 +23,7 @@ console.log(investigation_comments)

let fswb = toFsWorkbook(investigation_comments)

Xlsx.toFile("test.isa.investigation.xlsx", fswb)
// Xlsx.toFile("test.isa.investigation.xlsx", fswb)

// Json - Write

Expand Down
6 changes: 6 additions & 0 deletions docs/scripts_js/Contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import path from "path";

// Write

export function normalizePathSeparators (str) {
const normalizedPath = path.normalize(str)
return normalizedPath.replace(/\\/g, '/');
}


export async function fulfillWriteContract (basePath, contract) {
function ensureDirectory (filePath) {
let dirPath = path.dirname(filePath)
Expand Down
16 changes: 8 additions & 8 deletions docs/scripts_js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/scripts_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Kevin Frey",
"license": "MIT",
"dependencies": {
"@nfdi4plants/arctrl": "^1.0.0-beta.9",
"@fslab/fsspreadsheet": "^5.0.0"
"@nfdi4plants/arctrl": "^1.2.0",
"@fslab/fsspreadsheet": "^6.0.1"
}
}
1 change: 0 additions & 1 deletion tests/ISA/ISA.Json.Tests/Json.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ let testOntoloyAnnotationLD =
)
]


let testProcessInput =

testList "ProcessInput" [
Expand Down

0 comments on commit 1cd68ea

Please sign in to comment.