Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-schultz committed Oct 21, 2022
1 parent 47a8e22 commit 116548b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
2 changes: 2 additions & 0 deletions hail/python/hail/docs/scans.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ along the genome:
+---------------+------------+-----------+---------------+
| locus<GRCh37> | array<str> | int64 | int64 |
+---------------+------------+-----------+---------------+
| 20:10579373 | ["C","T"] | 1 | 0 |
| 20:10579398 | ["C","T"] | 1 | 1 |
| 20:10627772 | ["C","T"] | 2 | 2 |
| 20:10633237 | ["G","A"] | 69 | 4 |
| 20:10636995 | ["C","T"] | 2 | 73 |
Expand Down
2 changes: 1 addition & 1 deletion hail/python/hail/expr/aggregators/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ def call_stats(call, alleles) -> StructExpression:
+---------------+--------------+---------------------+-------------+---------------------------+
| 20:10579373 | [199,1] | [9.95e-01,5.00e-03] | 200 | [99,0] |
| 20:10579398 | [198,2] | [9.90e-01,1.00e-02] | 200 | [99,1] |
| 20:10627772 | [198,2] | [9.90e-01,1.00e-02] | 200 | [98,0]
| 20:10627772 | [198,2] | [9.90e-01,1.00e-02] | 200 | [98,0] |
| 20:10633237 | [108,92] | [5.40e-01,4.60e-01] | 200 | [31,23] |
| 20:10636995 | [198,2] | [9.90e-01,1.00e-02] | 200 | [98,0] |
| 20:10639222 | [175,25] | [8.75e-01,1.25e-01] | 200 | [78,3] |
Expand Down
28 changes: 11 additions & 17 deletions hail/python/test/hail/experimental/test_annotation_db.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import unittest
import pytest

import hail as hl
from hail.backend.service_backend import ServiceBackend
from ..helpers import startTestHailContext, stopTestHailContext


class AnnotationDBTests(unittest.TestCase):
@classmethod
def setupAnnotationDBTests(cls):
startTestHailContext()
class TestAnnotationDB:
@pytest.fixture(scope="class")
def db_json(init_hail):
backend = hl.current_backend()
if isinstance(backend, ServiceBackend):
backend.batch_attributes = dict(name='setupAnnotationDBTests')
t = hl.utils.range_table(10)
t = t.key_by(locus=hl.locus('1', t.idx + 1))
t = t.annotate(annotation=hl.str(t.idx))
cls.tempdir_manager = hl.TemporaryDirectory()
d = cls.tempdir_manager.__enter__()
tempdir_manager = hl.TemporaryDirectory()
d = tempdir_manager.__enter__()
fname = d + '/f.mt'
t.write(fname)
if isinstance(backend, ServiceBackend):
backend.batch_attributes = dict()
cls.db_json = {
db_json = {
'unique_dataset': {
'description': 'now with unique rows!',
'url': 'https://example.com',
Expand All @@ -46,16 +44,12 @@ def setupAnnotationDBTests(cls):
}
}

@classmethod
def tearDownAnnotationDBTests(cls):
stopTestHailContext()
cls.tempdir_manager.__exit__(None, None, None)
yield db_json

setUpClass = setupAnnotationDBTests
tearDownClass = tearDownAnnotationDBTests
tempdir_manager.__exit__(None, None, None)

def test_uniqueness(self):
db = hl.experimental.DB(region='us', cloud='gcp', config=AnnotationDBTests.db_json)
def test_uniqueness(self, db_json):
db = hl.experimental.DB(region='us', cloud='gcp', config=db_json)
t = hl.utils.range_table(10)
t = t.key_by(locus=hl.locus('1', t.idx + 1))
t = db.annotate_rows_db(t, 'unique_dataset', 'nonunique_dataset')
Expand Down
4 changes: 3 additions & 1 deletion hail/python/test/hail/methods/test_statgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import hail.utils as utils
from hail.linalg import BlockMatrix
from hail.utils import FatalError
from hail.utils.java import choose_backend
from hail.utils.java import choose_backend, Env
from ..helpers import resource, fails_local_backend, fails_service_backend


Expand Down Expand Up @@ -1626,6 +1626,8 @@ def variance(expr):
test_stat(40, 400, 20, 12)

def test_balding_nichols_model_phased(self):
print(f'current static uid: {Env._static_rng_uid}')
print(f"rng_nonce: {hl._get_flags('rng_nonce')['rng_nonce']}")
bn_ds = hl.balding_nichols_model(1, 5, 5, phased=True)
assert bn_ds.aggregate_entries(hl.agg.all(bn_ds.GT.phased)) == True
actual = bn_ds.GT.collect()
Expand Down

0 comments on commit 116548b

Please sign in to comment.