Skip to content

Conversation

@AdityaPandeyCN
Copy link

@AdityaPandeyCN AdityaPandeyCN commented Nov 16, 2025

This PR addresses:-

  • RNTuple region query: columnar views (flag/refid/pos), zero-based ranges, CIGAR-span overlap, indexed start, early breaks and skip heuristic. Counts now match samtools; large-region throughput improved significantly.
  • TTree ramview: fixed 1-/0-based mismatch, added FLAG filter (0x904), refid gating, and early termination. Correct counts across regions.
  • Converter/index: index mapped reads only; hybrid sparse index (chromosome start, every 10kb, every 100 mapped reads). Reduced noisy output.
  • Chromosome split filter: support -split -only (repeatable) to emit specific chromosomes; wired into samtoramntuple_split_by_chromosome.
  • Benchmarks/docs: updated region suite and README with RNTuple vs. CRAM comparisons; explain why CRAM is faster on tiny windows and why RNTuple wins on broad regions.

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
@AdityaPandeyCN AdityaPandeyCN marked this pull request as draft November 16, 2025 06:26
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 24. Check the log or trigger a new build to see more.

@@ -1,6 +1,6 @@
#include <benchmark/benchmark.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'benchmark/benchmark.h' file not found [clang-diagnostic-error]

#include <benchmark/benchmark.h>
         ^

"chr21:1-48129895",
"chrM:1-16571",
"chrY:2600000-2700000",
const std::vector<std::string> RegionQueryFixture::regions_ = {"1:1000000-1001000",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: invalid case style for variable 'regions_' [readability-identifier-naming]

Suggested change
const std::vector<std::string> RegionQueryFixture::regions_ = {"1:1000000-1001000",
const std::vector<std::string> RegionQueryFixture::regions = {"1:1000000-1001000",

BENCHMARK_REGISTER_F(RegionQueryFixture, TTree)->Args({0})->Args({3})->Args({6})->Args({9})->Unit(benchmark::kSecond);

BENCHMARK_REGISTER_F(RegionQueryFixture, RNTuple)->Args({0})->Args({3})->Args({6})->Args({9})->Unit(benchmark::kSecond);
BENCHMARK_REGISTER_F(RegionQueryFixture, TTree)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'BENCHMARK_REGISTER_F' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
BENCHMARK_REGISTER_F(RegionQueryFixture, TTree)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);
BENCHMARK_REGISTER_Fstatic (RegionQueryFixture, TTree)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);


BENCHMARK_REGISTER_F(RegionQueryFixture, RNTuple)->Args({0})->Args({3})->Args({6})->Args({9})->Unit(benchmark::kSecond);
BENCHMARK_REGISTER_F(RegionQueryFixture, TTree)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);
BENCHMARK_REGISTER_F(RegionQueryFixture, RNTuple)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'BENCHMARK_REGISTER_F' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
BENCHMARK_REGISTER_F(RegionQueryFixture, RNTuple)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);
BENCHMARK_REGISTER_Fstatic (RegionQueryFixture, RNTuple)->DenseRange(0, 17, 1)->Unit(benchmark::kSecond);

#ifndef RAMCORE_SAMTONTUPLE_H
#define RAMCORE_SAMTONTUPLE_H

#include <cstdint>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'cstdint' file not found [clang-diagnostic-error]

#include <cstdint>
         ^

void samtoramntuple_split_by_chromosome(const char *datafile, const char *output_prefix, int compression_algorithm,
uint32_t quality_policy, int num_threads = 4);
uint32_t quality_policy, int num_threads = 4,
const std::vector<std::string> &only_chromosomes = {});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 6 is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]

Suggested change
const std::vector<std::string> &only_chromosomes = {});
std::vector<std::string> &only_chromosomes = {});

@@ -1,6 +1,7 @@
#include "ramcore/RAMNTupleView.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ramcore/RAMNTupleView.h' file not found [clang-diagnostic-error]

#include "ramcore/RAMNTupleView.h"
         ^

#include <iostream>
#include <cstring>
#include <limits>
#include <ROOT/RNTuple.hxx>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header limits is not used directly [misc-include-cleaner]

Suggested change
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTuple.hxx>

