From 98a06ebba808240d469dc67d433f4650b14c9373 Mon Sep 17 00:00:00 2001 From: Faith Okamoto <52177356+faithokamoto@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:21:00 -0800 Subject: [PATCH] Allow non-exons to have bad chromosomes Some GFF3 features aren't used by default, e.g. `region` or other non-gene things. However, if their chromosomes aren't in the graph, that causes a program-halting error. This change moves the check for whether the chromosome is valid to after the check for whether the feature is relevant, allowing graceful ignorance when possible. The program will still error in any situation where the chromosome is important. --- src/transcriptome.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/transcriptome.cpp b/src/transcriptome.cpp index 6534203cd7..a41d938598 100644 --- a/src/transcriptome.cpp +++ b/src/transcriptome.cpp @@ -604,6 +604,15 @@ int32_t Transcriptome::parse_transcripts(vector * transcripts, uint3 auto chrom_lengths_it = chrom_lengths.find(chrom); + transcript_line_ss.ignore(numeric_limits::max(), '\t'); + assert(getline(transcript_line_ss, feature, '\t')); + + // Select only relevant feature types. + if (feature != feature_type && !feature_type.empty()) { + + continue; + } + if (chrom_lengths_it == chrom_lengths.end()) { if (error_on_missing_path) { @@ -618,15 +627,6 @@ int32_t Transcriptome::parse_transcripts(vector * transcripts, uint3 } } - transcript_line_ss.ignore(numeric_limits::max(), '\t'); - assert(getline(transcript_line_ss, feature, '\t')); - - // Select only relevant feature types. - if (feature != feature_type && !feature_type.empty()) { - - continue; - } - // Parse start and end exon position and convert to 0-base. assert(getline(transcript_line_ss, pos, '\t')); int32_t spos = stoi(pos) - 1;