-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use open_file_like
- Loading branch information
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pathlib | ||
from io import StringIO | ||
|
||
from vcztools.stats import nrecords | ||
|
||
from .utils import vcz_path_cache | ||
|
||
|
||
def test_nrecords(): | ||
original = pathlib.Path("tests/data/vcf") / "sample.vcf.gz" | ||
vcz = vcz_path_cache(original) | ||
|
||
output_str = StringIO() | ||
nrecords(vcz, output_str) | ||
assert output_str.getvalue() == "9\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import zarr | ||
|
||
from vcztools.utils import open_file_like | ||
|
||
|
||
def nrecords(vcz, output): | ||
root = zarr.open(vcz, mode="r") | ||
|
||
with open_file_like(output) as output: | ||
num_variants = root["variant_position"].shape[0] | ||
print(num_variants, file=output) |