int rangeDelimiterPos = region.find("-", chrDelimiterPos);
if (rangeDelimiterPos == std::string::npos) {
try {
range_start = std::stoi(region.substr(chrDelimiterPos + 1));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::stoi" is directly included [misc-include-cleaner]

            range_start = std::stoi(region.substr(chrDelimiterPos + 1));
                               ^


auto recordView = reader->GetView<RAMNTupleRecord>("record");
auto flagView = reader->GetView<uint16_t>("record.flag");
auto refidView = reader->GetView<int32_t>("record.refid");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "int32_t" is directly included [misc-include-cleaner]

src/ramcore/RAMNTupleView.cxx:1:

- #include <iostream>
+ #include <cstdint>
+ #include <iostream>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 17. Check the log or trigger a new build to see more.

@@ -1,6 +1,9 @@
#include "ramcore/RAMNTupleView.h"
#include <cstdint>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

#include <cstdint>
^

this fix will not be applied because it overlaps with another fix


stopwatch.Print();

printf("Found %lld records in region %s\n", static_cast<long long>(count), query ? query : "");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]

   printf("Found %lld records in region %s\n", static_cast<long long>(count), query ? query : "");
   ^

#include <mutex>
#include <algorithm>
#include <unordered_set>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header unordered_set is not used directly [misc-include-cleaner]

Suggested change


auto rootFile = std::unique_ptr<TFile>(TFile::Open(treefile, "RECREATE"));
if (!rootFile || !rootFile->IsOpen()) {
printf("Failed to create RAM file %s\n", treefile);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]

      printf("Failed to create RAM file %s\n", treefile);
      ^

ramcore::SamParser parser;


int64_t mapped_count = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "int64_t" is directly included [misc-include-cleaner]

    int64_t mapped_count = 0;
    ^



int64_t mapped_count = 0;
int32_t last_refid = -2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "int32_t" is directly included [misc-include-cleaner]

    int32_t last_refid = -2;
    ^

#include <filesystem>
#include <Rtypes.h>
#include <regex>
#include "../tools/ramview.cxx"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header regex is not used directly [misc-include-cleaner]

Suggested change
#include "../tools/ramview.cxx"
#include "../tools/ramview.cxx"

#include <filesystem>
#include <Rtypes.h>
#include <regex>
#include "../tools/ramview.cxx"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: suspicious #include of file with '.cxx' extension [bugprone-suspicious-include]

#include "../tools/ramview.cxx"
          ^


testing::internal::GetCapturedStdout();
testing::internal::CaptureStdout();
ramview(ttreeFile, region, true, false, nullptr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: argument comment missing for literal argument 'cache' [bugprone-argument-comment]

Suggested change
ramview(ttreeFile, region, true, false, nullptr);
ramview(ttreeFile, region, /*cache=*/true, false, nullptr);


testing::internal::GetCapturedStdout();
testing::internal::CaptureStdout();
ramview(ttreeFile, region, true, false, nullptr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: argument comment missing for literal argument 'perfstats' [bugprone-argument-comment]

Suggested change
ramview(ttreeFile, region, true, false, nullptr);
ramview(ttreeFile, region, true, /*perfstats=*/false, nullptr);

@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 42.85714% with 176 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@9028ee7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/ramcore/RAMNTupleView.cxx 25.80% 60 Missing and 9 partials ⚠️
tools/samtoramntuple.cxx 0.00% 50 Missing ⚠️
src/rntuple/RAMNTupleRecord.cxx 0.00% 22 Missing ⚠️
src/ramcore/SamToNTuple.cxx 83.75% 6 Missing and 7 partials ⚠️
tools/ramview.cxx 58.62% 6 Missing and 6 partials ⚠️
test/ramcoretests.cxx 70.58% 1 Missing and 9 partials ⚠️

❌ Your patch status has failed because the patch coverage (42.85%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop      #13   +/-   ##
==========================================
  Coverage           ?   53.19%           
==========================================
  Files              ?       16           
  Lines              ?     1442           
  Branches           ?      737           
==========================================
  Hits               ?      767           
  Misses             ?      551           
  Partials           ?      124           
Flag Coverage Δ
unittests 53.19% <42.85%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
test/ramcoretests.cxx 72.97% <70.58%> (ø)
tools/ramview.cxx 56.41% <58.62%> (ø)
src/ramcore/SamToNTuple.cxx 89.65% <83.75%> (ø)
src/rntuple/RAMNTupleRecord.cxx 35.49% <0.00%> (ø)
tools/samtoramntuple.cxx 0.00% <0.00%> (ø)
src/ramcore/RAMNTupleView.cxx 29.82% <25.80%> (ø)
Files with missing lines Coverage Δ
test/ramcoretests.cxx 72.97% <70.58%> (ø)
tools/ramview.cxx 56.41% <58.62%> (ø)
src/ramcore/SamToNTuple.cxx 89.65% <83.75%> (ø)
src/rntuple/RAMNTupleRecord.cxx 35.49% <0.00%> (ø)
tools/samtoramntuple.cxx 0.00% <0.00%> (ø)
src/ramcore/RAMNTupleView.cxx 29.82% <25.80%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include <cstring>
#include <iostream>
#include <limits>
#include <string>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header limits is not used directly [misc-include-cleaner]

Suggested change
#include <string>
#include <string>

#include <TFile.h>
#include <TROOT.h>

#include <cstdint>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

#include <cstdint>
^

this fix will not be applied because it overlaps with another fix


testing::internal::GetCapturedStdout();
testing::internal::CaptureStdout();
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, nullptr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: argument comment missing for literal argument 'perfstatsfilename' [bugprone-argument-comment]

Suggested change
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, nullptr);
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, /*perfstatsfilename=*/nullptr);

testing::internal::GetCapturedStdout();
testing::internal::CaptureStdout();
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, nullptr);
std::string ramview_output = testing::internal::GetCapturedStdout();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::string" is directly included [misc-include-cleaner]

test/ramcoretests.cxx:11:

+ #include <string>

testing::internal::GetCapturedStdout();
testing::internal::CaptureStdout();
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, nullptr);
std::string ramview_output = testing::internal::GetCapturedStdout();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ramview_output' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string ramview_output = testing::internal::GetCapturedStdout();
std::string ramview_output = 0 = testing::internal::GetCapturedStdout();

}
testing::internal::CaptureStdout();
ramntupleview(rntupleFile, region, /*cache=*/true, /*perfstats=*/false, nullptr);
std::string ramntupleview_output = testing::internal::GetCapturedStdout();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ramntupleview_output' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string ramntupleview_output = testing::internal::GetCapturedStdout();
std::string ramntupleview_output = 0 = testing::internal::GetCapturedStdout();

