Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func (in *Param) IsFile() bool {
}

func (in *Param) IsDir() bool {
return strings.ToLower(in.Type) == "path"
t := strings.ToLower(in.Type)
return t == "path" || t == "dir"
}

func TrimPrefix(s string) string {
Expand All @@ -38,5 +39,6 @@ func (in *ParamRequest) IsFile() bool {
}

func (in *ParamRequest) IsDir() bool {
return strings.ToLower(in.Type) == "path"
t := strings.ToLower(in.Type)
return t == "path" || t == "dir"
}
4 changes: 2 additions & 2 deletions docs/docs/config.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Paramaters
title: Parameters
---

## Paramaters Variables
## Parameters Variables

Playbooks can be parameterized. They are defined in the `params` section of the playbook YAML file.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/inputs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The `table` loader is a good starting point because it demonstrates the typical
params:
gafFile:
type: File
value: ../../source/go/goa_human.gaf.gz
default: ../../source/go/goa_human.gaf.gz

inputs:
gafLoad:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Loads data from a SQLite database.

### `transpose`
Loads a TSV and transposes it (making rows from columns).
- `input`: Path to the file.
- `path`: Path to the file.
- `rowSkip`: Rows to skip.
- `sep`: Separator.
- `useDB`: Use a temporary disk database for large transpositions.
Expand Down
2 changes: 1 addition & 1 deletion extractors/sqldump_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)

type SQLDumpStep struct {
Path string `json:"Path" jsonschema_description:"Path to the SQL dump file"`
Path string `json:"path" jsonschema_description:"Path to the SQL dump file"`
Tables []string `json:"tables" jsonschema_description:"Array of transforms for the different tables in the SQL dump"`
}

Expand Down Expand Up @@ -59,7 +59,7 @@
go func() {
defer fhd.Close()
defer close(out)
tableColumns := map[string][]string{}

Check failure on line 62 in extractors/sqldump_step.go

View workflow job for this annotation

GitHub Actions / lint

tableColumns declared and not used (typecheck)
data, _ := io.ReadAll(hd)
parser := sqlparser.Parser{}
tokens := parser.NewStringTokenizer(string(data))
Expand Down
2 changes: 1 addition & 1 deletion extractors/tabular_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

type TableLoadStep struct {
Path string `json:"Path" jsonschema_description:"TSV to be transformed"`
Path string `json:"path" jsonschema_description:"TSV to be transformed"`
RowSkip int `json:"rowSkip" jsonschema_description:"Number of header rows to skip"`
Columns []string `json:"columns" jsonschema_description:"Manually set names of columns"`
ExtraColumns string `json:"extraColumns" jsonschema_description:"Columns beyond originally declared columns will be placed in this array"`
Expand Down
15 changes: 8 additions & 7 deletions extractors/transpose_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func transposeInDB(workdir string, c csvReader, out chan map[string]any) error {
}

func transposeInTable(workdir string, fieldSize int, c csvReader, out chan map[string]any) error {

defer close(out)
table, err := os.Create(filepath.Join(workdir, "transpose"))
if err != nil {
return err
Expand Down Expand Up @@ -316,12 +316,14 @@ func transposeInTable(workdir string, fieldSize int, c csvReader, out chan map[s
columns := []string{}
for row := int64(0); row < rowCount; row++ {
buf := make([]byte, fieldSize)
_, err := table.ReadAt(buf, row*stepSize)
tmp := bytes.Split(buf, []byte{0})
if err == nil {
columns = append(columns, string(tmp[0]))
} else {
n, err := table.ReadAt(buf, row*stepSize)
if err != nil && err != io.EOF {
logger.Error("Column error", "message", err)
continue
}
if n > 0 {
tmp := bytes.Split(buf[:n], []byte{0})
columns = append(columns, string(tmp[0]))
}
}

Expand All @@ -341,7 +343,6 @@ func transposeInTable(workdir string, fieldSize int, c csvReader, out chan map[s
out <- record
}
table.Close()
close(out)
os.RemoveAll(workdir)
return nil
}
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/bmeg/flame v0.0.0-20231228021014-450efb0021a6 h1:7cacs+zs6d9oP0ylXMrmb6PlH8773WEnj/yohQRZkiA=
github.com/bmeg/flame v0.0.0-20231228021014-450efb0021a6/go.mod h1:XA9wVP0ORyATjjwdbwkjq/yaimsnreixGUR62sGMWsY=
github.com/bmeg/flame v0.0.0-20250730184845-2dc57651053c h1:ktjBmJUTaHjRoabJio6+P/GPGNjm640gQi3OfcSlnBI=
github.com/bmeg/flame v0.0.0-20250730184845-2dc57651053c/go.mod h1:telO7T1SSr9Ejv9nm//xcSMCQWynGFll08bnGMwBO/o=
github.com/bmeg/golib v0.0.0-20200725232156-e799a31439fc h1:/0v/ZcXYjGs44InmjECrls31onIbVKVu1Q/E2cmnCEU=
Expand Down
4 changes: 2 additions & 2 deletions test/command_line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func TestCommandLines(t *testing.T) {
// read in conf, ie config.yaml in this case
for _, c := range conf {
cmd := exec.Command("../sifter", "run", c.Playbook)
fmt.Printf("Running: %s\n", c.Playbook)
t.Logf("Running: %s\n", c.Playbook)
err = cmd.Run()
if err != nil {
t.Errorf("Failed running %s: %s", c.Playbook, err)
} else {
for i, chk := range c.Outputs {
// iterate through expected output paths
path := filepath.Join(filepath.Dir(c.Playbook), chk)
fmt.Printf("Checking %s \n", path)
t.Logf("Checking %s \n", path)
if stat, err := os.Stat(path); err == nil {
if stat.Size() > 0 {
file, err := os.Open(path)
Expand Down
4 changes: 4 additions & 0 deletions test/resources/transpose_test.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gene sample1 sample2 sample3
EGFR 5.2 3.1 7.4
KRAS 2.5 1.8 3.2
TP53 6.1 4.5 5.8
82 changes: 0 additions & 82 deletions test/unittests/playbook_examples_test.go

This file was deleted.

34 changes: 0 additions & 34 deletions test/unittests/project_test.go

This file was deleted.

Loading