-
Notifications
You must be signed in to change notification settings - Fork 2
feat: CLIN-5494 Safe parse OMIM phenotypes attributes #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
779172c
feat: CLIN-5494 Safe parse OMIM phenotypes attributes
emmanuelnau bf2032c
feat: CLIN-5494 Add doc for local publish
emmanuelnau 1066a5b
feat: CLIN-5494 Revert regex changes to use a dedicated regex + test
emmanuelnau d572279
feat: CLIN-5494 Update regex, to match genemap2-parser parsing
emmanuelnau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 22 additions & 12 deletions
34
...3/src/test/scala/bio/ferlab/datalake/spark3/publictables/normalized/OmimGeneSetSpec.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,38 @@ | ||
| package bio.ferlab.datalake.spark3.publictables.normalized | ||
|
|
||
| import bio.ferlab.datalake.commons.config.DatasetConf | ||
| import bio.ferlab.datalake.spark3.publictables.normalized.omim.OmimGeneSet | ||
| import bio.ferlab.datalake.spark3.testutils.WithTestConfig | ||
| import bio.ferlab.datalake.testutils.{CleanUpBeforeAll, CreateDatabasesBeforeAll, SparkSpec} | ||
| import bio.ferlab.datalake.testutils.models.normalized.{NormalizedOmimGeneSet, PHENOTYPE} | ||
| import bio.ferlab.datalake.testutils.models.raw.RawOmimGeneSet | ||
| import bio.ferlab.datalake.testutils.{SparkSpec, TestETLContext} | ||
|
|
||
| class OmimGeneSetSpec extends SparkSpec with WithTestConfig with CreateDatabasesBeforeAll with CleanUpBeforeAll { | ||
| class OmimGeneSetSpec extends SparkSpec with WithTestConfig { | ||
|
|
||
| import spark.implicits._ | ||
|
|
||
| val source: DatasetConf = conf.getDataset("raw_omim_gene_set") | ||
| val destination: DatasetConf = conf.getDataset("normalized_omim_gene_set") | ||
|
|
||
| override val dbToCreate: List[String] = List(destination.table.map(_.database).getOrElse("variant")) | ||
| override val dsToClean: List[DatasetConf] = List(destination) | ||
| "transform" should "transform RawOmimGeneSet to NormalizedOmimGeneSet" in { | ||
|
|
||
| /* | ||
| //TODO fix this | ||
| ANTLR Tool version 4.7 used for code generation does not match the current runtime version 4.8 | ||
| val rawOmimGeneSet2PhenotypeName = "Acute myeloid leukemia, somatic" | ||
| val rawOmimGeneSet3PhenotypeName = "Hemolytic anemia due to phosphofructokinase deficiency" | ||
|
|
||
| "ImportOmimGeneSet" should "transform data into expected format" in { | ||
| val inputData = Map(source.id -> Seq(RawOmimGeneSet(), // with phenotypes having omim_id and inheritance | ||
| RawOmimGeneSet(_c12 = rawOmimGeneSet2PhenotypeName + ", 601626 (3)"), // with phenotypes having omim_id and no inheritance | ||
| RawOmimGeneSet(_c12 = rawOmimGeneSet3PhenotypeName + " (1)") // with phenotypes having no omim_id and no inheritance | ||
| ).toDF()) | ||
|
|
||
| val inputDf = Map(source.id -> Seq(OmimGeneSetInput()).toDF()) | ||
| val outputDf = new OmimGeneSet().transform(inputDf) | ||
| val resultDF = new OmimGeneSet(TestETLContext()).transformSingle(inputData) | ||
|
|
||
| outputDf.as[OmimGeneSetOutput].collect() should contain theSameElementsAs Seq(OmimGeneSetOutput()) | ||
| val expectedResults = Seq(NormalizedOmimGeneSet(), | ||
| NormalizedOmimGeneSet(phenotype = PHENOTYPE(name = rawOmimGeneSet2PhenotypeName, | ||
| omim_id = "601626", null, null)), | ||
| NormalizedOmimGeneSet(phenotype = PHENOTYPE(name = rawOmimGeneSet3PhenotypeName, | ||
| omim_id = null, null, null)) | ||
| ) | ||
| resultDF.as[NormalizedOmimGeneSet].collect() shouldBe expectedResults | ||
| } | ||
| */ | ||
| } | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