ScilifelabDataCentre / genome-portal

This is the repository for the Swedish Reference Genome Portal, a service facilitating access and discovery of genome data of non-model eukaryotic species studied in Sweden
https://genomes.scilifelab.se/
MIT License
0 stars 0 forks source link

Test fixtures for GWAS plugin #43

Closed brinkdp closed 1 month ago

brinkdp commented 2 months ago

We have gotten confirmation that we will soon have new population genomics data incoming. I took this as encouragement to continue the investigation of the GWAS plugin started by @Kwentine in EB-56. Big thanks for the previous progress on this! I mostly just tweaked the config and prepared new test data.

EDIT: one week later, the data has now been made public. Findings from tests of a representative file from the dataset are presented in the next post below.


The initial commit include fixtures with BED-like data and an updated version of the EB-56 config. The result is a working Manhattan plot.

The dummy data is based on the structure of an incoming dataset I got to preview. Since that data is yet to be made public, the fixture data contains a randomized score column with a distribution based on the min-max values of the original file with some outliers sprinkled in for effect.

To test (inspired by PR37):

./scripts/dockermake --test SPECIES=gwas_testing_ground
./scripts/dockerserve --dev
cp tests/fixtures/gwas_testing_ground/gwas_randomized_dummy_data.txt.bgz* hugo/static/data
cp -r tests/data/gwas_testing_ground hugo/static/data

And then open: http://localhost:8080/genome-browser/?config=/data/gwas_testing_ground/config.json

Some observations:

Some things left to consider:

I put this a a draft PR for now because I anticipate that the incoming dataset might have additional data types that need to be tested.

brinkdp commented 2 months ago

The real data has now been made public. It is 16 new tracks each for the two Linum spp. So as an experiment, I've applied the findings from the initial commit of the PR to tests/configs/linum_popgen.

A main realization was that grep -v "^#" | had to be dropped from the filter script in order to preserve the header for the bgzipped file so that it can be properly called in tracks.adapter.scoreColumn in config.json. The omission of the grep operation should not affect header-less BEDs from what I can tell: testing with the BED in tests/fixtures/mito_krill was succesful.

The configs in f542970 are a hack to test that the new files work with the plugin. Since config.yml takes precedence over config.json upon running make, this experiment creates a redundant track named Placeholder_Lten_pop06_TD that only serves to handle downloading and indexing of the new data type via config.yml. The actual Manhattan plot track in the initial config is set to point to the resulting files (Lten_pop06_TD.bed.bgz and Lten_pop06_TD.bed.bgz.tbi) but uses a different trackId and name to avoid being overwritten by add-track. The final track has some quirks (see note below), but the outcome is nevertheless neat. I can recommend changing to "show all regions in assembly" in the view menu for a useful display.

With these findings, I would like to pass the baton to @kwentine to work out the details to best implement this in the back-end. Perhaps the schema for config.yml can be expanded to pass on "adapter": {"scoreColumn": "[HEADER_NAME]"}, {"displays":[{"displayId":"[FILENAME]_display","type":"LinearManhattanDisplay"}]}, and, for aestetical flair, "category": ["[TITLE]"] to the final config.json?


Note: The organelle scaffolds, such as the first scaffold (ENA|CAMGYJ010000001|CAMGYJ010000001.1) lack annotations for the new track. However, even with defaultSession configured to start on the chromosomal scaffold ENA|CAMGYJ010000002|CAMGYJ010000002.1, the Manhattan plot track does not render the data. Manually selecting a scaffold, (even re-initating ENA|CAMGYJ010000002|CAMGYJ010000002.1) will make it render, though. At the moment, I do know if this bug comes from the GWAS plugin, or the initial config. It could very well be the latter, since I did not notice this behavior in the test fixture of the initial commit.

Commands:

./scripts/dockerserve --dev
./scripts/dockermake --test
cp -r tests/data/linum_popgen hugo/static/data

http://localhost:8080/genome-browser/?config=%2Fdata%2Flinum_popgen%2Fconfig.json

kwentine commented 1 month ago

@brinkdp First of all I must say that I am impressed by your clever workarounds, and always very clear summary.

For complex configurations, such as the Manhattan plot, I think we should directly craft config.json, partly because the add-track CLI does not allow to specify adapter options such as scoreColumn. Other track-level advanced options could be passed to add-track as a JSON string, but if we are to write JSON I reckon we might as well edit config.json directly.

That being said, the backend should still prepare the data for tracks manually added to config.json So I propose that we add an optional skipAddTrack key to config.yaml that, when set to true, would instruct make build to generate track files as usual, but skip the add-track call.

What do you think ?

brinkdp commented 1 month ago

You raise good points; a skipAddTrack key in combination with manual crafting of config.json would be an easy way to proceed with this. Please go ahead with that idea!

There is indeed an elevated complexity in this config. This got me thinking about how to best transfer this knowledge to new staff members in the future, should the need arise. Some documentation or perhaps even helper scripts would be needed. I will ruminate on this.

kwentine commented 1 month ago

Great, I will go ahead an implement in one or more separate branches:

When all these are reviewed and merged, I will help you merge back the changes in this branch.

Does that sound good ? The alternative would be for me to implement everything in this very branch, but I fear it may mix too many concerns.

brinkdp commented 1 month ago

Great, sounds like a good plan!

kwentine commented 1 month ago

Work should be continued on the re-based branch gwas-test-continued (#53)