Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
2e37fea
files moved here from pipeline repo
bradwbradw Feb 13, 2026
d469119
test running cmd and import stmt upd8s
bradwbradw Feb 13, 2026
894df3c
vcf import can run in this repo now
bradwbradw Feb 13, 2026
c497449
variants transcripts . in None rows
bradwbradw Feb 13, 2026
b8eab51
Merge branch 'main' into vcf_import
bradwbradw Feb 22, 2026
a6059a8
use env vars for config
bradwbradw Feb 22, 2026
21c17e1
add vcf_import/output to gitignore
bradwbradw Feb 22, 2026
e9ff4ae
Remove ignored files
bradwbradw Feb 22, 2026
fbdbccf
check vcf and show warning if utf err
bradwbradw Feb 22, 2026
8cbfb8f
make hash calc optional
bradwbradw Feb 22, 2026
512a4a1
update deps
bradwbradw Feb 23, 2026
f084944
check encoding for non gz too
bradwbradw Feb 23, 2026
4149e33
convert to streams to save RAM
bradwbradw Feb 26, 2026
ab9a891
bigger default batch size for vcf import
bradwbradw Mar 2, 2026
c744544
fix tests for streaming change
bradwbradw Mar 2, 2026
a69a054
new params wip
bradwbradw Mar 3, 2026
155ae19
make settings into filter constructor param
bradwbradw Mar 3, 2026
7ffaba2
fix range, test for it
bradwbradw Mar 3, 2026
d2041d4
uupdate _publish to use streams
bradwbradw Mar 4, 2026
4d31520
make fail if 0 rows
bradwbradw Mar 4, 2026
5105f79
fix indents, deepcopy settings in test
bradwbradw Mar 4, 2026
36eabcf
fine tune chr, hypens behaviour
bradwbradw Mar 5, 2026
3996b00
more concise env option names
bradwbradw Mar 5, 2026
0249969
fix rename; log to logs/date.log
bradwbradw Mar 5, 2026
e607b25
reorder tests
bradwbradw Mar 5, 2026
d8a550c
update sample env val
bradwbradw Mar 5, 2026
ef8fc44
fix gzip import
bradwbradw Mar 7, 2026
ff39403
simplify test focusing; test f open retries
bradwbradw Mar 10, 2026
09054c5
wip file open retries
bradwbradw Mar 10, 2026
2dfe636
retrying done
bradwbradw Mar 10, 2026
4474904
udpate to chango 5.1.3
bradwbradw Apr 13, 2026
a1ed84a
git attributes
bradwbradw Apr 13, 2026
5addafd
Merge branch 'main' into vcf_import
bradwbradw Apr 13, 2026
53f8008
update reqs.lock
bradwbradw Apr 13, 2026
5b6b6d0
test for stream retry during vcf import
bradwbradw Apr 13, 2026
e914e69
removed pg history deps
bradwbradw Apr 24, 2026
9d12a00
config ref section in readme
bradwbradw Apr 27, 2026
9c31f9a
Merge branch 'vcf_import' into no-pg-history
bradwbradw Apr 27, 2026
58f6015
fix deps, locks after merge
bradwbradw Apr 27, 2026
c71dc5e
refactor: move VCF filters to management, add import_bvl_vcf command
Copilot Apr 27, 2026
d9163bd
fix: address code review issues (list shadow, unused import, debug co…
Copilot Apr 27, 2026
777e890
add numpy for vcf import; tweak logging
bradwbradw May 1, 2026
08afa20
Merge branch 'vcf_import' into copilot/refactor-import-bvl-vcf
bradwbradw May 1, 2026
2028994
feat: --convert-to-tsv writes TSVs instead of importing into the data…
Copilot May 1, 2026
0c40e30
feat: group repeated errors and add --log-all-errors flag
Copilot May 1, 2026
f62c884
Reset auto-increment sequence after delete in Importer.import_data
Copilot May 1, 2026
de59e06
clean up logs
bradwbradw May 5, 2026
29b4f3c
Loosen error/warning grouping, apply grouping to warnings, lower defa…
Copilot May 5, 2026
3ff130d
Merge branch 'copilot/refactor-import-bvl-vcf' of github.com:wasserma…
bradwbradw May 6, 2026
f3bf4b9
Replace text-regex error grouping with ImportCode enum and ImportMess…
Copilot May 6, 2026
dbd4619
Fix stale --log-all-errors help text (40 → 10)
Copilot May 6, 2026
79e6912
Merge branch 'copilot/refactor-import-bvl-vcf' of github.com:wasserma…
bradwbradw May 6, 2026
d25f1df
update launch config for debugging vcf import
bradwbradw May 6, 2026
61516bb
refactor: move test files into variome_backend/tests, add run_backend…
Copilot May 6, 2026
f29003c
fix: update stale module path references in test_vcf_filters.py docst…
Copilot May 6, 2026
1121f9d
fix severities, reusing tsv import cmd
bradwbradw May 6, 2026
b77dbdf
fix: SQLite fallback for tests, restore severity_map loading, fix INP…
Copilot May 6, 2026
01d14e5
fix: add warning log for missing INPUT_TSV_PATH, add set -euo pipefai…
Copilot May 6, 2026
907802c
feat: add per-table duration logging to import_bvl.py and import_bvl_…
Copilot May 6, 2026
ebf7b76
fix: move OPTIONS inside default DB config; set connect_timeout=10 to…
Copilot May 6, 2026
8fc746a
fix: only apply connect_timeout OPTIONS for PostgreSQL backends
Copilot May 6, 2026
adffd8d
edit launch.json
bradwbradw May 7, 2026
c9077cc
add severity import from a tsv file
bradwbradw May 7, 2026
2f07796
move severity map into var_consequences filter
bradwbradw May 7, 2026
97c30cd
fix test run sh
bradwbradw May 7, 2026
67a671f
test fixes
bradwbradw May 7, 2026
c52f276
Refactor VCF import modules and move fixtures to tests
Copilot May 7, 2026
22939ba
Merge pull request #52 from wassermanlab/copilot/refactor-import-bvl-vcf
bradwbradw May 7, 2026
796749d
SQLite fallback; readme tweak
bradwbradw May 11, 2026
696aac9
update public user email
bradwbradw May 11, 2026
c3aec1e
create indeces management command
bradwbradw May 11, 2026
655fea8
Merge branch 'vcf_import' of github.com:wassermanlab/variome into vcf…
bradwbradw May 12, 2026
896f0d5
Merge branch 'main' into vcf_import
bradwbradw May 12, 2026
73d7d35
update reqs.lock
bradwbradw May 12, 2026
78895ff
Merge branch 'main' into vcf_import
bradwbradw May 14, 2026
4ec7480
cleanup
bradwbradw Jun 2, 2026
bfb1559
Merge branch 'main' into vcf_import
bradwbradw Jun 2, 2026
7effa06
.lock files
bradwbradw Jun 2, 2026
da09854
fix date in tracking dashboard
bradwbradw Jun 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,33 @@ FRONTEND_PORT=3000
#BACKEND_ROOT=http://localhost:8888 # use if running django on a different port


####### VCF IMPORT SETTINGS (WIP) #######

VCF_FILE=/Users/username/path/to/joint/file.vcf

# you can compare to a previous set of TSV output files and show hash differences per file
#HASH_COMPARE=/Users/username/path/to/tsv_files


## VARIOME joint vcf format example settings ##

# include only these ranges per chromosome (eg: 22:27010000-27020000,X:2702000-2802000)
RANGES=
# whether to keep 'chr' prefix in chromosome names
OUT_CHR=True
# whether to use hyphen '-' in variant IDs instead of underscores '_'
OUT_HYPHENS=True

# CADD phred score threshold (if greater than or equal to this number, counts as "damaging")
CADD_DAMAGING_THRESHOLD=20
# fallback None value filler
NA=.
# Default transcript source if unknown (E = Ensembl, R = Refseq)
DEFAULT_TRANSCRIPT_SOURCE=E
# Path to dir containing severity table file
INPUT_TSV_PATH=data/fixtures


## IBVL joint vcf format example settings ##

#CADD_DAMAGING_THRESHOLD=15 # verify ?
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ data/backups/*

# because it depends on OS and is generated dynamically
package-lock.json

vcf_import/output
241 changes: 142 additions & 99 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,100 +1,143 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug mange.py import_bvl ",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast"
],
"django": true

},
{
"name": "Debug mange.py import_bvl (delete first)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast",
"--delete"
],
"django": true

},
{
"name": "Debug mange.py import_bvl (update consequences only)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast",
"--no-severities",
"--no-genes",
"--no-variants",
"--no-transcripts",
"--no-snvs",
"--no-gvfs",
"--no-ggfs",
"--no-annotations",
"--no-vts",
"--no-progress"
],
"django": true

},
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"args": [
"runserver"
],
"django": true,
"autoStartBrowser": false,
"program": "${workspaceFolder}/manage.py"
}
,{
"name": "debug migrate",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate"
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}"
},
{
"name": "debug a migration",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate",
"library_access",
"0002_migrate_pghistory_to_auditlog"
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}"
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "import_bvl TSV ",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast",
"--no-progress"
],
"django": true
},
{
"name": "import_bvl TSV (delete first)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast",
"--no-progress",
"--delete"
],
"django": true
},
{
"name": "import_bvl TSV (update consequences only)",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl",
"--failfast",
"--no-severities",
"--no-genes",
"--no-variants",
"--no-transcripts",
"--no-snvs",
"--no-gvfs",
"--no-ggfs",
"--no-annotations",
"--no-vts",
"--no-progress"
],
"django": true
},
{
"name": "Import VCF (delete first)",
"type": "python",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl_vcf",
"--vcf",
"data/fixtures/vcf/variome.vcf",
"--delete",
"--no-progress"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
},
{
"name": "Import VCF",
"type": "python",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"import_bvl_vcf",
"--vcf",
"data/fixtures/vcf/variome.vcf",
"--no-progress"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
},
{
"name": "Debug vcf import tests",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"-s",
"--log-cli-level=DEBUG",
"vcf_import/VCF_test.py"
],
"console": "integratedTerminal",
"justMyCode": false,
},
{
"name": "Python Debugger: Django",
"type": "debugpy",
"request": "launch",
"args": [
"runserver"
],
"django": true,
"autoStartBrowser": false,
"program": "${workspaceFolder}/manage.py"
},
{
"name": "debug migrate",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate"
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}"
},
{
"name": "debug a migration",
"type": "debugpy",
"request": "launch",
"python": "${workspaceFolder}/.venv/bin/python",
"program": "${workspaceFolder}/manage.py",
"args": [
"migrate",
"library_access",
"0002_migrate_pghistory_to_auditlog"
],
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}"
}
]
}
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,94 @@ Markdown format files in the /content folder are treated as full pages, availabl

Markdown format files in /content/Home are individual, "hard-coded" page elements on the Home page, so you shouldn't add more or rename these.

### config reference
PUBLIC_BVL - opens the database for public access, as a demonstration app. For this to work, a shared user account must also be created ( username: `public_demo_user`, email: `public_demo_user@example.com` )


# Importing from a VCF file

Use the `import_bvl_vcf` management command to import data directly from a VCF file into the database.

Mitochondrial tables are omitted because these are not part of the currently used VCF reference files.

## Quickstart

```
python manage.py import_bvl_vcf --vcf /path/to/joint.vcf
python manage.py create_indices
```

Run `python manage.py import_bvl_vcf --help` for a full list of options.

## Key options

| Option | Default | Description |
|--------|---------|-------------|
| `--vcf` | *(required)* | Path to the input VCF file (plain text or `.gz`) |
| `--input-tsv-dir` | `data/fixtures` | Path to the dir containing severities.tsv |
| `--na` | `.` | Value used to represent missing/null data |
| `--out-chr` | enabled | Prefix chromosome names with `chr` |
| `--out-hyphens` | enabled | Use hyphens in variant IDs (e.g. `1-100-A-G`) if false, uses underscores instead |
| `--cadd-threshold` | `20` | cadd_intr will be classified as "Damaging" if cadd_score is greater than or equal to this number |
| `--default-transcript-source` | `E` | Fallback transcript source when unknown (`E`=Ensembl, `R`=RefSeq) |
| `--ranges` | *(all)* | Restrict processing to specific regions, e.g. `22:27010000-27020000,X:2702000-2802000` |
| `--convert-to-tsv` | disabled | Write TSV files instead of importing into the database |
| `--tsv-output-dir` | `data/vcf_output` | Directory for TSV output (requires `--convert-to-tsv`) |
| `--hash-compare` | *(none)* | Directory of an existing TSV set to compare output hashes against (requires `--convert-to-tsv`) |
| `--dry-run` / `-n` | disabled | Parse and validate without writing to the database |
| `--delete` | disabled | Delete all existing data before importing |
| `--no-genes`, `--no-variants`, etc. | *(all enabled)* | Skip specific tables |

## Comparing output against a reference TSV set

When `--convert-to-tsv` is active, pass `--hash-compare` to verify that the generated TSV files
match a previously known-good set ( this is useful for development of this project, ensuring consistency with legacy tsv-producting tools):

```
python manage.py import_bvl_vcf \
--vcf /path/to/joint.vcf \
--convert-to-tsv \
--tsv-output-dir data/vcf_output \
--hash-compare data/reference_tsvs
```

Per-file hash differences are reported in the log output.

## Running backend tests

All backend tests (middleware and VCF import filters) live in `variome_backend/tests/`.

First, install dev dependencies:

```
uv sync --dev
```

Run all backend tests once:

```
DB= uv run python manage.py test variome_backend.tests --verbosity=2
```

Tests run against an in-memory SQLite database (no Postgres connection needed). If the `DB` environment variable is set in your shell, prefix the command with `DB=` to clear it for the test run, or simply use the watch script below which handles this automatically.

Run all backend tests and automatically re-run whenever a `.py` file changes (recommended during development):

```
bash run_backend_tests.sh
```

Or inline, without the script:

```
uv run watchmedo shell-command \
--patterns="*.py" \
--recursive \
--drop \
--command='uv run python manage.py test variome_backend.tests --verbosity=2' \
.
```

### attributions

example DNA image: https://commons.wikimedia.org/wiki/File:202104_Laboratory_instrument_dna.svg
Loading