From ff51cc7393205856773da2a2f0ab787f3a0bfc1b Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Wed, 22 Nov 2023 07:05:22 +0100 Subject: [PATCH] Adds a --transpose option to obimatrix Former-commit-id: b2ee47c15441dca971b20f583003a3788a96da23 --- pkg/obitools/obimatrix/obimatrix.go | 4 +++- pkg/obitools/obimatrix/options.go | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/obitools/obimatrix/obimatrix.go b/pkg/obitools/obimatrix/obimatrix.go index 4b5ee6b..831d5f8 100644 --- a/pkg/obitools/obimatrix/obimatrix.go +++ b/pkg/obitools/obimatrix/obimatrix.go @@ -137,7 +137,9 @@ func CLIWriteCSVToStdout(matrix *MatrixData) { navalue := CLINaValue() csvwriter := csv.NewWriter(os.Stdout) - matrix = matrix.TransposeMatrixData() + if CLITranspose() { + matrix = matrix.TransposeMatrixData() + } samples := obiutils.NewSet[string]() diff --git a/pkg/obitools/obimatrix/options.go b/pkg/obitools/obimatrix/options.go index e91ccb3..da4c766 100644 --- a/pkg/obitools/obimatrix/options.go +++ b/pkg/obitools/obimatrix/options.go @@ -10,6 +10,7 @@ import ( ) var __threeColumns__ = false +var __transpose__ = true var __mapAttribute__ = "merged_sample" var __valueName__ = "count" var __sampleName__ = "sample" @@ -19,6 +20,9 @@ func MatrixOptionSet(options *getoptions.GetOpt) { options.BoolVar(&__threeColumns__, "three-columns", false, options.Description("Printouts the matrix in tree column format.")) + options.BoolVar(&__transpose__, "transpose", __transpose__, + options.Description("Printouts the transposed matrix.")) + options.StringVar(&__mapAttribute__, "map", __mapAttribute__, options.Description("Which attribute is usd to produce th matrix.")) @@ -60,3 +64,7 @@ func CLINaValue() string { func CLIMapAttribute() string { return __mapAttribute__ } + +func CLITranspose() bool { + return __transpose__ +}