Skip to content

Commit

Permalink
JIRA: RW-2200
Browse files Browse the repository at this point in the history
Added output for 'unknown' gap type
Avoided warnings

git-svn-id: https://anonsvn.ncbi.nlm.nih.gov/repos/v1/trunk/c++@101464 78c7ea69-d796-4a43-9a09-de51944f1b03
  • Loading branch information
gotvyans authored and gouriano committed Feb 1, 2024
1 parent d49395a commit 2cdfe03
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/objtools/writers/agp_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ USING_SCOPE(objects);

static char s_DetermineComponentType(const CSeq_id& id, CScope& scope);

// This could be made considerably faster (conversion of enum to string)
inline string GetGapType(const CSeqMap_CI& iter,
const string* default_gap_type)
// TODO: This could be made considerably faster (conversion of enum to string)
static
string_view GetGapType(const CSeqMap_CI& iter, const string* default_gap_type)
{
try {
const CSeq_data& data = iter.GetData();
Expand All @@ -82,12 +82,14 @@ inline string GetGapType(const CSeqMap_CI& iter,
return "contig";
case CSeq_gap::eType_scaffold:
return "scaffold";
case CSeq_gap::eType_unknown:
return "unknown";
default:
// unknown or other
// do nothing (will use default_gap_type if non-null)
;
}
} catch (CSeqMapException&) {
} catch (const CSeqMapException&) {
// no Seq-data for this gap
}
if (default_gap_type) {
Expand All @@ -96,13 +98,14 @@ inline string GetGapType(const CSeqMap_CI& iter,
throw runtime_error("couldn't get gap type");
}

inline bool GetLinkage(const CSeqMap_CI& iter,
const bool* default_linkage)
static
bool GetLinkage(const CSeqMap_CI& iter, const bool* default_linkage)
{
try {
return iter.GetData().GetGap().GetLinkage()
== CSeq_gap::eLinkage_linked;
} catch (CSeqMapException&) {
try
{
return iter.GetData().GetGap().GetLinkage() == CSeq_gap::eLinkage_linked;
} catch (const CSeqMapException&)
{
// no Seq-data for this gap
}
if (default_linkage) {
Expand All @@ -112,9 +115,10 @@ inline bool GetLinkage(const CSeqMap_CI& iter,
}

static
inline void WriteLinkageEvidence( CNcbiOstream &os, const CSeqMap_CI& iter )
void WriteLinkageEvidence( CNcbiOstream &os, const CSeqMap_CI& iter )
{
try {
try
{
const CSeq_gap & gap = iter.GetData().GetGap();
if( gap.IsSetLinkage_evidence() ) {
string linkage_evidence_str;
Expand All @@ -123,7 +127,8 @@ inline void WriteLinkageEvidence( CNcbiOstream &os, const CSeqMap_CI& iter )
gap.GetLinkage_evidence() );
os << linkage_evidence_str;
}
} catch (CSeqMapException&) {
} catch (const CSeqMapException&)
{
// no Seq-data for this gap
}
}
Expand Down

0 comments on commit 2cdfe03

Please sign in to comment.