Commit 1063526e authored by Sascha Steinbiss's avatar Sascha Steinbiss
Browse files

New upstream version 22

parent e07c7bf4
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
2018-12-19  Martin C. Frith  <Martin C. Frith>

	* src/tantan.cc:
	Make it faster
	[3523060bcfb9] [tip]

	* src/tantan_repeat_finder.cc, src/tantan_repeat_finder.hh:
	Make -f4 a bit faster
	[1fccdf6e21be]

	* README.txt, src/mcf_tantan_options.cc, src/mcf_tantan_options.hh,
	src/tantan_app.cc, src/tantan_repeat_finder.cc,
	src/tantan_repeat_finder.hh, test/hard.fa, test/tantan_test.out,
	test/tantan_test.sh:
	Add option to find straightforward tandem repeats
	[1bae60144712]

	* README.txt, src/mcf_tantan_options.cc, src/tantan.cc,
	src/tantan_app.cc:
	Tweak the help message
	[fc1ca32a72aa]

2018-12-10  Martin C. Frith  <Martin C. Frith>

	* README.txt, src/mcf_tantan_options.cc, src/mcf_tantan_options.hh,
	src/tantan_app.cc, test/tantan_test.out, test/tantan_test.sh:
	Add match score, mismatch cost options
	[2383404c795a] [tip]
	[2383404c795a]

	* src/tantan.cc:
	Refactor
+28 −2
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ repeats, so it's easy to lift the masking after determining homology.</p>
<td>preserve uppercase/lowercase in non-masked regions</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-m</span></kbd></td>
<td>file for letter pair scores (scoring matrix)</td></tr>
<td>file for letter-pair score matrix</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-r</span></kbd></td>
<td>probability of a repeat starting per position</td></tr>
@@ -480,9 +480,12 @@ repeats, so it's easy to lift the masking after determining homology.</p>
<kbd><span class="option">-s</span></kbd></td>
<td>minimum repeat probability for masking</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-n</span></kbd></td>
<td>minimum copy number, affects -f4 only</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-f</span></kbd></td>
<td>output type: 0=masked sequence, 1=repeat probabilities,
2=repeat counts, 3=BED</td></tr>
2=repeat counts, 3=BED, 4=tandem repeats</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show help message, then exit</td></tr>
@@ -512,6 +515,29 @@ TGCTAGCAA ttaggcttaggtcagtgc TTAGGCTTAGGTCAGTGC AACGTA
</pre>
<p>(My thanks to Junko Tsuji and Paul Horton for finding these issues.)</p>
</div>
<div class="section" id="finding-straightforward-tandem-repeats">
<h1>Finding straightforward tandem repeats</h1>
<p>Option -f4 runs tantan in a different mode, where it finds
straightforward tandem repeats only.  (Technically, it uses a Viterbi
algorithm instead of a Forward-Backward algorithm.)  This is <em>not</em>
recommended for avoiding false homologs!  But it might be useful for
studying tandem repeats.  The output looks like this:</p>
<pre class="literal-block">
mySeq   14765   14780   6       2.5     GTCATG  GTCATG,GTCATG,GTC
mySeq   632362  632377  2       6       GC      GC,GC,GC,GCt,GCT,GCT
mySeq   1278353 1278369 3       6.5     TCA     TCA,TCA,TCA,TC-,TC,TC,T
mySeq   3616084 3616100 3       5.33333 TGG     TGA,TGA,TGG,TGG,TGG,T
</pre>
<p>The first 3 columns show the start and end coordinates of the
repetitive region, in <a class="reference external" href="https://genome.ucsc.edu/FAQ/FAQformat.html#format1">BED</a> format.  Column
4 shows the length of the repeating unit (which might vary due to
insertions and deletions, so this column shows the most common
length).  Column 5 shows the number of repeat units.  Column 6 shows
the repeating unit (which again might vary, so this is just a
representative).  Column 7 shows the whole repeat: lowercase letters
are insertions relative to the previous repeat unit, and dashes are
deletions relative to the previous repeat unit.</p>
</div>
<div class="section" id="miscellaneous">
<h1>Miscellaneous</h1>
<p>tantan is distributed under the GNU General Public License, either
+28 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ Options
-p  interpret the sequences as proteins
-x  letter to use for masking, instead of lowercase
-c  preserve uppercase/lowercase in non-masked regions
-m  file for letter pair scores (scoring matrix)
-m  file for letter-pair score matrix
-r  probability of a repeat starting per position
-e  probability of a repeat ending per position
-w  maximum tandem repeat period to consider
@@ -146,8 +146,9 @@ Options
-a  gap existence cost
-b  gap extension cost
-s  minimum repeat probability for masking
-n  minimum copy number, affects -f4 only
-f  output type: 0=masked sequence, 1=repeat probabilities,
                 2=repeat counts, 3=BED
                 2=repeat counts, 3=BED, 4=tandem repeats
-h, --help  show help message, then exit
--version   show version information, then exit

@@ -172,6 +173,31 @@ align it on the other strand::

(My thanks to Junko Tsuji and Paul Horton for finding these issues.)

Finding straightforward tandem repeats
--------------------------------------

Option -f4 runs tantan in a different mode, where it finds
straightforward tandem repeats only.  (Technically, it uses a Viterbi
algorithm instead of a Forward-Backward algorithm.)  This is *not*
recommended for avoiding false homologs!  But it might be useful for
studying tandem repeats.  The output looks like this::

  mySeq   14765   14780   6       2.5     GTCATG  GTCATG,GTCATG,GTC
  mySeq   632362  632377  2       6       GC      GC,GC,GC,GCt,GCT,GCT
  mySeq   1278353 1278369 3       6.5     TCA     TCA,TCA,TCA,TC-,TC,TC,T
  mySeq   3616084 3616100 3       5.33333 TGG     TGA,TGA,TGG,TGG,TGG,T

