Skip to content

Commit bbe02af

Browse files
authored
remove additional deprecated API calls (#755)
1 parent cb54609 commit bbe02af

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

libtiledbvcf/src/dataset/tiledbvcfdataset.cc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,9 @@ std::unordered_map<uint32_t, SafeBCFHdr> TileDBVCFDataset::fetch_vcf_headers(
12731273
do {
12741274
// Always reset buffer to avoid issue with core library and REST not using
12751275
// original buffer sizes
1276-
query.set_buffer("header", offsets, data);
1277-
query.set_buffer("sample", sample_data);
1276+
query.set_data_buffer("header", data);
1277+
query.set_offsets_buffer("header", offsets);
1278+
query.set_data_buffer("sample", sample_data);
12781279

12791280
status = query.submit();
12801281

@@ -1749,11 +1750,13 @@ void TileDBVCFDataset::write_vcf_headers_v4(
17491750

17501751
query.set_layout(TILEDB_UNORDERED);
17511752
auto offsets_and_data = ungroup_var_buffer(headers);
1752-
query.set_buffer("header", offsets_and_data);
1753+
query.set_data_buffer("header", offsets_and_data.second);
1754+
query.set_offsets_buffer("header", offsets_and_data.first);
17531755

17541756
auto sample_offsets_and_data = ungroup_var_buffer(samples);
17551757

1756-
query.set_buffer("sample", sample_offsets_and_data);
1758+
query.set_data_buffer("sample", sample_offsets_and_data.second);
1759+
query.set_offsets_buffer("sample", sample_offsets_and_data.first);
17571760
auto st = query.submit();
17581761
if (st != Query::Status::COMPLETE)
17591762
throw std::runtime_error(
@@ -1773,19 +1776,22 @@ void TileDBVCFDataset::write_vcf_headers_v2(
17731776

17741777
// Build data vector and subarray
17751778
std::vector<std::string> headers;
1776-
std::vector<uint32_t> subarray = {
1779+
Subarray subarray = Subarray(array.schema().context(), array);
1780+
std::pair<uint32_t, uint32_t> bounds = {
17771781
std::numeric_limits<uint32_t>::max(),
17781782
std::numeric_limits<uint32_t>::min()};
17791783
for (const auto& pair : vcf_headers) {
1780-
subarray[0] = std::min(subarray[0], pair.first);
1781-
subarray[1] = std::max(subarray[1], pair.first);
1784+
bounds.first = std::min(bounds.first, pair.first);
1785+
bounds.second = std::max(bounds.second, pair.first);
17821786
headers.push_back(pair.second);
17831787
}
1788+
subarray.add_range(0, bounds.first, bounds.second);
17841789

17851790
auto offsets_and_data = ungroup_var_buffer(headers);
17861791
query.set_layout(TILEDB_ROW_MAJOR)
17871792
.set_subarray(subarray)
1788-
.set_buffer("header", offsets_and_data);
1793+
.set_data_buffer("header", offsets_and_data.second)
1794+
.set_offsets_buffer("header", offsets_and_data.first);
17891795
auto st = query.submit();
17901796
if (st != Query::Status::COMPLETE)
17911797
throw std::runtime_error(
@@ -2138,7 +2144,10 @@ std::vector<std::string> TileDBVCFDataset::get_all_samples_from_vcf_headers()
21382144
auto non_empty_domain = vcf_header_array_->non_empty_domain_var(0);
21392145
if (non_empty_domain.first.empty() && non_empty_domain.second.empty())
21402146
return {};
2141-
query.add_range(0, non_empty_domain.first, non_empty_domain.second);
2147+
Subarray subarray =
2148+
Subarray(vcf_header_array_->schema().context(), *vcf_header_array_);
2149+
subarray.add_range(0, non_empty_domain.first, non_empty_domain.second);
2150+
query.set_subarray(subarray);
21422151
query.set_layout(TILEDB_ROW_MAJOR);
21432152

21442153
uint64_t sample_offset_element = 0;
@@ -2168,7 +2177,8 @@ std::vector<std::string> TileDBVCFDataset::get_all_samples_from_vcf_headers()
21682177
do {
21692178
// Always reset buffer to avoid issue with core library and REST not using
21702179
// original buffer sizes
2171-
query.set_buffer("sample", sample_offsets, sample_data);
2180+
query.set_data_buffer("sample", sample_data);
2181+
query.set_offsets_buffer("sample", sample_offsets);
21722182

21732183
status = query.submit();
21742184

0 commit comments

Comments
 (0)