poseidon-framework / poseidon-hs

A toolset to work with modular genotype databases in the Poseidon format
https://poseidon-framework.github.io/#/trident
MIT License
7 stars 2 forks source link

Janno input validation for JSON and CSV data #221

Closed nevrome closed 1 year ago

nevrome commented 1 year ago

In this PR I collect the changes for #167.

Here's some test code to check if en- and decoding to JSON works as expected:

(decode $ encode $ JannoRow {jPoseidonID = "1", jAlternativeIDs = Nothing, jRelationTo = Nothing, jRelationDegree = Nothing, jRelationType = Nothing, jRelationNote = Nothing, jCollectionID = Nothing, jSourceTissue = Nothing, jCountry = Nothing, jLocation = Nothing, jSite = Nothing, jLatitude = Nothing, jLongitude = Nothing, jDateC14Labnr = Nothing, jDateC14UncalBP = Nothing, jDateC14UncalBPErr = Nothing, jDateBCADMedian = Just $ BCADAge 191, jDateBCADStart = Nothing, jDateBCADStop = Nothing, jDateType = Just C14, jDateNote = Nothing, jNrLibraries = Nothing, jCaptureType = Just $ JannoList [Shotgun, TwistAncientDNA, A1240K], jGenotypePloidy = Just Diploid, jGroupName = JannoList {getJannoList = ["huhu"]}, jGeneticSex = JannoSex Female, jNrSNPs = Nothing, jCoverageOnTargets = Nothing, jMTHaplogroup = Nothing, jYHaplogroup = Nothing, jEndogenous = Nothing, jUDG = Nothing, jLibraryBuilt = Nothing, jDamage = Nothing, jContamination = Nothing, jContaminationErr = Nothing, jContaminationMeas = Nothing, jContaminationNote = Nothing, jGeneticSourceAccessionIDs = Nothing, jDataPreparationPipelineURL = Nothing, jPrimaryContact = Nothing, jPublication = Nothing, jComments = Nothing, jKeywords = Nothing, jAdditionalColumns = CsvNamedRecord (HM.fromList [("de", "ab"), ("gugu", "45")])}):: Maybe JannoRow

codecov-commenter commented 1 year ago

Codecov Report

Base: 64.96% // Head: 68.59% // Increases project coverage by +3.62% :tada:

Coverage data is based on head (3d7f12e) compared to base (d8a5b96). Patch coverage: 62.33% of modified lines in pull request are covered.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #221 +/- ## ========================================== + Coverage 64.96% 68.59% +3.62% ========================================== Files 18 18 Lines 2295 2283 -12 Branches 256 258 +2 ========================================== + Hits 1491 1566 +75 + Misses 548 459 -89 - Partials 256 258 +2 ``` | [Impacted Files](https://codecov.io/gh/poseidon-framework/poseidon-hs/pull/221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=poseidon-framework) | Coverage Δ | | |---|---|---| | [src/Poseidon/Janno.hs](https://codecov.io/gh/poseidon-framework/poseidon-hs/pull/221?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=poseidon-framework#diff-c3JjL1Bvc2VpZG9uL0phbm5vLmhz) | `80.03% <62.33%> (+14.38%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=poseidon-framework). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=poseidon-framework)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

nevrome commented 1 year ago

So here is what we discussed in #167. I added some tests to make sure that the en- and decoding cycles work. I hope the human-readable representation of the data in .json and .csv format is still as expected.

I thought about squeezing #225 into this PR as well, but probably it's better to split things into smaller, more digestible chunks.

nevrome commented 1 year ago

Yes - we have. At least for the .janno file. I'll merge this now. Let's hope it doesn't explode.