App-Anchr

 view release on metacpan or  search on metacpan

t/02-dep.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help dep)] );
like( $result->stdout, qr{dep}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(dep t/not_exists)] );
like( $result->error, qr{need no input}, 'need no inputs' );

$result = test_app( 'App::Anchr' => [qw(dep)] );
like( $result->stdout, qr{OK: find}, 'Check basic infrastructures' );

$result = test_app( 'App::Anchr' => [qw(dep --install)] );
like( $result->stdout, qr{install_dep},                'install_dep.sh' );
like( $result->stdout, qr{all dependances installed},  'all dependances installed' );
like( $result->stdout, qr{cpanm},                      'cpanm' );
like( $result->stdout, qr{all Perl modules installed}, 'all Perl modules installed' );

t/03-dazzname.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help dazzname)] );
like( $result->stdout, qr{dazzname}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(dazzname)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(dazzname t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(dazzname t/1_4.anchor.fasta --prefix B-A:D -o stdout)] );
like( $result->error, qr{Can't accept}, 'bad names' );

$result = test_app( 'App::Anchr' => [qw(dazzname t/1_4.anchor.fasta -o B-A:D)] );
like( $result->error, qr{Can't accept}, 'bad names' );

$result = test_app( 'App::Anchr' => [qw(dazzname t/1_4.anchor.fasta -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 8, 'line count' );

t/04-show2ovlp.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help show2ovlp)] );
like( $result->stdout, qr{show2ovlp}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(show2ovlp)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(show2ovlp t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(show2ovlp t/1_4.renamed.fasta t/1_4.show.txt -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 50, 'line count' );
like( $result->stdout, qr{overlap}s, 'overlaps' );

$result = test_app(
    'App::Anchr' => [qw(show2ovlp t/1_4.renamed.fasta t/1_4.show.txt -r t/not_exists -o stdout)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' =>
        [qw(show2ovlp t/1_4.renamed.fasta t/1_4.show.txt -r t/1_4.replace.tsv -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 50, 'line count' );
like( $result->stdout, qr{pac7556_20928}s, 'original name' );

done_testing();

t/05-trim.t  view on Meta::CPAN

# 1000 pair of reads
# seqtk sample -s1000 $HOME/data/anchr/e_coli/2_illumina/R1.fq.gz 1000 | pigz > t/R1.fq.gz
# seqtk sample -s1000 $HOME/data/anchr/e_coli/2_illumina/R2.fq.gz 1000 | pigz > t/R2.fq.gz

my $result = test_app( 'App::Anchr' => [qw(help trim)] );
like( $result->stdout, qr{trim}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(trim)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(trim t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(trim t/R1.fq.gz t/R2.fq.gz -a t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'adapter file not exists' );

$result = test_app( 'App::Anchr' => [qw(trim t/R1.fq.gz t/R2.fq.gz -o stdout)] );
is( scalar( grep {/\S/} split( /\n/, $result->stdout ) ), 67, 'line count' );
like( $result->stdout, qr{scythe.+sickle.+outputs}s, 'bash contents' );

$result = test_app( 'App::Anchr' => [qw(trim t/R1.fq.gz t/R2.fq.gz -b fancy/NAMES -o stdout)] );
like( $result->stdout, qr{fancy\/NAMES}s, 'fancy names' );

$result = test_app( 'App::Anchr' => [qw(trim t/R1.fq.gz t/R2.fq.gz -o stdout --noscythe)] );

t/07-overlap.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal; # `anchr overlap` calls `anchr show2ovlp` to write outputs

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help overlap)] );
like( $result->stdout, qr{overlap}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(overlap)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 5, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 14, 'line count' );
like( $result->stdout, qr{overlap}s, 'overlaps' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );

$result = test_app( 'App::Anchr' => [qw(overlap t/1_4.pac.fasta --idt 0.8 --len 2500 --serial -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 4, 'line count' );

t/08-overlap2.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;   # `anchr overlap2` calls `anchr show2ovlp` to write outputs

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help overlap2)] );
like( $result->stdout, qr{overlap2}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(overlap2)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(overlap2 t/1_4.anchor.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

{    # real run
    my $tempdir = Path::Tiny->tempdir;
    $result = test_app( 'App::Anchr' =>
            [ qw(overlap2 t/1_4.anchor.fasta t/1_4.pac.fasta), "-d", $tempdir->stringify, ] );

    ok( $tempdir->child("anchorLong.db")->is_file,       'dazz DB exists' );
    ok( $tempdir->child("anchorLong.ovlp.tsv")->is_file, 'result file exists' );
}

t/09-orient.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;    # `anchr orient` calls `anchr show2ovlp` to write outputs

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help orient)] );
like( $result->stdout, qr{orient}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(orient)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(orient t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app(
    'App::Anchr' => [qw(orient t/1_4.anchor.fasta t/1_4.pac.fasta -r t/not_exists -o stdout)] );
like( $result->error, qr{doesn't exist}, 'restrict file not exists' );

$result = test_app( 'App::Anchr' =>
        [qw(orient t/1_4.anchor.fasta t/1_4.pac.fasta -r t/1_4.2.restrict.tsv -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 9, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 24, 'line count' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );

done_testing();

t/10-cover.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help cover --range 1-4)] );
like( $result->stdout, qr{cover}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(cover --range 1-4)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(cover t/not_exists --range 1-4)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

{
    # real run
    my $tempdir = Path::Tiny->tempdir;
    test_app( 'App::Anchr' =>
            [ qw(overlap2 t/1_4.anchor.fasta t/1_4.pac.fasta), "-d", $tempdir->stringify, ] );

    $result = test_app( 'App::Anchr' =>
            [ qw(cover --range 1-4), $tempdir->child("anchorLong.ovlp.tsv")->stringify, ] );

t/11-group.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help group --range 1-4)] );
like( $result->stdout, qr{group}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(group --range 1-4)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(group t/not_exists --range 1-4)] );
like( $result->error, qr{need .+input file}, 'need 2 infiles' );

$result = test_app( 'App::Anchr' => [qw(group t/not_exists t/not_exists --range 1-4)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

{
    # real run
    my $tempdir = Path::Tiny->tempdir;
    test_app( 'App::Anchr' =>
            [ qw(overlap2 t/1_4.anchor.fasta t/1_4.pac.fasta), "-d", $tempdir->stringify, ] );

    $result = test_app(
        'App::Anchr' => [

t/12-replace.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help replace)] );
like( $result->stdout, qr{replace}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(replace)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(replace t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(replace t/1_4.ovlp.tsv t/1_4.replace.tsv -r -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 50, 'line count' );
unlike( $result->stdout, qr{pac6425_4471}, 'replaced' );
like( $result->stdout, qr{falcon_read\/12\/0_4471}, 'replaced' );

$result = test_app( 'App::Anchr' => [qw(replace t/1_4.ovlp.tsv t/1_4.replace.tsv -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 50, 'line count' );
like( $result->stdout, qr{pac6425_4471}, 'not replaced' );

t/13-restrict.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help restrict)] );
like( $result->stdout, qr{restrict}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(restrict)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(restrict t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(restrict t/1_4.ovlp.tsv t/1_4.restrict.tsv -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 36, 'line count' );
unlike( $result->stdout, qr{pac.+pac}, 'no long-long overlaps' );

$result = test_app( 'App::Anchr' => [qw(restrict t/1_4.ovlp.tsv t/1_4.2.restrict.tsv -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 28, 'line count' );
unlike( $result->stdout, qr{pac.+pac}, 'no long-long overlaps' );
unlike( $result->stdout, qr{pac7556_20928}, 'no pac7556_20928' );

t/14-contained.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help contained)] );
like( $result->stdout, qr{contained}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(contained)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(contained t/1_4.pac.fasta t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(contained t/1_4.anchor.fasta --prefix anchor -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 8, 'line count' );
unlike( $result->stdout, qr{anchor576_1624}s, 'original names' );
like( $result->stdout, qr{anchor_0\/1\/}s, 'renamed' );

$result = test_app( 'App::Anchr' => [qw(contained t/contained.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );

t/15-merge.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help merge)] );
like( $result->stdout, qr{merge}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(merge)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(merge t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(merge t/merge.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{merge_1}s, 'merged' );

done_testing();

t/16-layout.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help layout)] );
like( $result->stdout, qr{layout}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(layout)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(layout t/not_exists)] );
like( $result->error, qr{need .+input file}, 'need 3 infiles' );

$result = test_app( 'App::Anchr' => [qw(layout t/not_exists t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

{
    my $tempdir = Path::Tiny->tempdir;
    $result = test_app(
        'App::Anchr' => [
            qw(layout t/24_4.ovlp.tsv t/24_4.relation.tsv t/24_4.strand.fasta),
            qw(--oa t/24_4.anchor.ovlp.tsv -o),
            $tempdir->child('conTig.fasta'),
        ]

t/17-break.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help break --range 1-4)] );
like( $result->stdout, qr{break}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(break --range 1-4)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(break t/not_exists --range 1-4)] );
like( $result->error, qr{need .+input file}, 'need 2 infiles' );

$result = test_app( 'App::Anchr' => [qw(break t/not_exists t/not_exists --range 1-4)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

{
    # real run
    my $tempdir = Path::Tiny->tempdir;
    test_app( 'App::Anchr' =>
            [ qw(overlap2 t/1_4.anchor.fasta t/1_4.pac.fasta), "-d", $tempdir->stringify, ] );

    $result = test_app(
        'App::Anchr' => [

t/18-quorum.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help quorum)] );
like( $result->stdout, qr{quorum}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(quorum)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(quorum t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(quorum t/R1.fq.gz t/R2.fq.gz -a t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'adapter file not exists' );

$result = test_app( 'App::Anchr' => [qw(quorum t/R1.fq.gz t/R2.fq.gz -o stdout)] );
ok( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ) > 150, 'line count' );
like( $result->stdout, qr{masurca.+Estimating}s, 'bash contents' );

done_testing();

t/19-kunitigs.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help kunitigs)] );
like( $result->stdout, qr{kunitigs}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(kunitigs)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(kunitigs t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(kunitigs t/R1.fq.gz t/environment.json -o stdout)] );
ok( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ) > 50, 'line count' );
like( $result->stdout, qr{Colors.+Build}s, 'bash contents' );

done_testing();

t/20-anchors.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help anchors)] );
like( $result->stdout, qr{anchors}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(anchors)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(anchors t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(anchors t/merge.fasta t/R1.fq.gz -o stdout)] );
ok( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ) > 50, 'line count' );
like( $result->stdout, qr{Colors.+anchor2}s, 'bash contents' );

done_testing();

t/21-scaffold.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help scaffold)] );
like( $result->stdout, qr{scaffold}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(scaffold)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(scaffold t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(scaffold t/merge.fasta t/R1.fq.gz -o stdout)] );
ok( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ) > 50, 'line count' );
like( $result->stdout, qr{Colors.+scaffold}s, 'bash contents' );

done_testing();

t/22-paf2ovlp.t  view on Meta::CPAN

use App::Cmd::Tester;

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help paf2ovlp)] );
like( $result->stdout, qr{paf2ovlp}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(paf2ovlp)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(paf2ovlp t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(paf2ovlp t/1_4.pac.paf -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 28, 'line count' );
like( $result->stdout, qr{overlap}s, 'overlaps' );

done_testing();

t/23-trimlong.t  view on Meta::CPAN

use App::Cmd::Tester::CaptureExternal;    # `anchr cover` calls `anchr show2ovlp` to write outputs

use App::Anchr;

my $result = test_app( 'App::Anchr' => [qw(help trimlong)] );
like( $result->stdout, qr{trimlong}, 'descriptions' );

$result = test_app( 'App::Anchr' => [qw(trimlong)] );
like( $result->error, qr{need .+input file}, 'need infile' );

$result = test_app( 'App::Anchr' => [qw(trimlong t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );

$result = test_app( 'App::Anchr' => [qw(trimlong t/1_4.pac.fasta -v -o stdout)] );
is( ( scalar grep {/^CMD/} grep {/\S/} split( /\n/, $result->stderr ) ), 3, 'stderr line count' );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 16, 'line count' );
like( $result->stdout, qr{pac4745_7148}s, 'original names' );
unlike( $result->stdout, qr{pac4745_7148:1}s, 'uncovered region' );

$result = test_app(
    'App::Anchr' => [



( run in 0.460 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )