Skip to content

Commit

Permalink
change contig alias
Browse files Browse the repository at this point in the history
  • Loading branch information
gspowley committed Dec 8, 2023
1 parent 5ae4b64 commit c48d6ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apis/python/tests/test_tiledbvcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ def test_bed_array(tmp_path, test_ds_v4):

# Add aliases to the array metadata
with tiledb.Array(bed_array, "w") as A:
A.meta["alias chrom"] = "chrom"
A.meta["alias contig"] = "chrom"
A.meta["alias start"] = "chromStart"
A.meta["alias end"] = "chromEnd"

Expand Down
6 changes: 3 additions & 3 deletions libtiledbvcf/src/vcf/region.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ void Region::read_bed_array(
std::shared_ptr<Array> bed_array, std::list<Region>& result) {
// Define the metadata keys for the BED array which contain the aliases
// for the column names
static const std::string CHROM = "alias chrom";
static const std::string CONTIG = "alias contig";
static const std::string START = "alias start";
static const std::string END = "alias end";

// Read the column name aliases from the array metadata
std::map<std::string, std::string> column_alias;
std::vector<std::string> column_names;

for (const auto& key : {CHROM, START, END}) {
for (const auto& key : {CONTIG, START, END}) {
const void* value = nullptr;
tiledb_datatype_t value_type;
uint32_t value_num = 0;
Expand All @@ -177,7 +177,7 @@ void Region::read_bed_array(
auto num_rows = mq.results()->num_rows();

for (unsigned int i = 0; i < num_rows; i++) {
auto chrom = std::string(mq.string_view(column_alias[CHROM], i));
auto chrom = std::string(mq.string_view(column_alias[CONTIG], i));
auto chromStart = mq.data<uint64_t>(column_alias[START])[i];
auto chromEnd = mq.data<uint64_t>(column_alias[END])[i];

Expand Down

0 comments on commit c48d6ed

Please sign in to comment.