65 | {{include "components/score_list.html"}}
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | {{include "components/samples.html"}}
74 |
75 |
76 | {{include "components/score_details.html"}}
77 |
78 |
79 |
80 | {{include "components/distribution.html"}}
81 |
82 |
83 |
84 |
85 | {{include_script("https://code.jquery.com/jquery-3.5.1.slim.min.js")}}
86 | {{include_script("https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js")}}
87 | {{include_script("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js")}}
88 | {{include_script("https://cdn.plot.ly/plotly-latest.min.js")}}
89 | {{include_script("https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js")}}
90 |
91 | {{include_script("report.js")}}
92 |
93 |
94 |
--------------------------------------------------------------------------------
/src/main/resources/templates/default/report.css:
--------------------------------------------------------------------------------
1 | .bd-placeholder-img {
2 | font-size: 1.125rem;
3 | text-anchor: middle;
4 | -webkit-user-select: none;
5 | -moz-user-select: none;
6 | -ms-user-select: none;
7 | user-select: none;
8 | }
9 |
10 | @media (min-width: 768px) {
11 | .bd-placeholder-img-lg {
12 | font-size: 3.5rem;
13 | }
14 | }
15 |
16 | #wrapper {
17 | overflow-x: hidden;
18 | }
19 |
20 | #sidebar-wrapper {
21 | height: 100%;
22 | position: fixed;
23 | margin-left: 0rem;
24 | -webkit-transition: margin .25s ease-out;
25 | -moz-transition: margin .25s ease-out;
26 | -o-transition: margin .25s ease-out;
27 | transition: margin .25s ease-out;
28 | }
29 |
30 | #page-content-wrapper {
31 | padding-left: 250px;
32 | margin-top: 90px;
33 | width: 100%;
34 | }
35 |
36 | #wrapper.toggled #sidebar-wrapper {
37 | margin-left: 0;
38 | }
39 |
40 | .sidebar-search {
41 | margin-top: 80px;
42 | width: 250px;
43 | }
44 |
45 | .sidebar-list {
46 | width: 242px;
47 | top: 135px;
48 | position: fixed;
49 | overflow-y: scroll;
50 | bottom: 0px;
51 | padding-top: 0px;
52 | padding-right: 8px;
53 | }
54 |
55 | .coverage-low {
56 | border-left-width: 8px;
57 | border-left-color: #dc3545;
58 | }
59 |
60 | .coverage-medium {
61 | border-left-width: 8px;
62 | border-left-color: #ffc107;
63 | }
64 |
65 | .coverage-high {
66 | border-left-width: 8px;
67 | border-left-color: #28a745;
68 | }
69 |
70 | .coverage-zero {
71 | border-left-width: 8px;
72 | border-left-color: #dc3545;
73 | }
74 |
75 | .badge-low {
76 | color: #ffffff;
77 | background: #dc3545;
78 | }
79 |
80 | .badge-medium {
81 | color: #ffffff;
82 | background: #ffc107;
83 | }
84 |
85 | .badge-high {
86 | color: #ffffff;
87 | background: #28a745;
88 | }
89 |
90 | .badge-zero {
91 | color: #ffffff;
92 | background: #dc3545;
93 | }
94 |
--------------------------------------------------------------------------------
/src/main/resources/templates/default/report.json:
--------------------------------------------------------------------------------
1 | data = [];
2 | excluded = [];
3 | {{for index,score in scores}}
4 | {{if score.data != null}}
5 | data['score{{index}}']= {{json(score.data)}};
6 | excluded['score{{index}}'] = {{json(score.excluded)}};
7 | {{end}}
8 | {{end}}
9 |
10 | {{if (show_samples)}}
11 | samples = {{json(samples)}};
12 | {{end}}
13 |
14 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/components/score_list.html:
--------------------------------------------------------------------------------
1 |
22 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/components/score_list.js:
--------------------------------------------------------------------------------
1 | activeItem = $('#sample-item');
2 |
3 | function setActive(e) {
4 |
5 | if (activeItem){
6 | activeItem.removeClass("active");
7 | }
8 | $(this).addClass("active");
9 | activeItem = $(this);
10 | }
11 |
12 |
13 | $(document).ready(function() {
14 |
15 | //event handler
16 | $('.list-group-item').on('click', setActive);
17 |
18 | });
19 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Report - {{application}}
11 |
12 |
13 | {{include_style("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css")}}
14 | {{include_style("../default/report.css")}}
15 |
16 | {{include_script("report.json")}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
50 |
51 |
52 |
53 | {{include "components/score_list.html"}}
54 |
55 |
56 |
57 |
58 | {{include_script("https://code.jquery.com/jquery-3.5.1.slim.min.js")}}
59 | {{include_script("https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js")}}
60 | {{include_script("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js")}}
61 | {{include_script("https://cdn.plot.ly/plotly-latest.min.js")}}
62 | {{include_script("https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js")}}
63 |
64 | {{include_script("../default/report.js")}}
65 | {{include_script("components/score_list.js")}}
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/report.json:
--------------------------------------------------------------------------------
1 | data = [];
2 | excluded = [];
3 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/samples.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Report - {{application}}
11 |
12 |
13 | {{include_style("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css")}}
14 | {{include_style("../default/report.css")}}
15 |
16 | {{include_script("report.json")}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{include "../default/components/samples.html"}}
25 |
26 |
27 |
28 | {{include_script("https://code.jquery.com/jquery-3.5.1.slim.min.js")}}
29 | {{include_script("https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js")}}
30 | {{include_script("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js")}}
31 | {{include_script("https://cdn.plot.ly/plotly-latest.min.js")}}
32 | {{include_script("https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js")}}
33 | {{include_script("../default/report.js")}}
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/resources/templates/multi-page/score.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Report - {{application}}
11 |
12 |
13 | {{include_style("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css")}}
14 | {{include_style("../default/report.css")}}
15 |
16 | {{include_script("../default/report.json")}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{include "../default/components/score_details.html"}}
25 | {{include "../default/components/distribution.html"}}
26 |
27 |
28 |
29 | {{include_script("https://code.jquery.com/jquery-3.5.1.slim.min.js")}}
30 | {{include_script("https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js")}}
31 | {{include_script("https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js")}}
32 | {{include_script("https://cdn.plot.ly/plotly-latest.min.js")}}
33 | {{include_script("https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js")}}
34 | {{include_script("../default/report.js")}}
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/main/resources/templates/txt/index.html:
--------------------------------------------------------------------------------
1 | score,coverage,variants_used,variants_total,variants_flipped,variants_ambiguous,trait,trait_efo
2 | {{for index,score in scores}}{{score.name}},{{score.coverage}},{{score.variantsUsed}},{{score.variants}},{{score.flipped}},{{score.ambiguous}},{{if score.meta != null}}{{score.meta.trait.replaceAll(","," ")}},{{if score.meta.efo != null}}{{score.meta.efo[0].id}}{{end}}{{else}},{{end}}
3 | {{end}}
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/commands/CreateHtmlReportCommandTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.commands;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Before;
6 | import org.junit.BeforeClass;
7 | import org.junit.Test;
8 |
9 | import genepi.io.FileUtil;
10 | import genepi.riskscore.io.PGSCatalog;
11 | import lukfor.progress.TaskService;
12 | import picocli.CommandLine;
13 |
14 | public class CreateHtmlReportCommandTest {
15 |
16 | @BeforeClass
17 | public static void setup() {
18 | TaskService.setAnsiSupport(false);
19 | PGSCatalog.ENABLE_CACHE = false;
20 | }
21 |
22 | @Before
23 | public void beforeTest() {
24 | System.out.println("Clean up output directory");
25 | FileUtil.deleteDirectory("test-data-output");
26 | FileUtil.createDirectory("test-data-output");
27 | }
28 |
29 | @Test
30 | public void testReport() throws Exception {
31 |
32 | String[] args = { "--data", "test-data/output.csv", "--info", "test-data/report.json", "--out",
33 | "test-data-output/report.html" };
34 | int result = new CommandLine(new CreateHtmlReportCommand()).execute(args);
35 | assertEquals(0, result);
36 |
37 | }
38 |
39 | @Test
40 | public void testReportWithoutData() throws Exception {
41 |
42 | String[] args = { "--info", "test-data/report.json", "--out", "test-data-output/report.html" };
43 | int result = new CommandLine(new CreateHtmlReportCommand()).execute(args);
44 | assertEquals(0, result);
45 |
46 | }
47 |
48 | @Test
49 | public void testReportWithTxtTemplate() throws Exception {
50 |
51 | String[] args = { "--info", "test-data/report.json", "--out", "test-data-output/report.txt", "--template",
52 | "txt" };
53 | int result = new CommandLine(new CreateHtmlReportCommand()).execute(args);
54 | assertEquals(0, result);
55 |
56 | }
57 |
58 | @Test
59 | public void testReportWithTxtTemplateAndMetaData() throws Exception {
60 |
61 | String[] args = { "--info", "test-data/report.json", "--out", "test-data-output/report.txt", "--template",
62 | "txt", "--meta", "test-data/pgs-catalog-small.json" };
63 | int result = new CommandLine(new CreateHtmlReportCommand()).execute(args);
64 | assertEquals(0, result);
65 |
66 | }
67 |
68 | @Test
69 | public void testReportWithHtmlTemplateAndMetaData() throws Exception {
70 |
71 | String[] args = { "--info", "test-data/report.json", "--out", "test-data-output/report.html", "--meta",
72 | "test-data/pgs-catalog-small.json" };
73 | int result = new CommandLine(new CreateHtmlReportCommand()).execute(args);
74 | assertEquals(0, result);
75 |
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/commands/MergeEffectsCommandTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.commands;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Before;
6 | import org.junit.BeforeClass;
7 | import org.junit.Test;
8 |
9 | import genepi.io.FileUtil;
10 | import genepi.riskscore.io.PGSCatalog;
11 | import lukfor.progress.TaskService;
12 | import picocli.CommandLine;
13 |
14 | public class MergeEffectsCommandTest {
15 |
16 | @BeforeClass
17 | public static void setup() {
18 | TaskService.setAnsiSupport(false);
19 | PGSCatalog.ENABLE_CACHE = false;
20 | }
21 |
22 | @Before
23 | public void beforeTest() {
24 | System.out.println("Clean up output directory");
25 | FileUtil.deleteDirectory("test-data-output");
26 | FileUtil.createDirectory("test-data-output");
27 | }
28 |
29 | @Test
30 | public void testMerge() throws Exception {
31 |
32 | String[] args = { "test-data/effects.chunk1.txt", "test-data/effects.chunk2.txt", "--out",
33 | "test-data-output/effects.task.txt" };
34 | int result = new CommandLine(new MergeEffectsCommand()).execute(args);
35 | assertEquals(0, result);
36 |
37 | assertEquals(FileUtil.readFileAsString("test-data/effects.expected.txt"),
38 | FileUtil.readFileAsString("test-data-output/effects.task.txt"));
39 | }
40 |
41 | @Test
42 | public void testMergingChunks() throws Exception {
43 |
44 | // Whole file
45 | String[] args = { "test-data/chr20.dose.vcf.gz", "--ref",
46 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--out", "test-data-output/output.csv",
47 | "--report-json", "test-data-output/report.json", "--writeEffects", "test-data-output/effects.txt" };
48 | int result = new CommandLine(new ApplyScoreCommand()).execute(args);
49 | assertEquals(0, result);
50 |
51 | // chunks
52 |
53 | int lengthChr20 = 64444167;
54 | int chunkSize = 10000000;
55 | int chunks = (lengthChr20 / chunkSize);
56 | if (lengthChr20 % chunkSize > 0) {
57 | chunks++;
58 | }
59 |
60 | String[] effectsFiles = new String[chunks];
61 | String[] chunkFiles = new String[chunks];
62 | String[] reportFiles = new String[chunks];
63 |
64 | int count = 0;
65 | for (int i = 1; i <= lengthChr20; i += chunkSize) {
66 | int start = i;
67 | int end = i + chunkSize - 1;
68 | String chunk = "test-data-output/output" + start + "_" + end + ".csv";
69 | String report = "test-data-output/output" + start + "_" + end + ".json";
70 | String effects = "test-data-output/effects" + start + "_" + end + ".txt";
71 | args = new String[] { "test-data/chr20.dose.vcf.gz", "--ref",
72 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--start", start + "", "--end", end + "",
73 | "--out", chunk, "--report-json", report, "--writeEffects", effects };
74 | result = new CommandLine(new ApplyScoreCommand()).execute(args);
75 | assertEquals(0, result);
76 |
77 | chunkFiles[count] = chunk;
78 | reportFiles[count] = report;
79 | effectsFiles[count] = effects;
80 | count++;
81 | }
82 |
83 | args = new String[effectsFiles.length + 2];
84 | for (int i = 0; i < effectsFiles.length; i++) {
85 | args[i] = effectsFiles[i];
86 | }
87 | args[effectsFiles.length] = "--out";
88 | args[effectsFiles.length + 1] = "test-data-output/effects.merged.txt";
89 |
90 | result = new CommandLine(new MergeEffectsCommand()).execute(args);
91 | assertEquals(0, result);
92 |
93 | assertEquals(FileUtil.readFileAsString("test-data-output/effects.txt"),
94 | FileUtil.readFileAsString("test-data-output/effects.merged.txt"));
95 |
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/commands/MergeVariantsCommandTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.commands;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertNotNull;
5 |
6 | import java.util.HashMap;
7 |
8 | import org.junit.Before;
9 | import org.junit.BeforeClass;
10 | import org.junit.Test;
11 |
12 | import genepi.io.FileUtil;
13 | import genepi.io.table.reader.CsvTableReader;
14 | import genepi.io.table.reader.ITableReader;
15 | import genepi.riskscore.io.PGSCatalog;
16 | import genepi.riskscore.io.VariantFile;
17 | import lukfor.progress.TaskService;
18 | import picocli.CommandLine;
19 |
20 | public class MergeVariantsCommandTest {
21 |
22 | @BeforeClass
23 | public static void setup() {
24 | TaskService.setAnsiSupport(false);
25 | PGSCatalog.ENABLE_CACHE = false;
26 | }
27 |
28 | @Before
29 | public void beforeTest() {
30 | System.out.println("Clean up output directory");
31 | FileUtil.deleteDirectory("test-data-output");
32 | FileUtil.createDirectory("test-data-output");
33 | }
34 |
35 | @Test
36 | public void testMergingChunks() throws Exception {
37 |
38 | // Whole file
39 | String[] args = { "test-data/chr20.dose.vcf.gz", "--ref",
40 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--out", "test-data-output/output.csv",
41 | "--report-json", "test-data-output/report.json", "--writeVariants", "test-data-output/variants.txt" };
42 | int result = new CommandLine(new ApplyScoreCommand()).execute(args);
43 | assertEquals(0, result);
44 |
45 | // chunks
46 |
47 | int lengthChr20 = 64444167;
48 | int chunkSize = 10000000;
49 | int chunks = (lengthChr20 / chunkSize);
50 | if (lengthChr20 % chunkSize > 0) {
51 | chunks++;
52 | }
53 |
54 | String[] variantFiles = new String[chunks];
55 | String[] chunkFiles = new String[chunks];
56 | String[] reportFiles = new String[chunks];
57 |
58 | int count = 0;
59 | for (int i = 1; i <= lengthChr20; i += chunkSize) {
60 | int start = i;
61 | int end = i + chunkSize - 1;
62 | String chunk = "test-data-output/output" + start + "_" + end + ".csv";
63 | String report = "test-data-output/output" + start + "_" + end + ".json";
64 | String variants = "test-data-output/variants" + start + "_" + end + ".txt";
65 | args = new String[] { "test-data/chr20.dose.vcf.gz", "--ref",
66 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--start", start + "", "--end", end + "",
67 | "--out", chunk, "--report-json", report, "--writeVariants", variants };
68 | result = new CommandLine(new ApplyScoreCommand()).execute(args);
69 | assertEquals(0, result);
70 |
71 | chunkFiles[count] = chunk;
72 | reportFiles[count] = report;
73 | variantFiles[count] = variants;
74 | count++;
75 | }
76 |
77 | args = new String[variantFiles.length + 2];
78 | for (int i = 0; i < variantFiles.length; i++) {
79 | args[i] = variantFiles[i];
80 | }
81 | args[variantFiles.length] = "--out";
82 | args[variantFiles.length + 1] = "test-data-output/variants.merged.txt";
83 |
84 | result = new CommandLine(new MergeVariantsCommand()).execute(args);
85 | assertEquals(0, result);
86 |
87 | // compare files (order difference of not included variants)
88 | ITableReader reader = new CsvTableReader("test-data-output/variants.txt", VariantFile.SEPARATOR);
89 | HashMap
variants = new HashMap();
90 | while (reader.next()) {
91 | int position = reader.getInteger(VariantFile.POSITION);
92 | int include = reader.getInteger(VariantFile.INCLUDE);
93 | variants.put(position, include);
94 | }
95 | reader.close();
96 |
97 | ITableReader reader2 = new CsvTableReader("test-data-output/variants.merged.txt", VariantFile.SEPARATOR);
98 | while (reader2.next()) {
99 | int position = reader2.getInteger(VariantFile.POSITION);
100 | Integer include = reader2.getInteger(VariantFile.INCLUDE);
101 | Integer expectIncluded = variants.get(position);
102 | assertNotNull(expectIncluded);
103 | assertEquals(expectIncluded, include);
104 | }
105 | reader2.close();
106 |
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/commands/ResolveScoreCommandTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.commands;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Before;
6 | import org.junit.BeforeClass;
7 | import org.junit.Test;
8 |
9 | import genepi.io.FileUtil;
10 | import genepi.io.table.reader.CsvTableReader;
11 | import genepi.io.table.reader.ITableReader;
12 | import genepi.riskscore.io.PGSCatalog;
13 | import lukfor.progress.TaskService;
14 | import picocli.CommandLine;
15 |
16 | public class ResolveScoreCommandTest {
17 |
18 | public static String DBSNP_INDEX = "test-data/dbsnp-index.small.txt.gz";
19 |
20 | public static final int EXPECTED_SAMPLES = 51;
21 |
22 | @BeforeClass
23 | public static void setup() {
24 | TaskService.setAnsiSupport(false);
25 | PGSCatalog.ENABLE_CACHE = false;
26 | }
27 |
28 | @Before
29 | public void beforeTest() {
30 | System.out.println("Clean up output directory");
31 | FileUtil.deleteDirectory("test-data-output");
32 | FileUtil.createDirectory("test-data-output");
33 | }
34 |
35 | @Test
36 | public void testCall() {
37 |
38 | String[] args = { "--in", "test-data/PGS000001.txt.gz", "--out", "test-data-output/PGS000001.converted.txt",
39 | "--dbsnp", DBSNP_INDEX };
40 | int result = new CommandLine(new ResolveScoreCommand()).execute(args);
41 | assertEquals(0, result);
42 |
43 | int variants = 0;
44 | ITableReader reader = new CsvTableReader("test-data-output/PGS000001.converted.txt", '\t');
45 | while (reader.next()) {
46 | variants++;
47 |
48 | }
49 | assertEquals(77, variants);
50 | reader.close();
51 | }
52 |
53 | @Test
54 | public void testResolveofPGSId() {
55 |
56 | String[] args = { "--in", "PGS000001", "--out", "test-data-output/PGS000001.converted.txt", "--dbsnp",
57 | DBSNP_INDEX };
58 | int result = new CommandLine(new ResolveScoreCommand()).execute(args);
59 | assertEquals(0, result);
60 |
61 | int variants = 0;
62 | ITableReader reader = new CsvTableReader("test-data-output/PGS000001.converted.txt", '\t');
63 | while (reader.next()) {
64 | variants++;
65 |
66 | }
67 | assertEquals(77, variants);
68 | reader.close();
69 | }
70 |
71 | @Test
72 | public void testResolveofFileWithPositions() {
73 |
74 | String[] args = { "--in", "test-data/PGS000957.txt.gz", "--out", "test-data-output/PGS000899.converted.txt", "--dbsnp",
75 | DBSNP_INDEX };
76 | int result = new CommandLine(new ResolveScoreCommand()).execute(args);
77 | assertEquals(0, result);
78 |
79 | int variants = 0;
80 | ITableReader reader = new CsvTableReader("test-data-output/PGS000899.converted.txt", '\t');
81 | while (reader.next()) {
82 | variants++;
83 |
84 | }
85 | assertEquals(11276, variants);
86 | reader.close();
87 | }
88 |
89 | @Test
90 | public void testResolveofFileWithPositionsAndChain() {
91 | String[] args = { "--in", "test-data/PGS000957.txt.gz", "--out", "test-data-output/PGS000899.converted.txt", "--dbsnp",
92 | DBSNP_INDEX, "--chain", "test-data/chains/hg19ToHg38.over.chain.gz" };
93 | int result = new CommandLine(new ResolveScoreCommand()).execute(args);
94 | assertEquals(0, result);
95 |
96 | int variants = 0;
97 | ITableReader reader = new CsvTableReader("test-data-output/PGS000899.converted.txt", '\t');
98 | while (reader.next()) {
99 | variants++;
100 |
101 | }
102 | assertEquals(11276, variants);
103 | reader.close();
104 | }
105 |
106 | @Test
107 | public void testResolvePRSWeb() {
108 | String[] args = { "--in", "test-data/PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608.txt", "--out", "test-data-output/PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608.hg38.txt", "--dbsnp",
109 | DBSNP_INDEX, "--chain", "test-data/chains/hg19ToHg38.over.chain.gz" };
110 | int result = new CommandLine(new ResolveScoreCommand()).execute(args);
111 | assertEquals(0, result);
112 | }
113 |
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/io/RiskScoreFileTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.io;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertNotNull;
5 | import static org.junit.Assert.assertNull;
6 |
7 | import org.junit.BeforeClass;
8 | import org.junit.Test;
9 |
10 | import genepi.riskscore.io.formats.RiskScoreFormatFactory.RiskScoreFormat;
11 |
12 | public class RiskScoreFileTest {
13 |
14 | public static String DBSNP_INDEX = "test-data/dbsnp-index.small.txt.gz";
15 |
16 | @BeforeClass
17 | public static void setup() {
18 | PGSCatalog.ENABLE_CACHE = false;
19 | }
20 |
21 | @Test
22 | public void testLoadTextFile() throws Exception {
23 | RiskScoreFile file = new RiskScoreFile("test-data/chr20.scores.csv", RiskScoreFormat.MAPPING_FILE, DBSNP_INDEX,
24 | null);
25 | file.buildIndex("20");
26 | assertEquals(4, file.getTotalVariants());
27 | assertNotNull(file.getVariant(61795));
28 | assertNull(file.getVariant(55));
29 | }
30 |
31 | @Test
32 | public void testLoadGZFile() throws Exception {
33 | RiskScoreFile file = new RiskScoreFile("test-data/chr20.scores.csv.gz", RiskScoreFormat.MAPPING_FILE,
34 | DBSNP_INDEX, null);
35 | file.buildIndex("20");
36 | assertEquals(4, file.getTotalVariants());
37 | assertNotNull(file.getVariant(61795));
38 | assertNull(file.getVariant(55));
39 | }
40 |
41 | @Test
42 | public void testGetName() throws Exception {
43 | assertEquals("PGS000027", RiskScoreFile.getName("PGS000027"));
44 | assertEquals("PGS000027", RiskScoreFile.getName("PGS000027.txt.gz"));
45 | assertEquals("PGS000027", RiskScoreFile.getName("PGS000027.txt"));
46 | assertEquals("PGS000027", RiskScoreFile.getName("folder/path/PGS000027.txt.gz"));
47 | assertEquals("PGS000027", RiskScoreFile.getName("folder/path/PGS000027.txt"));
48 | assertEquals("filename", RiskScoreFile.getName("folder/path/filename.txt.gz"));
49 | assertEquals("filename", RiskScoreFile.getName("folder/path/filename.txt"));
50 | assertEquals("filename", RiskScoreFile.getName("folder/path/filename.csv"));
51 | assertEquals("filename.weights", RiskScoreFile.getName("folder/path/filename.weights"));
52 | }
53 |
54 | @Test
55 | public void testLoadTextFileMissingAlleleInOtherChromosome() throws Exception {
56 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000899.txt.gz", DBSNP_INDEX, null);
57 | file.buildIndex("1");
58 | assertEquals(17, file.getLoadedVariants());
59 | assertEquals(176, file.getTotalVariants());
60 | }
61 |
62 | @Test
63 | public void testLoadTextFileMissingAllele() throws Exception {
64 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000899.txt.gz", DBSNP_INDEX, null);
65 | file.buildIndex("11");
66 | assertEquals(176, file.getTotalVariants());
67 | assertEquals(1, file.getIgnoredVariants());
68 | }
69 |
70 | @Test
71 | public void testLoadRsIdFormatFromPGSCatalog() throws Exception {
72 | RiskScoreFile file = new RiskScoreFile("PGS000001", DBSNP_INDEX, null);
73 | file.buildIndex("1");
74 | assertEquals(5, file.getLoadedVariants());
75 | assertEquals(77, file.getTotalVariants());
76 | }
77 |
78 | @Test
79 | public void testLoadRsIdFormatFromFile() throws Exception {
80 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000001.txt.gz", DBSNP_INDEX, null);
81 | file.buildIndex("1");
82 | assertEquals(5, file.getLoadedVariants());
83 | assertEquals(77, file.getTotalVariants());
84 | }
85 |
86 | @Test
87 | public void testLoadRsIdFormatV1AndV2() throws Exception {
88 |
89 | for (int i = 1; i <= 22; i++) {
90 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000957.txt.gz", DBSNP_INDEX, null);
91 | file.buildIndex(i + "");
92 | }
93 |
94 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000957.txt.gz", DBSNP_INDEX, null);
95 | file.buildIndex("6");
96 | assertEquals(11276, file.getTotalVariants());
97 | assertEquals(1, file.getIgnoredVariants());
98 |
99 | for (int i = 1; i <= 22; i++) {
100 | RiskScoreFile file2 = new RiskScoreFile("test-data/PGS000958.txt.gz", DBSNP_INDEX, null);
101 | file2.buildIndex(i + "");
102 | }
103 |
104 | RiskScoreFile file2 = new RiskScoreFile("test-data/PGS000958.txt.gz", DBSNP_INDEX, null);
105 | file2.buildIndex("6");
106 | assertEquals(9400, file2.getTotalVariants());
107 | assertEquals(1, file2.getIgnoredVariants());
108 |
109 | }
110 |
111 | @Test
112 | public void testLoadTextFileWithProxies() throws Exception {
113 | RiskScoreFile file = new RiskScoreFile("test-data/PGS000899.txt.gz", DBSNP_INDEX, null);
114 | file.buildIndex("1");
115 | assertEquals(17, file.getLoadedVariants());
116 | assertEquals(176, file.getTotalVariants());
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/io/dbsnp/DbSnpReaderTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.io.dbsnp;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.BeforeClass;
6 | import org.junit.Test;
7 |
8 | public class DbSnpReaderTest {
9 |
10 | public static String DBSNP_INDEX = "test-data/dbsnp-index.small.txt.gz";
11 |
12 | @BeforeClass
13 | public static void setup() {
14 |
15 | }
16 |
17 | @Test
18 | public void testGetContig() throws Exception {
19 | assertEquals("rs1000", DbSnpReader.getContig("rs1000140000", 3));
20 | assertEquals("rs100", DbSnpReader.getContig("rs1001300000", 3));
21 | assertEquals("rs00", DbSnpReader.getContig("rs001200000", 3));
22 | assertEquals("rs00", DbSnpReader.getContig("rs00120", 3));
23 | assertEquals("rs", DbSnpReader.getContig("rs10120", 3));
24 | }
25 |
26 | @Test
27 | public void testGetPosition() throws Exception {
28 | assertEquals(140000, DbSnpReader.getPosition("rs1000140000", 3));
29 | assertEquals(1300000, DbSnpReader.getPosition("rs1001300000", 3));
30 | assertEquals(1200000, DbSnpReader.getPosition("rs001200000", 3));
31 | assertEquals(120, DbSnpReader.getPosition("rs00120", 3));
32 | assertEquals(10120, DbSnpReader.getPosition("rs10120", 3));
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/io/proxy/ProxyReaderTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.io.proxy;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import java.io.IOException;
6 |
7 | import org.junit.BeforeClass;
8 | import org.junit.Test;
9 |
10 | import genepi.riskscore.io.proxy.ProxyReader.ProxySnp;
11 |
12 | public class ProxyReaderTest {
13 |
14 | public static String PROXY_INDEX = "test-data/lpa.snps.sorted.txt.gz";
15 |
16 | @BeforeClass
17 | public static void setup() {
18 |
19 | }
20 |
21 | @Test
22 | public void testGetProxiesForEntry() throws Exception {
23 | ProxyReader reader = new ProxyReader(PROXY_INDEX);
24 | ProxySnp[] proxies = reader.getByPosition("6", 160447669, "G", "A");
25 | assertEquals(3, proxies.length);
26 | reader.close();
27 | }
28 |
29 | @Test
30 | public void testGetProxiesForNonExistsingEntry() throws Exception {
31 | ProxyReader reader = new ProxyReader(PROXY_INDEX);
32 | ProxySnp[] proxies = reader.getByPosition("6", 123, "G", "A");
33 | assertEquals(0, proxies.length);
34 | reader.close();
35 | }
36 |
37 | @Test
38 | public void testGetProxiesForEntryWithWrongAlleles() throws Exception {
39 | ProxyReader reader = new ProxyReader(PROXY_INDEX);
40 | ProxySnp[] proxies = reader.getByPosition("6", 160447669, "G", "C");
41 | assertEquals(0, proxies.length);
42 | reader.close();
43 | }
44 |
45 | @Test
46 | public void testAlleleMapping() throws Exception {
47 | ProxyReader reader = new ProxyReader(PROXY_INDEX);
48 | ProxySnp[] proxies = reader.getByPosition("6", 160447669, "G", "A");
49 | assertEquals("A", proxies[0].mapAllele("G"));
50 | assertEquals("T", proxies[0].mapAllele("A"));
51 | assertEquals("C", proxies[1].mapAllele("G"));
52 | assertEquals("G", proxies[1].mapAllele("A"));
53 | assertEquals("G", proxies[2].mapAllele("G"));
54 | assertEquals("A", proxies[2].mapAllele("A"));
55 | reader.close();
56 | }
57 |
58 | @Test(expected = IOException.class)
59 | public void testWrongAlleleMapping() throws IOException {
60 | ProxyReader reader = new ProxyReader(PROXY_INDEX);
61 | ProxySnp[] proxies = reader.getByPosition("6", 160447669, "G", "A");
62 | proxies[0].mapAllele("C");
63 | reader.close();
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/tasks/CreateHtmlReportTaskTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.tasks;
2 |
3 | import org.junit.Before;
4 | import org.junit.BeforeClass;
5 | import org.junit.Test;
6 |
7 | import genepi.io.FileUtil;
8 | import genepi.riskscore.io.OutputFile;
9 | import genepi.riskscore.io.PGSCatalog;
10 | import genepi.riskscore.io.ReportFile;
11 | import lukfor.progress.TaskService;
12 | import lukfor.progress.tasks.monitors.TaskMonitorMock;
13 |
14 | public class CreateHtmlReportTaskTest {
15 |
16 | @BeforeClass
17 | public static void setup() {
18 | TaskService.setAnsiSupport(false);
19 | PGSCatalog.ENABLE_CACHE = false;
20 | }
21 |
22 | @Before
23 | public void beforeTest() {
24 | System.out.println("Clean up output directory");
25 | FileUtil.deleteDirectory("test-data-output");
26 | FileUtil.createDirectory("test-data-output");
27 | }
28 |
29 | @Test
30 | public void testReport() throws Exception {
31 |
32 | ReportFile report = ReportFile.loadFromFile("test-data/report.json");
33 | OutputFile data = new OutputFile("test-data/output.csv");
34 |
35 | CreateHtmlReportTask task = new CreateHtmlReportTask();
36 | task.setData(data);
37 | task.setReport(report);
38 | task.setOutput("test-data-output/report.html");
39 | task.run(new TaskMonitorMock());
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/tasks/MergeEffectsTaskTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.tasks;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import org.junit.Before;
6 | import org.junit.BeforeClass;
7 | import org.junit.Test;
8 |
9 | import genepi.io.FileUtil;
10 | import genepi.riskscore.commands.ApplyScoreCommand;
11 | import genepi.riskscore.io.PGSCatalog;
12 | import lukfor.progress.TaskService;
13 | import lukfor.progress.tasks.monitors.TaskMonitorMock;
14 | import picocli.CommandLine;
15 |
16 | public class MergeEffectsTaskTest {
17 |
18 | @BeforeClass
19 | public static void setup() {
20 | TaskService.setAnsiSupport(false);
21 | PGSCatalog.ENABLE_CACHE = false;
22 | }
23 |
24 | @Before
25 | public void beforeTest() {
26 | System.out.println("Clean up output directory");
27 | FileUtil.deleteDirectory("test-data-output");
28 | FileUtil.createDirectory("test-data-output");
29 | }
30 |
31 | @Test
32 | public void testMerge() throws Exception {
33 |
34 | MergeEffectsTask task = new MergeEffectsTask();
35 | task.setInputs("test-data/effects.chunk1.txt", "test-data/effects.chunk2.txt");
36 | task.setOutput("test-data-output/effects.task.txt");
37 | task.run(new TaskMonitorMock());
38 |
39 | assertEquals(FileUtil.readFileAsString("test-data/effects.expected.txt"),
40 | FileUtil.readFileAsString("test-data-output/effects.task.txt"));
41 | }
42 |
43 | @Test
44 | public void testMergingChunks() throws Exception {
45 |
46 | // Whole file
47 | String[] args = { "test-data/chr20.dose.vcf.gz", "--ref", "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--out", "test-data-output/output.csv",
48 | "--report-json", "test-data-output/report.json", "--writeEffects", "test-data-output/effects.txt" };
49 | int result = new CommandLine(new ApplyScoreCommand()).execute(args);
50 | assertEquals(0, result);
51 |
52 | // chunks
53 |
54 | int lengthChr20 = 64444167;
55 | int chunkSize = 10000000;
56 | int chunks = (lengthChr20 / chunkSize);
57 | if (lengthChr20 % chunkSize > 0) {
58 | chunks++;
59 | }
60 |
61 | String[] effectsFiles = new String[chunks];
62 | String[] chunkFiles = new String[chunks];
63 | String[] reportFiles = new String[chunks];
64 |
65 | int count = 0;
66 | for (int i = 1; i <= lengthChr20; i += chunkSize) {
67 | int start = i;
68 | int end = i + chunkSize - 1;
69 | String chunk = "test-data-output/output" + start + "_" + end + ".csv";
70 | String report = "test-data-output/output" + start + "_" + end + ".json";
71 | String effects = "test-data-output/effects" + start + "_" + end + ".txt";
72 | args = new String[] { "test-data/chr20.dose.vcf.gz", "--ref", "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--start", start + "",
73 | "--end", end + "", "--out", chunk, "--report-json", report, "--writeEffects", effects };
74 | result = new CommandLine(new ApplyScoreCommand()).execute(args);
75 | assertEquals(0, result);
76 |
77 | chunkFiles[count] = chunk;
78 | reportFiles[count] = report;
79 | effectsFiles[count] = effects;
80 | count++;
81 | }
82 |
83 | MergeEffectsTask task = new MergeEffectsTask();
84 | task.setInputs(effectsFiles);
85 | task.setOutput("test-data-output/effects.merged.txt");
86 | task.run(new TaskMonitorMock());
87 |
88 | assertEquals(FileUtil.readFileAsString("test-data-output/effects.txt"), FileUtil.readFileAsString("test-data-output/effects.merged.txt"));
89 |
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/src/test/java/genepi/riskscore/tasks/MergeVariantsTaskTest.java:
--------------------------------------------------------------------------------
1 | package genepi.riskscore.tasks;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertNotNull;
5 |
6 | import java.util.HashMap;
7 |
8 | import org.junit.Before;
9 | import org.junit.BeforeClass;
10 | import org.junit.Test;
11 |
12 | import genepi.io.FileUtil;
13 | import genepi.io.table.reader.CsvTableReader;
14 | import genepi.io.table.reader.ITableReader;
15 | import genepi.riskscore.commands.ApplyScoreCommand;
16 | import genepi.riskscore.io.PGSCatalog;
17 | import genepi.riskscore.io.VariantFile;
18 | import lukfor.progress.TaskService;
19 | import lukfor.progress.tasks.monitors.TaskMonitorMock;
20 | import picocli.CommandLine;
21 |
22 | public class MergeVariantsTaskTest {
23 |
24 | @BeforeClass
25 | public static void setup() {
26 | TaskService.setAnsiSupport(false);
27 | PGSCatalog.ENABLE_CACHE = false;
28 | }
29 |
30 | @Before
31 | public void beforeTest() {
32 | System.out.println("Clean up output directory");
33 | FileUtil.deleteDirectory("test-data-output");
34 | FileUtil.createDirectory("test-data-output");
35 | }
36 |
37 | @Test
38 | public void testMergingChunks() throws Exception {
39 |
40 | // Whole file
41 | String[] args = { "test-data/chr20.dose.vcf.gz", "--ref",
42 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--out", "test-data-output/output.csv",
43 | "--report-json", "test-data-output/report.json", "--writeVariants", "test-data-output/variants.txt" };
44 | int result = new CommandLine(new ApplyScoreCommand()).execute(args);
45 | assertEquals(0, result);
46 |
47 | // chunks
48 |
49 | int lengthChr20 = 64444167;
50 | int chunkSize = 10000000;
51 | int chunks = (lengthChr20 / chunkSize);
52 | if (lengthChr20 % chunkSize > 0) {
53 | chunks++;
54 | }
55 |
56 | String[] variantFiles = new String[chunks];
57 | String[] chunkFiles = new String[chunks];
58 | String[] reportFiles = new String[chunks];
59 |
60 | int count = 0;
61 | for (int i = 1; i <= lengthChr20; i += chunkSize) {
62 | int start = i;
63 | int end = i + chunkSize - 1;
64 | String chunk = "test-data-output/output" + start + "_" + end + ".csv";
65 | String report = "test-data-output/output" + start + "_" + end + ".json";
66 | String variants = "test-data-output/variants" + start + "_" + end + ".txt";
67 | args = new String[] { "test-data/chr20.dose.vcf.gz", "--ref",
68 | "test-data/PGS000957.txt.gz,test-data/PGS000958.txt.gz", "--start", start + "", "--end", end + "",
69 | "--out", chunk, "--report-json", report, "--writeVariants", variants };
70 | result = new CommandLine(new ApplyScoreCommand()).execute(args);
71 | assertEquals(0, result);
72 |
73 | chunkFiles[count] = chunk;
74 | reportFiles[count] = report;
75 | variantFiles[count] = variants;
76 | count++;
77 | }
78 |
79 | MergeVariantsTask task = new MergeVariantsTask();
80 | task.setInputs(variantFiles);
81 | task.setOutput("test-data-output/variants.merged.txt");
82 | task.run(new TaskMonitorMock());
83 |
84 | //compare files (order difference of not included variants)
85 | ITableReader reader = new CsvTableReader("test-data-output/variants.txt", VariantFile.SEPARATOR);
86 | HashMap variants = new HashMap();
87 | while(reader.next()) {
88 | int position = reader.getInteger(VariantFile.POSITION);
89 | int include = reader.getInteger(VariantFile.INCLUDE);
90 | variants.put(position, include);
91 | }
92 | reader.close();
93 |
94 |
95 | ITableReader reader2 = new CsvTableReader("test-data-output/variants.merged.txt", VariantFile.SEPARATOR);
96 | while(reader2.next()) {
97 | int position = reader2.getInteger(VariantFile.POSITION);
98 | Integer include = reader2.getInteger(VariantFile.INCLUDE);
99 | Integer expectIncluded = variants.get(position);
100 | assertNotNull(expectIncluded);
101 | assertEquals(expectIncluded, include);
102 | }
103 | reader2.close();
104 |
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/test-data/.gitignore:
--------------------------------------------------------------------------------
1 | /chr20.big.dose.vcf.gz
2 | /PGS000001.txt.gz.positions
3 |
--------------------------------------------------------------------------------
/test-data/PGS000001.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000001.txt.gz
--------------------------------------------------------------------------------
/test-data/PGS000018.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000018.txt.gz
--------------------------------------------------------------------------------
/test-data/PGS000781.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000781.txt.gz
--------------------------------------------------------------------------------
/test-data/PGS000899.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000899.txt.gz
--------------------------------------------------------------------------------
/test-data/PGS000957.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000957.txt.gz
--------------------------------------------------------------------------------
/test-data/PGS000958.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/PGS000958.txt.gz
--------------------------------------------------------------------------------
/test-data/PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608.txt:
--------------------------------------------------------------------------------
1 | ## PRSweb reference PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608
2 | ## PRSweb LD reference MGI
3 | ## PRSweb date 20200608
4 | ## GWAS source 30510241
5 | ## GWAS reference PUBMED
6 | ## GWAS phenotype Colorectal cancer
7 | ## GWAS id CRC_Huyghe
8 | ## GWAS URL https://www.nature.com/articles/s41588-018-0286-6#Sec35
9 | ## PRS method LD Clumping (MAF >= 1%, r^2 <= 0.1) & P-value thresholding (see tuning parameter)
10 | ## PRS tuning parameter 7.8e-06
11 | ## PRS evaluation in UKB
12 | ## Genome build GRCh37/hg19
13 | CHROM POS REF ALT EA OA PVALUE WEIGHT
14 | 1 38455891 G C G C 3.8e-09 0.0523
15 | 1 55246035 T C C T 3.3e-11 0.0665
16 | 1 183002639 A G A G 2.4e-16 0.073
17 | 1 222112634 A G G A 6.1e-16 0.0877
18 | 2 159964552 T C C T 4.4e-08 0.0511
19 | 2 199612407 T C C T 5e-09 0.0535
20 | 2 199781586 T C T C 3.7e-11 0.0627
21 | 2 219191256 T C T C 1.5e-11 0.0613
22 | 3 40915239 A G G A 1.2e-16 0.0994
23 | 3 66365163 G A A G 7.1e-08 0.0597
24 | 3 112999560 G A G A 1.4e-08 0.1761
25 | 3 133701119 G A A G 3.8e-09 0.0597
26 | 3 169517436 C T C T 7.8e-06 0.0453
27 | 4 94938618 C A A C 1.2e-08 0.052
28 | 4 106128760 G A A G 1.6e-08 0.0522
29 | 4 145659064 T C C T 2.9e-08 0.0842
30 | 5 1240204 C T T C 5.1e-09 0.1119
31 | 5 1296486 A G G A 1.4e-22 0.0865
32 | 5 40102443 G A A G 4.2e-09 0.0545
33 | 5 40280076 G A A G 9.3e-25 0.1013
34 | 5 134467220 C T C T 4.8e-15 0.0693
35 | 6 31449620 C T C T 1.8e-10 0.1118
36 | 6 32593080 A G G A 4.9e-14 0.0889
37 | 6 35569562 A G A G 3.6e-08 0.0778
38 | 6 36623379 G A A G 8.6e-08 0.054
39 | 6 55712124 C T C T 1.1e-11 0.0724
40 | 7 45136423 T C T C 4.7e-08 0.065
41 | 8 117630683 A C C A 7.3e-28 0.2099
42 | 8 128413305 G T G T 1.1e-15 0.1052
43 | 8 128571855 G T G T 1.8e-09 0.0608
44 | 9 22103183 G T G T 1.4e-08 0.0504
45 | 9 101679752 T G T G 3.1e-08 0.0818
46 | 9 113671403 T C C T 2.8e-09 0.0637
47 | 10 8739580 T A T A 1.3e-25 0.1064
48 | 10 52648454 C T C T 5e-10 0.073
49 | 10 80819132 A G G A 1.8e-17 0.0765
50 | 10 101351704 A G G A 1e-17 0.0889
51 | 10 114288619 T C C T 1.3e-11 0.0975
52 | 10 114722621 G A A G 7e-07 0.0527
53 | 11 61549025 G A G A 1.2e-11 0.0636
54 | 11 74280012 T G G T 8.9e-19 0.078
55 | 11 74427921 C T C T 3.7e-16 0.1934
56 | 11 101656397 T A T A 1.1e-09 0.0537
57 | 11 111156836 T C T C 1.9e-31 0.1122
58 | 12 4368607 T C C T 3.6e-14 0.089
59 | 12 4388271 C T T C 1.6e-15 0.1181
60 | 12 4400808 C T T C 2.4e-09 0.055
61 | 12 6421174 A T T A 4.1e-09 0.0597
62 | 12 43134191 A G G A 1.3e-09 0.053
63 | 12 51171090 A G G A 1.9e-23 0.0896
64 | 12 57533690 C A A C 9.4e-09 0.053
65 | 12 111973358 A G G A 2.6e-16 0.0737
66 | 12 115890922 T C C T 8.1e-14 0.066
67 | 13 34092164 C T C T 3.4e-07 0.0468
68 | 13 37462010 A G G A 6.3e-13 0.0758
69 | 13 73791554 T C C T 2.6e-08 0.0982
70 | 13 111075881 C T T C 1.8e-09 0.0549
71 | 14 54419106 A C C A 2.1e-23 0.0912
72 | 14 54445157 G A G A 3.1e-07 0.0465
73 | 14 59189361 G A G A 9.9e-07 0.0691
74 | 15 32992836 G A G A 1.1e-06 0.0464
75 | 15 33010736 G A A G 2.3e-29 0.1248
76 | 15 33156386 G A A G 1.5e-10 0.0705
77 | 15 67402824 T C C T 2.4e-13 0.0689
78 | 16 68743939 A C A C 3.1e-08 0.055
79 | 16 80043258 C A C A 2.1e-08 0.0498
80 | 16 86339315 T C T C 2.8e-08 0.0487
81 | 16 86703949 C T T C 6.6e-06 0.0481
82 | 17 809643 G A G A 6.8e-08 0.0514
83 | 17 10707241 G A A G 6.6e-12 0.0748
84 | 17 70413253 G A A G 5.6e-09 0.0595
85 | 18 46453156 A T A T 3.8e-74 0.1606
86 | 19 16417198 C T T C 4.2e-10 0.0868
87 | 19 33519927 T G T G 3.7e-23 0.1939
88 | 19 41871573 G A A G 9.5e-07 0.0441
89 | 19 59079096 C T T C 4.2e-08 0.0632
90 | 20 6376457 G C G C 1.1e-16 0.0795
91 | 20 6603622 C T C T 6.9e-12 0.0627
92 | 20 6699595 T G G T 2.3e-18 0.0819
93 | 20 6762221 C T T C 3.3e-14 0.0714
94 | 20 7740976 A G G A 3.4e-13 0.0874
95 | 20 33213196 A C C A 3e-07 0.045
96 | 20 42666475 C T T C 6.8e-09 0.0597
97 | 20 47340117 A G A G 5.9e-15 0.0719
98 | 20 49055318 C T C T 3.3e-09 0.0547
99 | 20 60932414 T C C T 1.1e-26 0.1146
100 | 20 62308612 T G T G 5.3e-08 0.0593
101 |
--------------------------------------------------------------------------------
/test-data/cancer-prsweb.tab:
--------------------------------------------------------------------------------
1 | id trait trait.type method ancestry_distribution trait.efo publication.doi publication.firstauthor publication.journal publication.date variants samples url.weights url.details repository
2 | PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608 Colorectal cancer LD Clumping (MAF >= 1%, r^2 <= 0.1) & P-value thresholding 87 https://prsweb.sph.umich.edu:8443/displayData/downloadFile?filename=PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608&type=weight https://prsweb.sph.umich.edu:8443/displayData/showGraphSep?prswebprefix=PRSWEB_PHECODE153_CRC-Huyghe_PT_UKB_20200608 Cancer-PRSweb
3 |
--------------------------------------------------------------------------------
/test-data/chains/hg19ToHg38.over.chain.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/chains/hg19ToHg38.over.chain.gz
--------------------------------------------------------------------------------
/test-data/chains/hg38ToHg19.over.chain.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/chains/hg38ToHg19.over.chain.gz
--------------------------------------------------------------------------------
/test-data/chr20.dose.vcf.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/chr20.dose.vcf.gz
--------------------------------------------------------------------------------
/test-data/chr20.scores.2.csv:
--------------------------------------------------------------------------------
1 | chr position_hg19 effect_weight A1 A2 effect_allele
2 | 20 222 1 G T G
3 | 20 61795 1 G T G
4 | 20 63231 1 T G T
5 | 20 63244 1 A C A
6 |
--------------------------------------------------------------------------------
/test-data/chr20.scores.2.csv.format:
--------------------------------------------------------------------------------
1 | {
2 | "chromosome": "chr",
3 | "position": "position_hg19",
4 | "effect_weight": "effect_weight",
5 | "allele_a": "A1",
6 | "allele_b": "A2",
7 | "effect_allele": "effect_allele"
8 | }
9 |
--------------------------------------------------------------------------------
/test-data/chr20.scores.2.flips.csv:
--------------------------------------------------------------------------------
1 | chr position_hg19 effect_weight A1 A2 effect_allele
2 | 20 222 1 G T G
3 | 20 61795 1 G A C
4 | 20 63231 1 T G T
5 | 20 63244 1 A C A
6 |
--------------------------------------------------------------------------------
/test-data/chr20.scores.csv:
--------------------------------------------------------------------------------
1 | chr position_hg19 effect_weight A2 effect_allele
2 | 20 222 1 T G
3 | 20 61795 1 G T
4 | 20 63231 1 G T
5 | 20 63244 1 C A
--------------------------------------------------------------------------------
/test-data/chr20.scores.csv.format:
--------------------------------------------------------------------------------
1 | {
2 | "chromosome": "chr",
3 | "position": "position_hg19",
4 | "effect_weight": "effect_weight",
5 | "allele_a": "A1",
6 | "allele_b": "A2",
7 | "effect_allele": "effect_allele"
8 | }
9 |
--------------------------------------------------------------------------------
/test-data/chr20.scores.csv.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/chr20.scores.csv.gz
--------------------------------------------------------------------------------
/test-data/chr20.scores.csv.gz.format:
--------------------------------------------------------------------------------
1 | {
2 | "chromosome": "chr",
3 | "position": "position_hg19",
4 | "effect_weight": "effect_weight",
5 | "allele_a": "A1",
6 | "allele_b": "A2",
7 | "effect_allele": "effect_allele"
8 | }
9 |
--------------------------------------------------------------------------------
/test-data/dbsnp-index.small.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/dbsnp-index.small.txt.gz
--------------------------------------------------------------------------------
/test-data/dbsnp-index.small.txt.gz.tbi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/dbsnp-index.small.txt.gz.tbi
--------------------------------------------------------------------------------
/test-data/effects.chunk1.txt:
--------------------------------------------------------------------------------
1 | "score","sample","chr_name","chr_position","effect"
2 | "chr20.scores","FB00000","20","61795","1.1260000467300415"
3 | "chr20.scores","FB00001","20","61795","0.24199999868869781"
4 | "chr20.scores","FB00002","20","61795","1.6699999570846558"
5 | "chr20.scores","FB00005","20","61795","0.12600000202655792"
6 | "chr20.scores","FB00006","20","61795","0.17800000309944153"
7 | "chr20.scores","FB00012","20","61795","1.0089999437332153"
8 | "chr20.scores","FB00015","20","61795","0.29899999499320984"
9 | "chr20.scores","FB00016","20","61795","0.02199999988079071"
10 | "chr20.scores","FB00017","20","61795","0.4189999997615814"
11 | "chr20.scores","FB00021","20","61795","0.1889999955892563"
--------------------------------------------------------------------------------
/test-data/effects.chunk2.txt:
--------------------------------------------------------------------------------
1 | "score","sample","chr_name","chr_position","effect"
2 | "chr20.scores","FB00022","20","61795","0.3190000057220459"
3 | "chr20.scores","FB00023","20","61795","0.14300000667572021"
4 | "chr20.scores","FB00025","20","61795","0.9419999718666077"
5 | "chr20.scores","FB00027","20","61795","0.125"
6 | "chr20.scores","FB00031","20","61795","0.1289999932050705"
7 | "chr20.scores","FB00032","20","61795","0.0"
8 | "chr20.scores","FB00034","20","61795","0.4259999990463257"
9 | "chr20.scores","FB00035","20","61795","0.0"
10 | "chr20.scores","FB00037","20","61795","0.3889999985694885"
11 | "chr20.scores","FB00038","20","61795","0.8420000076293945"
12 | "chr20.scores","FB00039","20","61795","0.847000002861023"
13 | "chr20.scores","FB00040","20","61795","0.9490000009536743"
14 | "chr20.scores","FB00041","20","61795","0.9190000295639038"
15 | "chr20.scores","FB00044","20","61795","1.7330000400543213"
16 | "chr20.scores","FB00049","20","61795","0.0"
--------------------------------------------------------------------------------
/test-data/effects.expected.txt:
--------------------------------------------------------------------------------
1 | "score","sample","chr_name","chr_position","effect"
2 | "chr20.scores","FB00000","20","61795","1.1260000467300415"
3 | "chr20.scores","FB00001","20","61795","0.24199999868869781"
4 | "chr20.scores","FB00002","20","61795","1.6699999570846558"
5 | "chr20.scores","FB00005","20","61795","0.12600000202655792"
6 | "chr20.scores","FB00006","20","61795","0.17800000309944153"
7 | "chr20.scores","FB00012","20","61795","1.0089999437332153"
8 | "chr20.scores","FB00015","20","61795","0.29899999499320984"
9 | "chr20.scores","FB00016","20","61795","0.02199999988079071"
10 | "chr20.scores","FB00017","20","61795","0.4189999997615814"
11 | "chr20.scores","FB00021","20","61795","0.1889999955892563"
12 | "chr20.scores","FB00022","20","61795","0.3190000057220459"
13 | "chr20.scores","FB00023","20","61795","0.14300000667572021"
14 | "chr20.scores","FB00025","20","61795","0.9419999718666077"
15 | "chr20.scores","FB00027","20","61795","0.125"
16 | "chr20.scores","FB00031","20","61795","0.1289999932050705"
17 | "chr20.scores","FB00032","20","61795","0.0"
18 | "chr20.scores","FB00034","20","61795","0.4259999990463257"
19 | "chr20.scores","FB00035","20","61795","0.0"
20 | "chr20.scores","FB00037","20","61795","0.3889999985694885"
21 | "chr20.scores","FB00038","20","61795","0.8420000076293945"
22 | "chr20.scores","FB00039","20","61795","0.847000002861023"
23 | "chr20.scores","FB00040","20","61795","0.9490000009536743"
24 | "chr20.scores","FB00041","20","61795","0.9190000295639038"
25 | "chr20.scores","FB00044","20","61795","1.7330000400543213"
26 | "chr20.scores","FB00049","20","61795","0.0"
27 |
--------------------------------------------------------------------------------
/test-data/lpa.snps.sorted.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/lpa.snps.sorted.txt.gz
--------------------------------------------------------------------------------
/test-data/lpa.snps.sorted.txt.gz.tbi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lukfor/pgs-calc/27fbf7f069e8fded26262094e87fe9d0c6ad6a16/test-data/lpa.snps.sorted.txt.gz.tbi
--------------------------------------------------------------------------------
/test-data/merged.expected.txt:
--------------------------------------------------------------------------------
1 | "sample","score_a","score_b","score_c"
2 | "s1","2.0","3.0","4.0"
3 | "s2","4.0","5.0","6.0"
4 | "s3","6.0","7.0","8.0"
5 | "s4","8.0","9.0","10.0"
6 |
--------------------------------------------------------------------------------
/test-data/output.csv:
--------------------------------------------------------------------------------
1 | "sample","PGS000028","PGS000027"
2 | "FB00000","0.0","-0.025961720261766616"
3 | "FB00001","0.0","-0.020048849751990602"
4 | "FB00002","0.0","-0.047861219584833053"
5 | "FB00005","0.0","-0.008517660085550688"
6 | "FB00006","0.0","-0.028507473051402193"
7 | "FB00012","0.0","-0.016976954977904673"
8 | "FB00015","0.0","-0.008052111183653513"
9 | "FB00016","0.0","-0.007338135556069167"
10 | "FB00017","0.0","-0.09373482723821873"
11 | "FB00021","0.0","-0.03711049969256221"
12 | "FB00022","0.0","-0.023994569098042408"
13 | "FB00023","0.0","-0.021595601391866344"
14 | "FB00025","0.0","-0.008552764278144297"
15 | "FB00027","0.0","-1.8872373326789694E-4"
16 | "FB00031","0.0","-0.05910201053019308"
17 | "FB00032","0.0","-0.014914756934823189"
18 | "FB00034","0.0","-0.032705220944274964"
19 | "FB00035","0.0","-0.038270390860924104"
20 | "FB00037","0.0","-0.019206329756164105"
21 | "FB00038","0.0","-0.015552917670511843"
22 | "FB00039","0.0","0.015619809712159358"
23 | "FB00040","0.0","-0.019048544919921133"
24 | "FB00041","0.0","-0.015143098711813456"
25 | "FB00044","0.0","0.004143125733792969"
26 | "FB00049","0.0","-0.032760009907617876"
27 | "FB00051","0.0","-0.0605292266138332"
28 | "FB00052","0.0","-0.02056019635589343"
29 | "FB00053","0.0","-0.03351202920832491"
30 | "FB00055","0.0","0.005149866284339126"
31 | "FB00056","0.0","0.005537618797143148"
32 | "FB00058","0.0","-0.005899067518679413"
33 | "FB00059","0.0","-0.008890280371722833"
34 | "FB00062","0.0","-0.015711549716511963"
35 | "FB00064","0.0","-0.009927149511591338"
36 | "FB00066","0.0","-0.047951933585074075"
37 | "FB00068","0.0","-0.026174471084150837"
38 | "FB00069","0.0","-0.0025529002573332453"
39 | "FB00071","0.0","-0.015713864439307727"
40 | "FB00072","0.0","-0.018945466763326656"
41 | "FB00074","0.0","-0.008088586143031005"
42 | "FB00075","0.0","0.010882239409677199"
43 | "FB00077","0.0","0.003243515570500382"
44 | "FB00078","0.0","-0.012670152497763123"
45 | "FB00082","0.0","-0.003975532682716764"
46 | "FB00086","0.0","-0.0032545626240586788"
47 | "FB00089","0.0","-0.03556566556392213"
48 | "FB00090","0.0","-0.02846534983234937"
49 | "FB00091","0.0","-0.02899517170631432"
50 | "FB00093","0.0","-0.011138847354749508"
51 | "FB00094","0.0","-0.02899212072805521"
52 | "FB00095","0.0","-0.01738372136863698"
53 |
--------------------------------------------------------------------------------
/test-data/pgs-catalog-small.json:
--------------------------------------------------------------------------------
1 | {
2 | "PGS000027": {
3 | "id": "PGS000027",
4 | "trait": "Body Mass Index",
5 | "populations": {
6 | "items": {
7 | "EUR": {
8 | "name": "EUR",
9 | "count": -1,
10 | "percentage": 0.991,
11 | "color": "#B5B5B5"
12 | },
13 | "AMR": {
14 | "name": "AMR",
15 | "count": -1,
16 | "percentage": 0.005,
17 | "color": "#B5B5B5"
18 | },
19 | "AFR": {
20 | "name": "AFR",
21 | "count": -1,
22 | "percentage": 0.004,
23 | "color": "#B5B5B5"
24 | }
25 | },
26 | "total": 238944
27 | },
28 | "variants": 2100302,
29 | "repository": "PGS-Catalog",
30 | "samples": 238944,
31 | "link": "https://www.pgscatalog.org/score/PGS000027"
32 | },
33 | "PGS000028": {
34 | "id": "PGS000028",
35 | "trait": "Breast cancer",
36 | "populations": {
37 | "items": {
38 | "EUR": {
39 | "name": "EUR",
40 | "count": -1,
41 | "percentage": 0.807,
42 | "color": "#B5B5B5"
43 | },
44 | "AMR": {
45 | "name": "AMR",
46 | "count": -1,
47 | "percentage": 0.033,
48 | "color": "#B5B5B5"
49 | },
50 | "EAS": {
51 | "name": "EAS",
52 | "count": -1,
53 | "percentage": 0.134,
54 | "color": "#B5B5B5"
55 | },
56 | "AFR": {
57 | "name": "AFR",
58 | "count": -1,
59 | "percentage": 0.025999999,
60 | "color": "#B5B5B5"
61 | }
62 | },
63 | "total": 144871
64 | },
65 | "variants": 83,
66 | "repository": "PGS-Catalog",
67 | "samples": 144871,
68 | "link": "https://www.pgscatalog.org/score/PGS000028"
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/test-data/pgs-ids.txt:
--------------------------------------------------------------------------------
1 | PGSID
2 | PGS000027
3 | PGS000028
--------------------------------------------------------------------------------
/test-data/report.json:
--------------------------------------------------------------------------------
1 | [{"name":"PGS000028","variants":86,"variantsUsed":0,"coverage":0.0,"variantsSwitched":0,"variantsMultiAllelic":0,"variantsAlleleMissmatch":0,"r2Filtered":0,"notFound":63480,"filtered":0,"coverageLabel":"zero"},{"name":"PGS000027","variants":2100302,"variantsUsed":52122,"coverage":0.024816431160852106,"variantsSwitched":25969,"variantsMultiAllelic":0,"variantsAlleleMissmatch":0,"r2Filtered":0,"notFound":11358,"filtered":0,"coverageLabel":"low"}]
--------------------------------------------------------------------------------
/test-data/samples-population.txt:
--------------------------------------------------------------------------------
1 | sample population
2 | LF001 EUR
3 | LF002 SAS
--------------------------------------------------------------------------------
/test-data/samples.txt:
--------------------------------------------------------------------------------
1 | sample
2 | LF002
--------------------------------------------------------------------------------
/test-data/scores.chunk1.txt:
--------------------------------------------------------------------------------
1 | sample,score_a,score_b,score_c
2 | s1,1,1,1
3 | s2,2,2,2
4 | s3,3,3,3
5 | s4,4,4,4
6 |
--------------------------------------------------------------------------------
/test-data/scores.chunk2.txt:
--------------------------------------------------------------------------------
1 | sample,score_a,score_b,score_c
2 | s1,1,2,3
3 | s2,2,3,4
4 | s3,3,4,5
5 | s4,4,5,6
6 |
--------------------------------------------------------------------------------
/test-data/single.hg38.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001
18 | chr20 61795 20:61795:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1
19 | chr20 63231 20:63231:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2
20 | chr20 63244 20:63244:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3
21 | chr20 63244 20:63244:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4
22 | chr20 6324422 20:6324422:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.285:10.0
23 |
--------------------------------------------------------------------------------
/test-data/single.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001
18 | 20 61795 20:61795:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1
19 | 20 63231 20:63231:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2
20 | 20 63244 20:63244:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3
21 | 20 63244 20:63244:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4
22 | 20 6324422 20:6324422:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.285:10.0
23 |
--------------------------------------------------------------------------------
/test-data/single.wrong_chr.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001
18 | 20 61795 20:61795:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1
19 | 20 63231 20:63231:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2
20 | 20 63244 20:63244:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3
21 | 20 63244 20:63244:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4
22 | 21 6324422 21:6324422:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.285:10.0
23 |
--------------------------------------------------------------------------------
/test-data/test.chr1.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001 LF002
18 | 1 1 1:1:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1 1|0:0.2
19 | 1 2 1:2:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2 1|0:0.4
20 | 1 3 1:3:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3 1|0:0.8
21 | 1 4 1:4:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4 1|0:1.6
22 | 1 5 1:5:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.1 1|0:0.1
23 |
--------------------------------------------------------------------------------
/test-data/test.chr2.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001 LF002
18 | 2 1 2:1:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1 1|0:0.2
19 | 2 2 2:2:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2 1|0:0.4
20 | 2 3 2:3:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3 1|0:0.8
21 | 2 4 2:4:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4 1|0:1.6
22 | 2 5 2:5:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.1 1|0:0.1
23 |
--------------------------------------------------------------------------------
/test-data/test.chr2.wrong.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001 LF002 LF003
18 | 2 1 2:1:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1 1|0:0.2 1|0:0.2
19 | 2 2 2:2:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2 1|0:0.4 1|0:0.4
20 | 2 3 2:3:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3 1|0:0.8 1|0:0.8
21 | 2 4 2:4:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4 1|0:1.6 1|0:1.6
22 | 2 5 2:5:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.1 1|0:0.1 1|0:1
23 |
--------------------------------------------------------------------------------
/test-data/test.scores.csv:
--------------------------------------------------------------------------------
1 | chr position_hg19 effect_weight A1 A2 effect_allele
2 | 1 1 1 G T G
3 | 1 2 1 T G T
4 | 1 3 1 A C A
5 | 1 4 1 A G A
6 | 2 1 5.0 G T G
7 | 2 2 5.0 T G T
8 | 2 3 5.0 A C A
9 | 3 1 10.0 A C A
10 | 3 2 10.0 A C A
11 | 3 3 10.0 A C A
12 | 3 4 10.0 A C A
13 |
--------------------------------------------------------------------------------
/test-data/test.scores.csv.format:
--------------------------------------------------------------------------------
1 | {
2 | "chromosome": "chr",
3 | "position": "position_hg19",
4 | "effect_weight": "effect_weight",
5 | "allele_a": "A1",
6 | "allele_b": "A2",
7 | "effect_allele": "effect_allele"
8 | }
9 |
--------------------------------------------------------------------------------
/test-data/test.scores2.csv:
--------------------------------------------------------------------------------
1 | chr position_hg19 effect_weight A1 A2 effect_allele
2 | 1 1 1 G T G
3 | 1 2 1 T G T
4 | 1 3 1 A C A
5 | 1 4 1 A G A
--------------------------------------------------------------------------------
/test-data/test.scores2.csv.format:
--------------------------------------------------------------------------------
1 | {
2 | "chromosome": "chr",
3 | "position": "position_hg19",
4 | "effect_weight": "effect_weight",
5 | "allele_a": "A1",
6 | "allele_b": "A2",
7 | "effect_allele": "effect_allele"
8 | }
9 |
--------------------------------------------------------------------------------
/test-data/two.vcf:
--------------------------------------------------------------------------------
1 | ##fileformat=VCFv4.1
2 | ##filedate=2020.3.13
3 | ##contig=
4 | ##pipeline=michigan-imputationserver-1.2.4
5 | ##imputation=minimac4-1.0.2
6 | ##phasing=eagle-2.4
7 | ##r2Filter=0.0
8 | ##INFO=
9 | ##INFO=
10 | ##INFO=
11 | ##INFO=
12 | ##INFO=
13 | ##INFO=
14 | ##INFO=
15 | ##FORMAT=
16 | ##FORMAT=
17 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT LF001 LF002
18 | 20 61795 20:61795:G:T G T . PASS AF=0.26318;MAF=0.26318;R2=0.54658;IMPUTED GT:DS 1|0:0.1 1|0:0.2
19 | 20 63231 20:63231:T:G T G . PASS AF=0.03843;MAF=0.03843;R2=0.67736;IMPUTED GT:DS 0|0:0.2 1|0:0.4
20 | 20 63244 20:63244:A:C A C . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.3 1|0:0.8
21 | 20 63244 20:63244:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.4 1|0:1
22 | 20 6324422 20:6324422:A:G A G . PASS AF=0.16132;MAF=0.16132;R2=0.49907;IMPUTED GT:DS 0|0:0.285:10.0 1|0:0.1
23 |
--------------------------------------------------------------------------------
/test-data/variants.txt:
--------------------------------------------------------------------------------
1 | "chr_name" "chr_position"
2 | "1" "1"
3 | "1" "2"
4 | "1" "3"
5 | "2" "1"
6 | "2" "2"
7 |
--------------------------------------------------------------------------------