Skip to content

Commit

Permalink
PD-4722 bug: calling fusion2geneSymbols() for a mutation protein; col…
Browse files Browse the repository at this point in the history
…or codes are printed only when output is to screen
  • Loading branch information
Vyacheslav Brover committed Sep 6, 2023
1 parent 76f1c26 commit ccf119c
Show file tree
Hide file tree
Showing 5 changed files with 2,193 additions and 2,060 deletions.
7 changes: 5 additions & 2 deletions amr_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ struct BlastAlignment : Alignment
}
public:
string fusion2geneSymbols () const
{ ASSERT (! isMutationProt ());
{ ASSERT (! isMutationProt ());
if (fusions. empty ())
return getGeneSymbol ();
string s;
Expand Down Expand Up @@ -1011,6 +1011,7 @@ struct BlastAlignment : Alignment
)
return false;
// PD-4698
// Most probably a repeat protein
const size_t pseudoOverlap = mismatchTailTarget () * 2; // PAR
return (targetStart < other. targetStart && targetEnd >= other. targetStart + pseudoOverlap)
|| (targetEnd > other. targetEnd && targetStart + pseudoOverlap <= other. targetEnd);
Expand Down Expand Up @@ -1100,7 +1101,9 @@ struct BlastAlignment : Alignment
&& ! insideEq (other)
)
if ( ! targetProt
|| fusion2geneSymbols () != other. fusion2geneSymbols ()
|| ( ! isMutationProt () // PD-4722
&& fusion2geneSymbols () != other. fusion2geneSymbols ()
)
) // PD-4687
return false;
if ( ! isMutationProt ()
Expand Down
2 changes: 2 additions & 0 deletions amrfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* gunzip (optional)
*
* Release changes:
* 3.11.20 09/06/2023 PD-4722 bug: calling fusion2geneSymbols() for a mutation protein
* TERM codes are printed only when output is to screen
* 3.11.19 08/09/2023 PD-4698 if a pseudogene is overlapped by a different gene on the length >= 20 aa with the same gene symbol then the pseudogene is not reported
* 08/04/2023 PD-4706 protein match overrides a nucleotide match for point mutations
* 3.11.18 07/25/2023 parameter order in instruction; "can be gzipped" is added to help
Expand Down
99 changes: 84 additions & 15 deletions common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@
#include <csignal>

#ifndef _MSC_VER
#include <execinfo.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#ifdef __APPLE__
#include <sys/sysctl.h>
#endif
extern "C"
{
#include <execinfo.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#ifdef __APPLE__
#include <sys/sysctl.h>
#endif
}
#endif


Expand Down Expand Up @@ -107,6 +110,7 @@ bool sigpipe = false;




// COutErr

#ifndef _MSC_VER
Expand Down Expand Up @@ -223,6 +227,8 @@ namespace
bool segmFault)
// alloc() may not work
{
beep ();

ostream* os = logPtr ? logPtr : & cerr;

// time ??
Expand Down Expand Up @@ -315,6 +321,37 @@ string getStack ()



//

bool isRedirected (const ostream &os)
{
#ifdef _MSC_VER
return false;
#else
if (& os == & cout)
return ! isatty (fileno (stdout));
if (& os == & cerr)
return ! isatty (fileno (stderr));
if (& os == & clog)
return ! isatty (fileno (stderr));
return false;
#endif
}



void beep ()
{
constexpr char c = '\x07';
if (! isRedirected (cerr))
cerr << c;
else if (! isRedirected (cout))
cout << c;
}




// Chronometer

bool Chronometer::enabled = false;
Expand Down Expand Up @@ -383,8 +420,9 @@ Chronometer_OnePass::~Chronometer_OnePass ()
const OColor oc (os, Color::magenta, false, true /*& os == & cerr*/);
os << "CHRON: " << name << ": ";
const ONumber on (os, 0, false);
os << difftime (stop, start) << " sec." << endl;
os << difftime (stop, start) << " sec.";
}
os << endl;

if (addNewLine)
os << endl;
Expand All @@ -393,12 +431,12 @@ Chronometer_OnePass::~Chronometer_OnePass ()



// Byte
// uchar

size_t byte2first (Byte b)
size_t byte2first (uchar b)
{
if (! b)
return sizeof (Byte);
return sizeof (uchar);
const uint u = b;
size_t i = 0;
uint mask = 1;
Expand All @@ -414,7 +452,7 @@ size_t byte2first (Byte b)

size_t utf8_len (char first)
{
const uint u = numeric_limits<uint>::max () - (Byte) first;
const uint u = numeric_limits<uint>::max () - (uchar) first;
size_t len = 0;
uint mask = 0x80;
while (! contains (u, mask))
Expand Down Expand Up @@ -883,6 +921,21 @@ void collapseSpace (string &s)



void visualizeTrailingSpaces (string &s)
{
size_t spaces = 0;
while ( ! s. empty ()
&& s. back () == ' '
)
{
s. erase (s. size () - 1);
spaces++;
}
FFOR (size_t, i, spaces)
s += nonPrintable2str (' ');
}



string str2streamWord (const string &s,
size_t wordNum)
Expand Down Expand Up @@ -1622,6 +1675,22 @@ Threads::~Threads ()

// Xml::TextFile

void Xml::TextFile::printRawText (const string &s)
{
string res; res. reserve (s. size ());
for (const char c : s)
switch (c)
{
case '<': res += "&lt;"; break;
case '>': res += "&gt;"; break;
case '&': res += "&amp;"; break;
default: res += c;
}
printRaw (res);
}



void Xml::TextFile::tagStart (const string &tag)
{
ASSERT (! isText);
Expand Down Expand Up @@ -1675,11 +1744,11 @@ void Xml::BinFile::tagStart (const string &tag)
QC_ASSERT (! contains (tag, '\n'));
size_t i = names. add (tag);
//ASSERT (i);
const Byte b = i % 256;
const uchar b = i % 256;
i /= 256;
if (i > 256)
throw runtime_error (FUNC "Too many different tag names");
os << (Byte) i << b;
os << (uchar) i << b;
}


Expand Down
Loading

0 comments on commit ccf119c

Please sign in to comment.