#include <string>
#include <cstring>
#include <vector>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header vector is not used directly [misc-include-cleaner]

Suggested change

do_split = true;
} else if (arg == "-only") {
if (i + 1 < argc) {
only_chromosomes.emplace_back(argv[++i]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

              only_chromosomes.emplace_back(argv[++i]);
                                            ^

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 23. Check the log or trigger a new build to see more.

#include "ramcore/SamParser.h"
#include "rntuple/RAMNTupleRecord.h"

#include <cstdint>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: #includes are not sorted properly [llvm-include-order]

#include <cstdint>
^

this fix will not be applied because it overlaps with another fix


#include <cstdint>
#include <map>
#include <memory>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header map is not used directly [misc-include-cleaner]

Suggested change
#include <memory>
#include <memory>

#include <cstdint>
#include <map>
#include <memory>
#include <cstdio>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header memory is not used directly [misc-include-cleaner]

Suggested change
#include <cstdio>
#include <cstdio>

#include <memory>
#include <cstdio>
#include <thread>
#include <vector>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header thread is not used directly [misc-include-cleaner]

Suggested change
#include <vector>
#include <vector>

#include <cstdio>
#include <thread>
#include <vector>
#include <mutex>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header vector is not used directly [misc-include-cleaner]

Suggested change
#include <mutex>
#include <mutex>

#include <mutex>
#include <algorithm>
#include <unordered_set>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header unordered_set is not used directly [misc-include-cleaner]

Suggested change

bool index, bool split, bool cache,
int compression_algorithm,
uint32_t quality_policy)
void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split, bool cache,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'samtoramntuple' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split, bool cache,
static void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split, bool cache,

const int32_t POS_INTERVAL = 10000;
const int64_t MAPPED_INTERVAL = 100;

auto header_callback = [&headers](const std::string &tag, const std::string &content) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::string" is directly included [misc-include-cleaner]

src/ramcore/SamToNTuple.cxx:9:

- #include <vector>
+ #include <string>
+ #include <vector>

if (sn_pos != std::string::npos) {
sn_pos += 3;
size_t tab_pos = content.find('\t', sn_pos);
std::string ref_name =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ref_name' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string ref_name =
std::string ref_name = 0 =

};

if (!parser.ParseFile(datafile, header_callback, record_callback)) {
printf("Failed to parse SAM file %s\n", datafile);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]

      printf("Failed to parse SAM file %s\n", datafile);
      ^

Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 18. Check the log or trigger a new build to see more.

#include <cstdio>
#include <map>
#include <memory>
#include <mutex>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header memory is not used directly [misc-include-cleaner]

Suggested change
#include <mutex>
#include <mutex>

#include <mutex>
#include <string>
#include <thread>
#include <unordered_set>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header thread is not used directly [misc-include-cleaner]

Suggested change
#include <unordered_set>
#include <unordered_set>

#include <string>
#include <thread>
#include <unordered_set>
#include <vector>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header unordered_set is not used directly [misc-include-cleaner]

Suggested change
#include <vector>
#include <vector>

#include <thread>
#include <unordered_set>
#include <vector>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header vector is not used directly [misc-include-cleaner]

Suggested change

bool index, bool split, bool cache,
int compression_algorithm,
uint32_t quality_policy)
void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'samtoramntuple' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split,
static void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split,

if (!std::filesystem::exists("samexample.sam")) {
GenerateSAMFile("samexample.sam", num_reads_for_test);
}
void SetUp() override

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'SetUp' can be made static [readability-convert-member-functions-to-static]

Suggested change
void SetUp() override
static void SetUp() override

std::remove("test_ttree.root");
std::remove("test_rntuple.root");
}
void TearDown() override

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'TearDown' can be made static [readability-convert-member-functions-to-static]

