Skip to content

Commit

Permalink
Merge pull request #143 from TileDB-Inc/aw/ch2921/add-null-attr-array
Browse files Browse the repository at this point in the history
Add array and cli/py tests for querying records with null attributes
  • Loading branch information
aaronwolen authored Aug 12, 2020
2 parents 4e311a6 + 8a3bee4 commit 44f2891
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apis/python/tests/test_tiledbvcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def test_read_null_attrs(tmp_path):

ds = tiledbvcf.Dataset(uri, mode='r')
df = ds.read(attrs=['sample_name', 'pos_start', 'pos_end',
'info_BaseQRankSum', 'info_DP', 'fmt_DP'],
'info_BaseQRankSum', 'info_DP', 'fmt_DP', 'fmt_MIN_DP'],
regions=['1:12700-13400', '1:69500-69800'])
expected_df = pd.DataFrame(
{'sample_name': pd.Series(
Expand All @@ -372,7 +372,9 @@ def test_read_null_attrs(tmp_path):
np.array([89], dtype=np.int32), None,
np.array([24], dtype=np.int32), None, None]),
'fmt_DP': pd.Series([0, 0, 15, 64, 6, 2, 180,
88, 97, 24, 23, 21], dtype=np.int32)})
88, 97, 24, 23, 21], dtype=np.int32),
'fmt_MIN_DP': pd.Series([0, 0, 14, 30, 3, 1, 20,
None, 24, None, 23, 19])})
_check_dfs(expected_df, df)


Expand Down
13 changes: 13 additions & 0 deletions libtiledbvcf/test/run-cli-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function clean_up {
ingested_from_file ingested_diff_order ingested_buffered \
ingested_sep_indexes ingested_dupe_end_pos \
ingested_dupe_start_pos errored_dupe_start_pos \
ingested_null_attr \
ingested_capacity HG01762.vcf HG00280.vcf tmp.bed tmp1.vcf tmp2.vcf \
region-map.txt pfx.tsv
rm -rf "$upload_dir"
Expand Down Expand Up @@ -285,6 +286,18 @@ EOF
rm -f /tmp/pfx.tsv
rm -f HG00280.vcf HG01762.vcf region-map.txt $upload_dir/*

echo "Export records with a null fmt attribute (#142)"
create_register_ingest ingested_null_attr ${input_dir}/small3.bcf ${input_dir}/small.bcf
$tilevcf export -u ingested_null_attr -Ot -tPOS,S:MIN_DP -r1:69511-69512 -v -o pfx.tsv -d /tmp/ || exit 1
diff -wq /tmp/pfx.tsv <(
cat <<EOF
SAMPLE POS S:MIN_DP
HG00280 69511 .
HG00280 69512 24
EOF
) || exit 1
rm -f /tmp/pfx.tsv

echo "Export non-contiguous samples (#79)"
$tilevcf export -u ingested_3_samples -Ob -v -s G1,G3 || exit 1
rm -f G{1,3}.bcf
Expand Down

0 comments on commit 44f2891

Please sign in to comment.