Skip to content

Commit

Permalink
version 1.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyacheslav Brover committed Mar 4, 2024
1 parent 33d4c2f commit 8c48fd9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 43 deletions.
10 changes: 4 additions & 6 deletions common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,12 +1597,10 @@ void exec (const string &cmd,
//Chronometer_OnePass cop (cmd);
if (verbose ())
cout << cmd << endl;
if (logPtr)
*logPtr << cmd << endl;
LOG (cmd);

const int status = system (cmd. c_str ()); // pipefail's are not caught
if (logPtr)
*logPtr << "status = " << status << endl;
LOG ("status = " + to_string (status));
if (status)
{
string err (cmd + "\nstatus = " + to_string (status));
Expand Down Expand Up @@ -4147,8 +4145,8 @@ string ShellApplication::getHelp () const

void ShellApplication::body () const
{
if (logPtr && useTmp)
*logPtr << tmp << endl;
if (useTmp)
LOG (tmp);
shellBody ();
}

Expand Down
1 change: 1 addition & 0 deletions common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

#define PRINT(x) { Offset::newLn (cout); cout << #x << " = " << (x); }

#define LOG(x) { if (logPtr) *logPtr << (x) << endl; }

#define XSTR(s) STR(s)
#define STR(s) #s
Expand Down
5 changes: 1 addition & 4 deletions fasta_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ struct ThisApplication : Application
throw runtime_error (id + ": Too many ambiguities");
}
if (skip)
{
if (logPtr)
*logPtr << "Skipping " << id << endl;
}
{ LOG ("Skipping " + id); }
else
{
if (lenF. get ())
Expand Down
53 changes: 21 additions & 32 deletions stxtyper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* Dependencies: NCBI BLAST, gunzip (optional)
*
* Release changes:
* 1.0.12 02/29/2024 TsvOut.live() is used
* 1.0.11 02/28/2024 PD-4911 wrong QC for log file output
* PD-4897 single-subunit operons are de-redundified
* 1.0.10 02/22/2024 PD-4901 multiple types for the same protein sequence are allowed; only Flemming's reference proteins are used
* 1.0.9 02/16/2024 PD-4901 new database (includes Flemming's data)
Expand Down Expand Up @@ -207,7 +209,9 @@ struct BlastAlignment
}
void saveTsvOut (TsvOut& td,
bool verboseP) const
{ if (! input_name. empty ())
{ if (! td. live ())
return;
if (! input_name. empty ())
td << input_name;
td << targetName
<< (stxS + (verboseP ? (subunit + stxType) : string (1, stxType [0])))
Expand Down Expand Up @@ -387,6 +391,8 @@ struct Operon
void saveTsvOut (TsvOut& td,
bool verboseP) const
{ ASSERT (al1);
if (! td. live ())
return;
if (al2)
{
string stxType (getStxType (verboseP));
Expand Down Expand Up @@ -533,8 +539,7 @@ void goodBlasts2operons (const VectorPtr<BlastAlignment> &goodBlastAls,
{
IMPLY (sameType, strong);

if (logPtr)
*logPtr << endl << "Good blasts:" << endl;
LOG ("\nGood blasts:");

size_t start = 0;
FFOR (size_t, i, goodBlastAls. size ())
Expand Down Expand Up @@ -577,11 +582,8 @@ void goodBlasts2operons (const VectorPtr<BlastAlignment> &goodBlastAls,
)
{
Operon op (*al1, *al2);
if (logPtr)
{
*logPtr << "Operon:" << '\t' << op. getIdentity () << '\t' << stxClass2identity [op. al1->stxClass] << endl;
op. saveTsvOut (logTd, true);
}
LOG ("Operon:\t" + to_string (op. getIdentity ()) + "\t" + to_string (stxClass2identity [op. al1->stxClass]));
op. saveTsvOut (logTd, true);
if ( ! strong
|| ( op. getIdentity () >= stxClass2identity [op. al1->stxClass]
&& op. getIdentity () >= stxClass2identity [op. al2->stxClass]
Expand All @@ -596,11 +598,8 @@ void goodBlasts2operons (const VectorPtr<BlastAlignment> &goodBlastAls,
}
}

if (logPtr)
{
*logPtr << "# Operons: " << operons. size () << endl;
*logPtr << endl << "Suppress goodBlastAls by operons" << endl;
}
LOG ("# Operons: " + to_string (operons. size ()));
LOG ("\nSuppress goodBlastAls by operons");

for (const BlastAlignment* al : goodBlastAls)
{
Expand Down Expand Up @@ -778,19 +777,15 @@ struct ThisApplication : ShellApplication
while (f. nextLine ())
{
const Unverbose unv;
if (logPtr)
*logPtr << f. line << endl;
LOG (f. line);
auto al = new BlastAlignment (f. line);
al->qc ();
blastAls << al;
}
}

if (logPtr)
{
*logPtr << "# All stx blasts: " << blastAls. size () << endl;
*logPtr << "Finding frame shifts:" << endl;
}
LOG ("# All stx blasts: " + to_string (blastAls. size ()));
LOG ("Finding frame shifts:");
{
// Multiple frame shifts are possible
blastAls. sort (BlastAlignment::frameshiftLess);
Expand All @@ -816,8 +811,7 @@ struct ThisApplication : ShellApplication
}
}

if (logPtr)
*logPtr << "All blasts:" << endl;
LOG ("All blasts:");
VectorPtr<BlastAlignment> goodBlastAls;
{
blastAls. sort (BlastAlignment::sameTypeLess);
Expand Down Expand Up @@ -864,22 +858,18 @@ struct ThisApplication : ShellApplication

Vector<Operon> operons;

if (logPtr)
*logPtr << endl << "Same type operons:" << endl;
LOG ("\nSame type operons:");
goodBlasts2operons (goodBlastAls, operons, true, true, logTd);

goodBlastAls. sort (BlastAlignment::less);

if (logPtr)
*logPtr << endl << "Strong operons:" << endl;
LOG ("\nStrong operons:");
goodBlasts2operons (goodBlastAls, operons, false, true, logTd);

if (logPtr)
*logPtr << endl << "Weak operons:" << endl;
LOG ("\nWeak operons:");
goodBlasts2operons (goodBlastAls, operons, false, false, logTd);

if (logPtr)
*logPtr << endl << "goodOperons" << endl;
LOG ("\ngoodOperons");
Vector<Operon> goodOperons;
{
operons. sort ();
Expand Down Expand Up @@ -939,8 +929,7 @@ struct ThisApplication : ShellApplication
}
}

if (logPtr)
*logPtr << endl << "goodBlastAls -> goodOperons (single-subunit)" << endl;
LOG ("\ngoodBlastAls -> goodOperons (single-subunit)");
goodBlastAls. sort (BlastAlignment::reportLess);
FFOR (size_t, i, goodBlastAls. size ())
{
Expand Down
2 changes: 2 additions & 0 deletions tsv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ struct TsvOut
}


bool live () const
{ return os; }
bool empty () const
{ return ! lines
&& ! fields_max
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.11
1.0.12

0 comments on commit 8c48fd9

Please sign in to comment.