Suggested change
void TearDown() override
static void TearDown() override

}

TEST_F(ramcoreTest, RNTupleView)
TEST_F(ramcoreTest, ConversionProducesEqualEntries)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'TEST_F' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

Suggested change
TEST_F(ramcoreTest, ConversionProducesEqualEntries)
TEST_Fstatic (ramcoreTest, ConversionProducesEqualEntries)

}
testing::internal::CaptureStdout();
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, /*perfstatsfilename=*/nullptr);
std::string ramview_output;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ramview_output' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string ramview_output;
std::string ramview_output = 0;

ASSERT_NE(reader, nullptr) << "RNTuple file corrupted after viewing";
testing::internal::CaptureStdout();
ramntupleview(rntupleFile, region, /*cache=*/true, /*perfstats=*/false, /*perfstatsfilename=*/nullptr);
std::string ramntupleview_output;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ramntupleview_output' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string ramntupleview_output;
std::string ramntupleview_output = 0;

@AdityaPandeyCN AdityaPandeyCN marked this pull request as ready for review November 16, 2025 14:33
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

int main(int argc, char *argv[])
{
if (argc < 2) {
std::cout << "Usage: " << argv[0] << " <input.sam> [output]\n";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

      std::cout << "Usage: " << argv[0] << " <input.sam> [output]\n";
                                ^

output = argv[i];
}
}
const char *input = argv[1];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

   const char *input = argv[1];
                       ^

return 0;
}
for (int i = 2; i < argc; i++) {
std::string arg = argv[i];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

      std::string arg = argv[i];
                        ^

} else if (arg == "-only") {
if (i + 1 < argc) {

only_chromosomes.emplace_back(argv[++i]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

            only_chromosomes.emplace_back(argv[++i]);
                                          ^

}
} else if (arg == "-noindex") {
do_index = false;
} else if (arg == "-illumina") {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: repeated branch body in conditional chain [bugprone-branch-clone]

      } else if (arg == "-illumina") {
                                     ^
Additional context

tools/samtoramntuple.cxx:44: end of the original

      } else if (arg == "-dropqual") {
       ^

tools/samtoramntuple.cxx:44: clone 1 starts here

      } else if (arg == "-dropqual") {
                                     ^

} else if (arg == "-dropqual") {
quality_mode = RAMNTupleRecord::kDrop;
} else if (arg[0] != '-') {
output = argv[i];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]

         output = argv[i];
                  ^

}
}

std::string outfile;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'outfile' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string outfile;
std::string outfile = 0;

}
samtoramntuple(input, ramfile.c_str(), do_index, true, true, 505, quality_mode);
}
} catch (const std::exception &e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::exception" is directly included [misc-include-cleaner]

tools/samtoramntuple.cxx:2:

- #include <iostream>
+ #include <exception>
+ #include <iostream>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants