Skip to content

Commit

Permalink
Merge pull request #4489 from vgteam/vg-rna-error-on-gz
Browse files Browse the repository at this point in the history
Graceful error on gff3.gz files
  • Loading branch information
faithokamoto authored Jan 8, 2025
2 parents ebf2512 + dea65dd commit 0a86f66
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/subcommand/rna_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using namespace std;
using namespace vg;
using namespace vg::subcommand;

string GZ_SUFFIX = ".gz";

void help_rna(char** argv) {
cerr << "\nusage: " << argv[0] << " rna [options] graph.[vg|pg|hg|gbz] > splicing_graph.[vg|pg|hg]" << endl
Expand Down Expand Up @@ -250,6 +251,21 @@ int32_t main_rna(int32_t argc, char** argv) {
return 1;
}

for (const auto& filenames : {std::cref(transcript_filenames), std::cref(intron_filenames)}) {
// For each collection of filenames (see https://stackoverflow.com/a/64794991/)

for (auto filename : filenames.get()) {

// taken from https://stackoverflow.com/a/20446239/
if (filename.size() >= GZ_SUFFIX.size() &&
filename.compare(filename.size() - GZ_SUFFIX.size(), GZ_SUFFIX.size(), GZ_SUFFIX) == 0) {

cerr << "[vg rna] ERROR: Annotation file " << filename << " appears to be gzipped. Decompress it before use." << endl;
return 1;
}
}
}

if (!haplotypes_filename.empty() && gbz_format) {

cerr << "[vg rna] ERROR: Only one set of haplotypes can be provided (GBZ file contains both a graph and haplotypes). Use either --haplotypes or --gbz-format." << endl;
Expand Down

1 comment on commit 0a86f66

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

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

vg CI tests complete for merge to master. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 17575 seconds

Please sign in to comment.