@@ -516,16 +516,18 @@ py::object Reader::get_variant_stats_results() {
516516 auto an = BufferInfo::create (" an" , TILEDB_VCF_INT32 , num_rows);
517517 auto af = BufferInfo::create (" af" , TILEDB_VCF_FLOAT32 , num_rows);
518518
519- check_error (
520- reader,
521- tiledb_vcf_reader_read_from_variant_stats (
522- reader,
523- reinterpret_cast <uint32_t *>(pos->data ().data ()),
524- reinterpret_cast <char *>(allele->data ().data ()),
525- reinterpret_cast <int32_t *>(allele->offsets ().data ()),
526- reinterpret_cast <int *>(ac->data ().data ()),
527- reinterpret_cast <int *>(an->data ().data ()),
528- reinterpret_cast <float *>(af->data ().data ())));
519+ if (num_rows > 0 ) {
520+ check_error (
521+ reader,
522+ tiledb_vcf_reader_read_from_variant_stats (
523+ reader,
524+ reinterpret_cast <uint32_t *>(pos->data ().data ()),
525+ reinterpret_cast <char *>(allele->data ().data ()),
526+ reinterpret_cast <int32_t *>(allele->offsets ().data ()),
527+ reinterpret_cast <int *>(ac->data ().data ()),
528+ reinterpret_cast <int *>(an->data ().data ()),
529+ reinterpret_cast <float *>(af->data ().data ())));
530+ }
529531
530532 build_arrow_array_from_buffer (pos, num_rows, 0 , num_rows);
531533 build_arrow_array_from_buffer (allele, num_rows, 0 , alleles_size);
@@ -546,15 +548,16 @@ py::object Reader::get_allele_count_results() {
546548 reader,
547549 tiledb_vcf_reader_get_allele_count_buffer_sizes (
548550 reader, &num_rows, &refs_size, &alts_size, &filters_size, >s_size));
549- if (num_rows > 0 ) {
550- auto pos = BufferInfo::create (" pos" , TILEDB_VCF_INT32 , num_rows);
551- auto ref = BufferInfo::create (" ref" , TILEDB_VCF_CHAR , num_rows, refs_size);
552- auto alt = BufferInfo::create (" alt" , TILEDB_VCF_CHAR , num_rows, alts_size);
553- auto filter =
554- BufferInfo::create (" filter" , TILEDB_VCF_CHAR , num_rows, filters_size);
555- auto gt = BufferInfo::create (" gt" , TILEDB_VCF_CHAR , num_rows, gts_size);
556- auto count = BufferInfo::create (" count" , TILEDB_VCF_INT32 , num_rows);
557551
552+ auto pos = BufferInfo::create (" pos" , TILEDB_VCF_INT32 , num_rows);
553+ auto ref = BufferInfo::create (" ref" , TILEDB_VCF_CHAR , num_rows, refs_size);
554+ auto alt = BufferInfo::create (" alt" , TILEDB_VCF_CHAR , num_rows, alts_size);
555+ auto filter =
556+ BufferInfo::create (" filter" , TILEDB_VCF_CHAR , num_rows, filters_size);
557+ auto gt = BufferInfo::create (" gt" , TILEDB_VCF_CHAR , num_rows, gts_size);
558+ auto count = BufferInfo::create (" count" , TILEDB_VCF_INT32 , num_rows);
559+
560+ if (num_rows > 0 ) {
558561 check_error (
559562 reader,
560563 tiledb_vcf_reader_read_from_allele_count (
@@ -569,19 +572,18 @@ py::object Reader::get_allele_count_results() {
569572 reinterpret_cast <char *>(gt->data ().data ()),
570573 reinterpret_cast <uint32_t *>(gt->offsets ().data ()),
571574 reinterpret_cast <int32_t *>(count->data ().data ())));
572-
573- build_arrow_array_from_buffer (pos, num_rows, 0 , num_rows);
574- build_arrow_array_from_buffer (ref, num_rows, 0 , num_rows);
575- build_arrow_array_from_buffer (alt, num_rows, 0 , num_rows);
576- build_arrow_array_from_buffer (filter, num_rows, 0 , num_rows);
577- build_arrow_array_from_buffer (gt, num_rows, 0 , num_rows);
578- build_arrow_array_from_buffer (count, num_rows, 0 , num_rows);
579-
580- std::vector<std::shared_ptr<BufferInfo>> buffers = {
581- pos, ref, alt, filter, gt, count};
582- return buffers_to_table (buffers);
583575 }
584- return py::cast<py::none> Py_None;
576+
577+ build_arrow_array_from_buffer (pos, num_rows, 0 , num_rows);
578+ build_arrow_array_from_buffer (ref, num_rows, 0 , num_rows);
579+ build_arrow_array_from_buffer (alt, num_rows, 0 , num_rows);
580+ build_arrow_array_from_buffer (filter, num_rows, 0 , num_rows);
581+ build_arrow_array_from_buffer (gt, num_rows, 0 , num_rows);
582+ build_arrow_array_from_buffer (count, num_rows, 0 , num_rows);
583+
584+ std::vector<std::shared_ptr<BufferInfo>> buffers = {
585+ pos, ref, alt, filter, gt, count};
586+ return buffers_to_table (buffers);
585587}
586588
587589void Reader::deleter (tiledb_vcf_reader_t * r) {
0 commit comments