view release on metacpan or search on metacpan
lib/App/RL/Command/position.pm view on Meta::CPAN
my $info = App::RL::Common::decode_header($line);
next unless App::RL::Common::info_is_valid($info);
$info->{chr} =~ s/chr0?//i if $opt->{remove};
my $cur_positions = App::RL::Common::new_set();
$cur_positions->add_pair( $info->{start}, $info->{end} );
if ( $opt->{op} eq "overlap" ) {
if ( $chrs->has( $info->{chr} ) ) {
my $chr_single = $set_single->{ $info->{chr} };
if ( $chr_single->intersect($cur_positions)->is_not_empty ) {
printf {$out_fh} "%s\n", App::RL::Common::encode_header($info);
}
}
}
if ( $opt->{op} eq "non-overlap" ) {
if ( $chrs->has( $info->{chr} ) ) {
my $chr_single = $set_single->{ $info->{chr} };
if ( $chr_single->intersect($cur_positions)->is_empty ) {
printf {$out_fh} "%s\n", App::RL::Common::encode_header($info);
t/03-merge.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help merge)] );
like( $result->stdout, qr{merge}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(merge)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(merge t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(merge t/I.yml t/II.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 5, 'line count' );
like( $result->stdout, qr{28547\-29194}, 'runlist exists' );
like( $result->stdout, qr{I:.+II:}s, 'chromosomes exist' );
done_testing();
t/04-cover.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help cover)] );
like( $result->stdout, qr{cover}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(cover)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(cover t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(cover t/S288c.txt -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 3, 'line count' );
unlike( $result->stdout, qr{S288c}, 'species names' );
unlike( $result->stdout, qr{1\-100}, 'covered' );
like( $result->stdout, qr{1\-150}, 'covered' );
done_testing();
t/05-compare.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help compare)] );
like( $result->stdout, qr{compare}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(compare)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(compare t/not_exists)] );
like( $result->error, qr{need two or more input files}, 'need infiles' );
$result = test_app( 'App::RL' => [qw(compare t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result
= test_app( 'App::RL' => [qw(compare --op intersect t/intergenic.yml t/repeat.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 17, 'line count' );
like( $result->stdout, qr{878539\-878709}, 'runlist exists' );
like( $result->stdout, qr{I:.+XVI:}s, 'chromosomes exist' );
$result = test_app( 'App::RL' => [qw(compare --op intersect --mk t/Atha.yml t/Atha.trf.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 16, 'line count' );
t/06-split.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help split)] );
like( $result->stdout, qr{split}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(split)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(split t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(split t/repeat.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 16, 'line count' );
like( $result->stdout, qr{\-\-\- "\-"}, 'runlist exists' );
like( $result->stdout, qr{\-\-\- 162831\-163399}, 'runlist exists' );
done_testing();
t/07-genome.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help genome)] );
like( $result->stdout, qr{genome}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(genome)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(genome t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(genome t/chr.sizes -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 17, 'line count' );
like( $result->stdout, qr{I\:\s+1\-230218}, 'first chromosome' );
done_testing();
t/08-span.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help span)] );
like( $result->stdout, qr{span}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(span)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(span t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(span t/brca2.yml --op cover -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{32316461\-32398770}, 'cover' );
$result = test_app( 'App::RL' => [qw(span t/brca2.yml --op fill -n 1000 -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{32325076\-32326613}, 'fill' );
t/09-combine.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help combine)] );
like( $result->stdout, qr{combine}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(combine)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(combine t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(combine t/Atha.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 3, 'line count' );
unlike( $result->stdout, qr{7232\,7384}, 'combined' );
$result = test_app( 'App::RL' => [qw(combine t/brca2.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{13\: 32316461\-32316527}, 'no changes' );
t/10-some.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help some)] );
like( $result->stdout, qr{some}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(some)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(some t/not_exists)] );
like( $result->error, qr{need two input files}, 'need infiles' );
$result = test_app( 'App::RL' => [qw(some t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(some t/Atha.yml t/Atha.list -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 7, 'line count' );
like( $result->stdout, qr{AT2G01008}, 'present' );
unlike( $result->stdout, qr{AT2G01021}, 'absent' );
done_testing();
t/11-stat.t view on Meta::CPAN
my $result = test_app( 'App::RL' => [qw(help stat -s t/chr.sizes)] );
like( $result->stdout, qr{stat}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(stat)] );
like( $result->error, qr{Mandatory parameter.+size}, 'need --size' );
$result = test_app( 'App::RL' => [qw(stat -s t/chr.sizes)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(stat -s t/chr.sizes t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app(
'App::RL' => [qw(stat t/intergenic.yml -s t/chr.sizes -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 18, 'line count' );
is( ( scalar( split ",", ( split( /\n/, $result->stdout ) )[1] ) ),
4, 'field count' );
like( $result->stdout, qr{all,12071326,1059702,}, 'result calced' );
$result = test_app(
t/12-stat2.t view on Meta::CPAN
my $result = test_app( 'App::RL' => [qw(help stat2 -s t/chr.sizes)] );
like( $result->stdout, qr{stat2}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(stat2)] );
like( $result->error, qr{Mandatory parameter.+size}, 'need --size' );
$result = test_app( 'App::RL' => [qw(stat2 -s t/chr.sizes)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(stat2 -s t/chr.sizes t/not_exists)] );
like( $result->error, qr{need two input files}, 'need infiles' );
$result = test_app( 'App::RL' => [qw(stat2 -s t/chr.sizes t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result
= test_app(
'App::RL' => [qw(stat2 --op intersect t/intergenic.yml t/repeat.yml -s t/chr.sizes -o stdout)]
);
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 18, 'line count' );
is( ( scalar( split ",", ( split( /\n/, $result->stdout ) )[1] ) ), 8, 'field count' );
like( $result->stdout, qr{36721}, 'sum exists' );
like( $result->stdout, qr{I.+XVI}s, 'chromosomes exist' );
t/13-position.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help position)] );
like( $result->stdout, qr{position}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(position)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(position t/not_exists)] );
like( $result->error, qr{need two.+input files}, 'need infiles' );
$result = test_app( 'App::RL' => [qw(position t/not_exists t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result
= test_app( 'App::RL' => [qw(position --op overlap t/intergenic.yml t/S288c.txt -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
unlike( $result->stdout, qr{S288c}, 'species names' );
like( $result->stdout, qr{21294\-22075}, 'covered' );
$result = test_app(
t/14-coverage.t view on Meta::CPAN
my $result = test_app( 'App::RL' => [qw(help coverage -s t/chr.sizes)] );
like( $result->stdout, qr{coverage}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(coverage)] );
like( $result->error, qr{Mandatory parameter.+size}, 'need --size' );
$result = test_app( 'App::RL' => [qw(coverage -s t/chr.sizes)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(coverage -s t/chr.sizes t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(coverage t/S288c.txt -s t/chr.sizes -m 1 -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 21, 'line count' );
unlike( $result->stdout, qr{S288c}, 'species names' );
unlike( $result->stdout, qr{1\-100}, 'covered' );
like( $result->stdout, qr{1\-150}, 'covered' );
$result = test_app( 'App::RL' => [qw(coverage t/S288c.txt -s t/chr.sizes -m 5 -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 23, 'line count' );
t/15-convert.t view on Meta::CPAN
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help convert)] );
like( $result->stdout, qr{convert}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(convert)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(convert t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(convert t/repeat.yml -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 28, 'line count' );
like( $result->stdout, qr{II:327069-327703}, 'first chromosome' );
done_testing();
use App::Cmd::Tester;
use App::RL;
my $result = test_app( 'App::RL' => [qw(help gff)] );
like( $result->stdout, qr{gff}, 'descriptions' );
$result = test_app( 'App::RL' => [qw(gff)] );
like( $result->error, qr{need .+input file}, 'need infile' );
$result = test_app( 'App::RL' => [qw(gff t/not_exists)] );
like( $result->error, qr{doesn't exist}, 'infile not exists' );
$result = test_app( 'App::RL' => [qw(gff t/NC_007942.gff -o stdout)] );
is( ( scalar grep {/\S/} split( /\n/, $result->stdout ) ), 2, 'line count' );
like( $result->stdout, qr{1\-152218}, 'runlist exists' );
like( $result->stdout, qr{NC_007942:}, 'chromosomes exist' );
{
my $t_path = Path::Tiny::path("t/")->absolute->stringify;
my $cwd = Path::Tiny->cwd;