The first 3 columns show the start and end coordinates of the
repetitive region, in `BED
<https://genome.ucsc.edu/FAQ/FAQformat.html#format1>`_ format.  Column
4 shows the length of the repeating unit (which might vary due to
insertions and deletions, so this column shows the most common
length).  Column 5 shows the number of repeat units.  Column 6 shows
the repeating unit (which again might vary, so this is just a
representative).  Column 7 shows the whole repeat: lowercase letters
are insertions relative to the previous repeat unit, and dashes are
deletions relative to the previous repeat unit.

Miscellaneous
-------------

+21 −7
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static int myGetopt(int argc, char **argv, const char *optstring,
std::istream &operator>>(std::istream &s, TantanOptions::OutputType &x) {
  int i = 0;
  s >> i;
  if (i < 0 || i > 3)
  if (i < 0 || i > 4)
    s.setstate(std::ios::failbit);
  if (s)
    x = static_cast<TantanOptions::OutputType>(i);
@@ -57,6 +57,7 @@ TantanOptions::TantanOptions() :
    gapExistenceCost(0),
    gapExtensionCost(-1),  // means: no gaps
    minMaskProb(0.5),
    minCopyNumber(2.0),
    outputType(maskOut),
    indexOfFirstNonOptionArgument(-1) {}

@@ -69,7 +70,7 @@ Options (default settings):\n\
 -p  interpret the sequences as proteins\n\
 -x  letter to use for masking, instead of lowercase\n\
 -c  preserve uppercase/lowercase in non-masked regions\n\
 -m  file for letter pair scores (+1/-1, but -p selects BLOSUM62)\n\
 -m  file for letter-pair score matrix\n\
 -r  probability of a repeat starting per position ("
      + stringify(repeatProb) + ")\n\
 -e  probability of a repeat ending per position ("
@@ -77,15 +78,17 @@ Options (default settings):\n\
 -w  maximum tandem repeat period to consider (100, but -p selects 50)\n\
 -d  probability decay per period ("
      + stringify(repeatOffsetProbDecay) + ")\n\
 -i  match score (1, but -p selects BLOSUM62)\n\
 -j  mismatch cost (1, but -p selects BLOSUM62)\n\
 -i  match score (BLOSUM62 if -p, else 2 if -f4, else 1)\n\
 -j  mismatch cost (BLOSUM62 if -p, else 7 if -f4, else 1)\n\
 -a  gap existence cost ("
      + stringify(gapExistenceCost) + ")\n\
 -b  gap extension cost (infinite: no gaps)\n\
 -b  gap extension cost (7 if -f4, else infinity)\n\
 -s  minimum repeat probability for masking ("
      + stringify(minMaskProb) + ")\n\
 -n  minimum copy number, affects -f4 only ("
      + stringify(minCopyNumber) + ")\n\
 -f  output type: 0=masked sequence, 1=repeat probabilities,\n\
                  2=repeat counts, 3=BED ("
                  2=repeat counts, 3=BED, 4=tandem repeats ("
      + stringify(outputType) + ")\n\
 -h, --help  show help message, then exit\n\
 --version   show version information, then exit\n\
@@ -93,12 +96,13 @@ Options (default settings):\n\
Report bugs to: tantan@cbrc.jp\n\
Home page: http://www.cbrc.jp/tantan/\n\
";
  // -k for transition cost?

  std::string version = "tantan "
#include "version.hh"
      "\n";

  const char *optstring = "px:cm:r:e:w:d:i:j:a:b:s:f:h";
  const char *optstring = "px:cm:r:e:w:d:i:j:a:b:s:n:f:h";

  int i;
  while ((i = myGetopt(argc, argv, optstring, help, version)) != -1) {
@@ -158,6 +162,9 @@ Home page: http://www.cbrc.jp/tantan/\n\
        unstringify(minMaskProb, optarg);
        // don't bother checking for stupid values?
        break;
      case 'n':
	unstringify(minCopyNumber, optarg);
	break;
      case 'f':
        unstringify(outputType, optarg);
        break;
@@ -168,11 +175,18 @@ Home page: http://www.cbrc.jp/tantan/\n\
    }
  }

  if (gapExtensionCost < 0 && outputType == repOut) gapExtensionCost = 7;

  if (gapExtensionCost > 0 && gapExistenceCost + gapExtensionCost <= 0)
    throw Error("gap existence + extension cost is too low");

  if (maxCycleLength < 0) maxCycleLength = (isProtein ? 50 : 100);

  if (!isProtein || matchScore || mismatchCost) {
    if (matchScore   == 0) matchScore   = (outputType == repOut ? 2 : 1);
    if (mismatchCost == 0) mismatchCost = (outputType == repOut ? 7 : 1);
  }

  indexOfFirstNonOptionArgument = optind;
}

+2 −1
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ struct TantanOptions {
  int gapExistenceCost;
  int gapExtensionCost;
  double minMaskProb;
  enum OutputType { maskOut, probOut, countOut, bedOut } outputType;
  double minCopyNumber;
  enum OutputType { maskOut, probOut, countOut, bedOut, repOut } outputType;

  int indexOfFirstNonOptionArgument;
};
Loading