Skip to content

Commit

Permalink
WIP: VCF loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jrm5100 committed Oct 16, 2020
1 parent 77a014c commit a5ba52f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion pandas_genomics/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
:toctree: io
from_plink
from_vcf
"""

from .plink import from_plink
from .vcf import from_vcf

__all__ = ['from_plink', ]
__all__ = ['from_plink', 'from_vcf']
19 changes: 14 additions & 5 deletions tests/io/conftest.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
from pathlib import Path

import cyvcf2
import pytest

from pandas_genomics import io

data_dir = Path(__file__).parent.parent / "data"
DATA_DIR = Path(__file__).parent.parent / "data"
VCF_DIR = Path(cyvcf2.__file__) / "tests"


@pytest.mark.slow
@pytest.fixture
def plink_small():
bed_file = data_dir / "plink" / "plink_test_small.bed"
bed_file = DATA_DIR / "plink" / "plink_test_small.bed"
result = io.from_plink(bed_file)
return result


@pytest.mark.slow
@pytest.fixture
def plink_medium():
bed_file = data_dir / "plink" / "plink_test_medium.bed"
bed_file = DATA_DIR / "plink" / "plink_test_medium.bed"
result = io.from_plink(bed_file)
return result


@pytest.fixture
def plink_small_20():
bed_file = data_dir / "plink" / "plink_test_small.bed"
bed_file = DATA_DIR / "plink" / "plink_test_small.bed"
result = io.from_plink(bed_file, max_variants=20)
return result


@pytest.fixture
def plink_small_20_swap():
bed_file = data_dir / "plink" / "plink_test_small.bed"
bed_file = DATA_DIR / "plink" / "plink_test_small.bed"
result = io.from_plink(bed_file, max_variants=20, swap_alleles=True)
return result

@pytest.fixture
def vcf_test():
vcf_filename = VCF_DIR / "test.vcf.gz"
result = io.from_vcf(vcf_filename)
return result
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/io/test_vcf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def test_loaded(vcf_test):
"""Validate the dataset"""
# TODO: Add more assertions
assert vcf_test.shape == (150, 3020)

0 comments on commit a5ba52f

Please sign in to comment.