-
Notifications
You must be signed in to change notification settings - Fork 514
Add HDL shared test fixtures #1932
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 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8d82104
Add HDL shared test fixtures
lyh970817 17bca4d
Document HDL fixtures in root README
lyh970817 51846da
Document HDL fixtures and align toy sumstats
lyh970817 21357a9
docs: clarify synthetic HDL fixture provenance
lyh970817 2f7f62a
Move HDL toy sumstats into shared popgen path
lyh970817 5250134
Add MIT SPDX header to HDL generator
lyh970817 b04515c
Merge remote-tracking branch 'upstream/modules' into hdl-reference-fi…
lyh970817 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # HDL Toy Test Dataset | ||
|
|
||
| These files are synthetic toy fixtures for HDL module testing in the companion | ||
| `nf-core/modules` work for `nf-core/modules#10912`. They are intended to exercise | ||
| [HDL](https://github.com/zhenin/HDL) inputs in tests, not to provide a | ||
| scientific LD reference panel or redistributed upstream reference bundle. | ||
|
|
||
| ## Layout | ||
|
|
||
| - `reference/`: toy HDL LD reference chunks and metadata sidecars | ||
| - `sumstats/`: canonical toy summary-statistics tables aligned to the toy SNPs | ||
|
|
||
| ## Regeneration | ||
|
|
||
| From this directory: | ||
|
|
||
| ```bash | ||
| Rscript generate_toy_hdl_data.R | ||
| ``` | ||
|
|
||
| From the root of the `nf-core/test-datasets` worktree: | ||
|
|
||
| ```bash | ||
| Rscript data/genomics/homo_sapiens/popgen/hdl/generate_toy_hdl_data.R | ||
| ``` | ||
|
|
||
| ## R Objects | ||
|
|
||
| The `.bim` sidecars, both canonical `sumstats/*.tsv` files, and the R binary | ||
| payloads are all generated locally by `generate_toy_hdl_data.R` from fully | ||
| synthetic constants in this directory. | ||
|
|
||
| - `reference/chr1.1_toy.rda` and `reference/chr1.2_toy.rda` each contain | ||
| synthetic `LDsc`, `lam`, and `V` objects for one toy HDL chunk. | ||
| - `reference/toy_snp_counter.RData` contains `nsnps.list` and | ||
| `nsnps.list.imputed`, each as a named one-element list with the toy chunk SNP | ||
| counts. | ||
| - `reference/toy_snp_list.RData` contains `snps.list.imputed.vector`, the four | ||
| synthetic SNP IDs shared by the toy fixtures. | ||
| - `sumstats/trait1_canonical.tsv` and `sumstats/trait2_canonical.tsv` are tiny | ||
| canonical summary-statistics tables keyed to those synthetic SNP IDs. |
110 changes: 110 additions & 0 deletions
110
data/genomics/homo_sapiens/popgen/hdl/generate_toy_hdl_data.R
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 |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/usr/bin/env Rscript | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a (MIT) licensing statement on top of this script. |
||
|
|
||
| args <- commandArgs(trailingOnly = FALSE) | ||
| file_arg <- "--file=" | ||
| script_path <- sub(file_arg, "", args[grep(file_arg, args)]) | ||
|
|
||
|
|
||
| if (length(script_path) != 1 || script_path == "") { | ||
| stop("Unable to determine the script path from commandArgs().") | ||
| } | ||
|
|
||
| script_dir <- dirname(normalizePath(script_path)) | ||
| reference_dir <- file.path(script_dir, "reference") | ||
| sumstats_dir <- file.path(script_dir, "sumstats") | ||
|
|
||
| dir.create(reference_dir, recursive = TRUE, showWarnings = FALSE) | ||
| dir.create(sumstats_dir, recursive = TRUE, showWarnings = FALSE) | ||
|
|
||
| writeLines( | ||
| c( | ||
| "1 rs1 0 101 A G", | ||
| "1 rs2 0 102 C T" | ||
| ), | ||
| file.path(reference_dir, "chr1.1_toy.bim") | ||
| ) | ||
|
|
||
| writeLines( | ||
| c( | ||
| "1 rs3 0 201 A C", | ||
| "1 rs4 0 202 G T" | ||
|
Comment on lines
+21
to
+30
|
||
| ), | ||
| file.path(reference_dir, "chr1.2_toy.bim") | ||
| ) | ||
|
|
||
| lam <- c(1.3, 0.85) | ||
| LDsc <- c(1.1, 1.4) | ||
| V <- diag(2) | ||
| save( | ||
| LDsc, | ||
| lam, | ||
| V, | ||
| file = file.path(reference_dir, "chr1.1_toy.rda"), | ||
| compress = "gzip" | ||
| ) | ||
|
|
||
| lam <- c(1.25, 0.9) | ||
| LDsc <- c(1.2, 1.35) | ||
| V <- diag(2) | ||
| save( | ||
| LDsc, | ||
| lam, | ||
| V, | ||
| file = file.path(reference_dir, "chr1.2_toy.rda"), | ||
| compress = "gzip" | ||
| ) | ||
|
|
||
| nsnps.list <- list("1" = c(2, 2)) | ||
| nsnps.list.imputed <- list("1" = c(2, 2)) | ||
| save( | ||
| nsnps.list.imputed, | ||
| nsnps.list, | ||
| file = file.path(reference_dir, "toy_snp_counter.RData"), | ||
| compress = "gzip" | ||
| ) | ||
|
|
||
| snps.list.imputed.vector <- c("rs1", "rs2", "rs3", "rs4") | ||
| save( | ||
| snps.list.imputed.vector, | ||
| file = file.path(reference_dir, "toy_snp_list.RData"), | ||
| compress = "gzip" | ||
| ) | ||
|
|
||
| trait1 <- data.frame( | ||
| SNP = c("rs1", "rs2", "rs3", "rs4"), | ||
| A1 = c("A", "C", "A", "G"), | ||
| A2 = c("G", "T", "C", "T"), | ||
| CHR = c(1, 1, 1, 1), | ||
| POS = c(101, 102, 201, 202), | ||
| RSID = c("rs1", "rs2", "rs3", "rs4"), | ||
| EffectAllele = c("A", "C", "A", "G"), | ||
| OtherAllele = c("G", "T", "C", "T"), | ||
| N = c(10000, 10000, 10000, 10000), | ||
| Z = c(0.5, -0.2, 0.4, -0.1) | ||
| ) | ||
| write.table( | ||
| trait1, | ||
| file.path(sumstats_dir, "trait1_canonical.tsv"), | ||
| sep = "\t", | ||
| quote = FALSE, | ||
| row.names = FALSE | ||
| ) | ||
|
|
||
| trait2 <- data.frame( | ||
| SNP = c("rs1", "rs2", "rs3", "rs4"), | ||
| A1 = c("A", "C", "A", "G"), | ||
| A2 = c("G", "T", "C", "T"), | ||
| CHR = c(1, 1, 1, 1), | ||
| POS = c(101, 102, 201, 202), | ||
| RSID = c("rs1", "rs2", "rs3", "rs4"), | ||
| EffectAllele = c("A", "C", "A", "G"), | ||
| OtherAllele = c("G", "T", "C", "T"), | ||
| N = c(12000, 12000, 12000, 12000), | ||
| Z = c(0.3, -0.4, 0.2, -0.2) | ||
| ) | ||
| write.table( | ||
| trait2, | ||
| file.path(sumstats_dir, "trait2_canonical.tsv"), | ||
| sep = "\t", | ||
| quote = FALSE, | ||
| row.names = FALSE | ||
| ) | ||
2 changes: 2 additions & 0 deletions
2
data/genomics/homo_sapiens/popgen/hdl/reference/chr1.1_toy.bim
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 1 rs1 0 101 A G | ||
| 1 rs2 0 102 C T |
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
data/genomics/homo_sapiens/popgen/hdl/reference/chr1.2_toy.bim
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 1 rs3 0 201 A C | ||
| 1 rs4 0 202 G T |
Binary file not shown.
Binary file added
BIN
+127 Bytes
data/genomics/homo_sapiens/popgen/hdl/reference/toy_snp_counter.RData
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
data/genomics/homo_sapiens/popgen/hdl/sumstats/trait1_canonical.tsv
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| SNP A1 A2 CHR POS RSID EffectAllele OtherAllele N Z | ||
| rs1 A G 1 101 rs1 A G 10000 0.5 | ||
| rs2 C T 1 102 rs2 C T 10000 -0.2 | ||
| rs3 A C 1 201 rs3 A C 10000 0.4 | ||
| rs4 G T 1 202 rs4 G T 10000 -0.1 |
5 changes: 5 additions & 0 deletions
5
data/genomics/homo_sapiens/popgen/hdl/sumstats/trait2_canonical.tsv
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| SNP A1 A2 CHR POS RSID EffectAllele OtherAllele N Z | ||
| rs1 A G 1 101 rs1 A G 12000 0.3 | ||
| rs2 C T 1 102 rs2 C T 12000 -0.4 | ||
| rs3 A C 1 201 rs3 A C 12000 0.2 | ||
| rs4 G T 1 202 rs4 G T 12000 -0.2 |
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.
@copilot apply changes based on this feedback
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.
Updated the root README entries to describe these as synthetic HDL-format fixtures generated by
generate_toy_hdl_data.Rfor HDL-compatible inputs, and aligned the PR body wording/checklist with that provenance.