App-Fasops

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "operating blocked fasta files",
   "author" : [
      "Qiang Wang <wang-q@outlook.com>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Minilla/v3.1.5",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'operating blocked fasta files'
author:
  - 'Qiang Wang <wang-q@outlook.com>'
build_requires:
  Spreadsheet::XLSX: '0.15'
  Test::More: '0.88'
  Test::Number::Delta: '1.06'
configure_requires:
  Module::Build::Tiny: '0.035'
dynamic_config: 0
generated_by: 'Minilla/v3.1.5, CPAN::Meta::Converter version 2.150010'

README.md  view on Meta::CPAN

[![Build Status](https://travis-ci.org/wang-q/App-Fasops.svg?branch=master)](https://travis-ci.org/wang-q/App-Fasops) [![Coverage Status](http://codecov.io/github/wang-q/App-Fasops/coverage.svg?branch=master)](https://codecov.io/github/wang-q/App-Fas...
# NAME

App::Fasops - operating blocked fasta files

# SYNOPSIS

    fasops <command> [-?h] [long options...]
            -? -h --help  show help

    Available commands:

       commands: list the application's commands
           help: display a command's help screen

        axt2fas: convert axt to blocked fasta
          check: check genome locations in (blocked) fasta headers
         concat: concatenate sequence pieces in blocked fasta files
      consensus: create consensus from blocked fasta file
         covers: scan blocked fasta files and output covers on chromosomes
           join: join multiple blocked fasta files by common target
          links: scan blocked fasta files and output bi/multi-lateral range links
        maf2fas: convert maf to blocked fasta
       mergecsv: merge csv files based on @fields
          names: scan blocked fasta files and output all species names
         refine: realign blocked fasta file with external programs
        replace: replace headers from a blocked fasta
       separate: separate blocked fasta files by species
          slice: extract alignment slices from a blocked fasta
          split: split blocked fasta files to per-alignment files
           stat: basic statistics on alignments
         subset: extract a subset of species from a blocked fasta
           xlsx: paint substitutions and indels to an excel file

See `fasops commands` for usage information.

# AUTHOR

Qiang Wang <wang-q@outlook.com>

# COPYRIGHT AND LICENSE

lib/App/Fasops.pm  view on Meta::CPAN

use strict;
use warnings;
use App::Cmd::Setup -app;

1;

__END__

=head1 NAME

App::Fasops - operating blocked fasta files

=head1 SYNOPSIS

    fasops <command> [-?h] [long options...]
            -? -h --help  show help

    Available commands:

       commands: list the application's commands
           help: display a command's help screen

        axt2fas: convert axt to blocked fasta
          check: check genome locations in (blocked) fasta headers
         concat: concatenate sequence pieces in blocked fasta files
      consensus: create consensus from blocked fasta file
         covers: scan blocked fasta files and output covers on chromosomes
           join: join multiple blocked fasta files by common target
          links: scan blocked fasta files and output bi/multi-lateral range links
        maf2fas: convert maf to blocked fasta
       mergecsv: merge csv files based on @fields
          names: scan blocked fasta files and output all species names
         refine: realign blocked fasta file with external programs
        replace: replace headers from a blocked fasta
       separate: separate blocked fasta files by species
          slice: extract alignment slices from a blocked fasta
          split: split blocked fasta files to per-alignment files
           stat: basic statistics on alignments
         subset: extract a subset of species from a blocked fasta
           xlsx: paint substitutions and indels to an excel file


See C<fasops commands> for usage information.

=head1 AUTHOR

Qiang Wang <wang-q@outlook.com>

=head1 COPYRIGHT AND LICENSE

lib/App/Fasops/Command/axt2fas.pm  view on Meta::CPAN

package App::Fasops::Command::axt2fas;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'convert axt to blocked fasta';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename, [stdout] for screen" ],
        [ "length|l=i", "the threshold of alignment length", { default => 1 }, ],
        [ "tname|t=s",  "target name",                       { default => "target" }, ],
        [ "qname|q=s",  "query name",                        { default => "query" }, ],
        [ "size|s=s",   "query chr.sizes", ],
        { show_defaults => 1, }

lib/App/Fasops/Command/check.pm  view on Meta::CPAN

use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;


sub abstract {
    return 'check genome locations in (blocked) fasta headers';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen." ],
        [ "name|n=s",    "Which species to be checked, omit this will check all sequences" ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/concat.pm  view on Meta::CPAN

package App::Fasops::Command::concat;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'concatenate sequence pieces in blocked fasta files';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "total|t=i", "Stop when exceed this length", { default => 10_000_000, }, ],
        [ "relaxed",   "output relaxed phylip instead of fasta" ],
        { show_defaults => 1, }
    );
}

sub usage_desc {
    return "fasops concat [options] <infile> <name.list>";
}

sub description {
    my $desc;
    $desc .= ucfirst(abstract) . ".\n";
    $desc .= <<'MARKDOWN';

* <infile> is the path to blocked fasta file, .fas.gz is supported
* infile == stdin means reading from STDIN
* <name.list> is a file with a list of names to keep, one per line
* Names in the output file will following the order in <name.list>

MARKDOWN

    return $desc;
}

sub validate_args {

lib/App/Fasops/Command/consensus.pm  view on Meta::CPAN


use MCE;
use MCE::Flow Sereal => 1;
use MCE::Candy;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'create consensus from blocked fasta file';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "output filename. [stdout] for screen" ],
        [ "outgroup",    "has outgroup at the end of blocks", ],
        [ "cname",        "the name of consensus", { default => "consensus" }, ],
        [ "parallel|p=i", "run in parallel mode",  { default => 1 }, ],
        { show_defaults => 1, }
    );

lib/App/Fasops/Command/consensus.pm  view on Meta::CPAN


sub usage_desc {
    return "fasops consensus [options] <infile>";
}

sub description {
    my $desc;
    $desc .= ucfirst(abstract) . ".\n";
    $desc .= <<'MARKDOWN';

* <infile> are paths to blocked fasta files, .fas.gz is supported
* infile == stdin means reading from STDIN
* `poa` is used for creating consensus sequences

MARKDOWN

    return $desc;
}

sub validate_args {
    my ( $self, $opt, $args ) = @_;

lib/App/Fasops/Command/covers.pm  view on Meta::CPAN

package App::Fasops::Command::covers;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::Fasops::Common;

sub abstract {
    return 'scan blocked fasta files and output covers on chromosomes';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "name|n=s",    "Only output this species" ],
        [ "length|l=i", "the threshold of alignment length", { default => 1 } ],
        [   "trim|t=i",
            "Trim align borders to avoid some overlaps in lastz results",
            { default => 0 }

lib/App/Fasops/Command/create.pm  view on Meta::CPAN

package App::Fasops::Command::create;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'create blocked fasta files from links of ranges';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "genome|g=s",  "Reference genome file", { required => 1 }, ],
        [ "name|n=s",    "Default name for ranges", ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/join.pm  view on Meta::CPAN

package App::Fasops::Command::join;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'join multiple blocked fasta files by common target';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "name|n=s",    "According to this species. Default is the first one" ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/links.pm  view on Meta::CPAN

package App::Fasops::Command::links;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'scan blocked fasta files and output bi/multi-lateral range links';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen." ],
        [ "pair|p",      "pairwise links" ],
        [ "best|b",      "best-to-best pairwise links" ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/maf2fas.pm  view on Meta::CPAN

package App::Fasops::Command::maf2fas;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'convert maf to blocked fasta';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "length|l=i", "the threshold of alignment length", { default => 1 } ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/names.pm  view on Meta::CPAN

package App::Fasops::Command::names;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::Fasops::Common;

sub abstract {
    return 'scan blocked fasta files and output all species names';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "count|c",     "Also count name occurrences" ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/refine.pm  view on Meta::CPAN


use MCE;
use MCE::Flow Sereal => 1;
use MCE::Candy;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'realign blocked fasta file with external programs';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "outgroup",    "Has outgroup at the end of blocks", ],
        [ "parallel|p=i", "run in parallel mode", { default => 1 }, ],
        [ "msa=s",        "Aligning program",     { default => "mafft" }, ],
        [   "quick",
            "Quick mode, only aligning indel adjacent regions. Suitable for multiz outputs",

lib/App/Fasops/Command/refine.pm  view on Meta::CPAN

sub description {
    my $desc;
    $desc .= ucfirst(abstract) . ".\n";
    $desc .= <<'MARKDOWN';

* List of msa:
    * mafft
    * muscle
    * clustalw
    * none: means skip realigning
* <infile> are paths to blocked fasta files, .fas.gz is supported
* infile == stdin means reading from STDIN

MARKDOWN

    return $desc;
}

sub validate_args {
    my ( $self, $opt, $args ) = @_;

lib/App/Fasops/Command/replace.pm  view on Meta::CPAN

package App::Fasops::Command::replace;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'replace headers from a blocked fasta';
}

sub opt_spec {
    return ( [ "outfile|o=s", "Output filename. [stdout] for screen." ], { show_defaults => 1, } );
}

sub usage_desc {
    return "fasops replace [options] <infile> <replace.tsv>";
}

lib/App/Fasops/Command/separate.pm  view on Meta::CPAN

package App::Fasops::Command::separate;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'separate blocked fasta files by species';
}

sub opt_spec {
    return (
        [ "outdir|o=s", "Output location, [stdout] for screen", { default => '.' } ],
        [ "suffix|s=s", "Extensions of output files",           { default => '.fasta' } ],
        [ "rm|r",       "If outdir exists, remove it before operating" ],
        [ "rc",         "Revcom sequences when chr_strand is '-'" ],
        [ "nodash",     "Remove dashes ('-') from sequences" ],
        { show_defaults => 1, }

lib/App/Fasops/Command/slice.pm  view on Meta::CPAN

package App::Fasops::Command::slice;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'extract alignment slices from a blocked fasta';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen." ],
        [ "name|n=s",    "According to this species. Default is the first one." ],
        [ "length|l=i", "the threshold of alignment length", { default => 1 } ],
        { show_defaults => 1, }
    );
}

lib/App/Fasops/Command/split.pm  view on Meta::CPAN

package App::Fasops::Command::split;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'split blocked fasta files to per-alignment files';
}

sub opt_spec {
    return (
        [ "outdir|o=s", "Output location, [stdout] for screen" ],
        [ "rm|r",       "if outdir exists, remove it before operating." ],
        [ "chr",        "split by chromosomes." ],
        [ "simple",     "only keep names in headers" ],
        { show_defaults => 1, }
    );

lib/App/Fasops/Command/split.pm  view on Meta::CPAN


sub usage_desc {
    return "fasops split [options] <infile> [more infiles]";
}

sub description {
    my $desc;
    $desc .= ucfirst(abstract) . ".\n";
    $desc .= <<'MARKDOWN';

* <infiles> are paths to blocked fasta files, .fas.gz is supported
* infile == stdin means reading from STDIN

MARKDOWN

    return $desc;
}

sub validate_args {
    my ( $self, $opt, $args ) = @_;

lib/App/Fasops/Command/subset.pm  view on Meta::CPAN

package App::Fasops::Command::subset;
use strict;
use warnings;
use autodie;

use App::Fasops -command;
use App::RL::Common;
use App::Fasops::Common;

sub abstract {
    return 'extract a subset of species from a blocked fasta';
}

sub opt_spec {
    return (
        [ "outfile|o=s", "Output filename. [stdout] for screen" ],
        [ "first",       "Always keep the first species" ],
        [ "required",    "Skip blocks not containing all the names" ],
        { show_defaults => 1, }
    );
}

sub usage_desc {
    return "fasops subset [options] <infile> <name.list>";
}

sub description {
    my $desc;
    $desc .= ucfirst(abstract) . ".\n";
    $desc .= <<'MARKDOWN';

* <infile> is the path to blocked fasta file, .fas.gz is supported
* infile == stdin means reading from STDIN
* <name.list> is a file with a list of names to keep, one per line
* Names in the output file will following the order in <name.list>

MARKDOWN

    return $desc;
}

sub validate_args {



( run in 1.487 second using v1.01-cache-2.11-cpan-49f99fa48dc )