Skip to content

Preserve input column order for .janno and .ssf files? #340

@nevrome

Description

@nevrome

The reordering of columns is no technical necessity:

makeHeaderWithAdditionalColumns :: [JannoRow] -> Csv.Header
makeHeaderWithAdditionalColumns rows =
V.fromList $ jannoHeader ++ sort (HM.keys (HM.unions (map (getCsvNR . jAdditionalColumns) rows)))
writeJannoFile :: FilePath -> JannoRows -> IO ()
writeJannoFile path (JannoRows rows) = do
let jannoAsBytestring = Csv.encodeByNameWith encodingOptions (makeHeaderWithAdditionalColumns rows) rows
Bch.writeFile path jannoAsBytestring

We could store the input column order and use it when writing. For forge we would need some sort of associative operation to combine the column orders of different packages.

This is not urgent. But I still think it is worth a look. Would prevent situations such as in #339.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions