Make it easier to feed stdin/pipe to last-train
authorMartin C. Frith
Tue Jun 20 18:11:52 2017 +0900 (2017-06-20)
changeset 869b73f1146e688
parent 868 56f960a740a3
child 870 ad7f5f953412
Make it easier to feed stdin/pipe to last-train
doc/last-train.txt
scripts/last-train
test/last-train-test.out
test/last-train-test.sh
     1.1 --- a/doc/last-train.txt	Tue Jun 20 12:31:47 2017 +0900
     1.2 +++ b/doc/last-train.txt	Tue Jun 20 18:11:52 2017 +0900
     1.3 @@ -15,9 +15,13 @@
     1.4    last-train mydb queries.fasta
     1.5  
     1.6  last-train prints a summary of each alignment step, followed by the
     1.7 -final score parameters in a format that can be read by `lastal's -p
     1.8 +final score parameters, in a format that can be read by `lastal's -p
     1.9  option <lastal.html#score-options>`_.
    1.10  
    1.11 +You can also pipe sequences into last-train, for example::
    1.12 +
    1.13 +  zcat queries.fasta.gz | last-train mydb
    1.14 +
    1.15  Options
    1.16  -------
    1.17  
     2.1 --- a/scripts/last-train	Tue Jun 20 12:31:47 2017 +0900
     2.2 +++ b/scripts/last-train	Tue Jun 20 18:11:52 2017 +0900
     2.3 @@ -478,7 +478,10 @@
     2.4                    help="input format: 0=fasta, 1=fastq-sanger")
     2.5      op.add_option_group(og)
     2.6      (opts, args) = op.parse_args()
     2.7 -    if len(args) < 2: op.error("I need a lastdb index and query sequences")
     2.8 +    if len(args) < 1:
     2.9 +        op.error("I need a lastdb index and query sequences")
    2.10 +    if not opts.sample_number and (len(args) < 2 or "-" in args):
    2.11 +        op.error("sorry, can't use stdin when --sample-number=0")
    2.12      if not opts.p and (not opts.Q or opts.Q == "0"):
    2.13          if not opts.r: opts.r = "5"
    2.14          if not opts.q: opts.q = "5"
     3.1 --- a/test/last-train-test.out	Tue Jun 20 12:31:47 2017 +0900
     3.2 +++ b/test/last-train-test.out	Tue Jun 20 18:11:52 2017 +0900
     3.3 @@ -1,4 +1,4 @@
     3.4 -TEST last-train -m1 /tmp/last-train-test ../examples/mouseMito.fa
     3.5 +TEST last-train -m1 /tmp/last-train-test < ../examples/mouseMito.fa
     3.6  # maximum percent identity: 100
     3.7  # scale of score parameters: 4.5512
     3.8  # scale used while training: 91.024
     4.1 --- a/test/last-train-test.sh	Tue Jun 20 12:31:47 2017 +0900
     4.2 +++ b/test/last-train-test.sh	Tue Jun 20 18:11:52 2017 +0900
     4.3 @@ -16,7 +16,7 @@
     4.4  
     4.5  {
     4.6      lastdb $db ../examples/humanMito.fa
     4.7 -    try last-train -m1 $db ../examples/mouseMito.fa
     4.8 +    try "last-train -m1 $db < ../examples/mouseMito.fa"
     4.9      try last-train -m1 --revsym $db ../examples/mouseMito.fa
    4.10      try last-train -m1 --matsym --gapsym $db ../examples/mouseMito.fa
    4.11  } |