Skip to content

Commit

Permalink
add release version to bioseq and bioaln
Browse files Browse the repository at this point in the history
  • Loading branch information
Weigang Qiu authored and Weigang Qiu committed Feb 6, 2015
1 parent 0518290 commit 5fc7cc3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Descritpion
bp-utils are command-line utilities that are wrappers of popular BioPerl classes (e.g., Bio::SeqIO, Bio::Seq; Bio::SimpleAlign). The motivation is to relieve BioPerl users from writing full-blown scripts for routine manipulations of sequences, alignments, trees, and others. For common operations of sequences and alignments, bp-utils make it easy to create workflows with a single BASH script containing a combination of bp-utils calls (and no Perl or BioPerl coding is necessary).
bp-utils are command-line utilities that are wrappers of popular BioPerl classes (Bio::SeqIO, Bio::Seq, Bio::AlignIO, Bio::SimpleAlign, etc). The motivation is to relieve BioPerl users from writing full-blown scripts for routine manipulations of sequences, alignments, trees, and others. For common operations of sequences and alignments, bp-utils make it easy to create workflows with a single BASH script containing a combination of bp-utils calls (and no Perl or BioPerl coding is necessary).

Internally, bp-utils follow a "Wrap, don't Write" design principle. That is, we have full faith in the robustness of the BioPerl development framework. As such, bp-utils methods should ALL be wrappers to BioPerl methdos so that exceptions can be handled properly by BioPerl.

Expand Down
1 change: 1 addition & 0 deletions bioaln
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ GetOptions(
"shuffle-sites|S",
"third-sites|T",
"uppercase|U", # make upper case (for DNAStatistics)
"version|V",
# "dnadist|D=s", # Needs fixing
# "inform|Z", Retired for now
) or pod2usage(2);
Expand Down
2 changes: 2 additions & 0 deletions bioseq
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use 5.010;
use Getopt::Long qw(:config gnu_getopt);
use Pod::Usage;

my $RELEASE = '1.0';
#########################################################################
# Option parsing
#########################################################################
Expand Down Expand Up @@ -38,6 +39,7 @@ GetOptions(
"hydroB|H",
"linearize|L",
"reloop|R=i", # recircularize a genome at "loop_at"
"version|V",
"removestop|X", # for PAML/codeml
# "longest-orf|C", Retired for now
# "extract|e", Retired for now
Expand Down
13 changes: 11 additions & 2 deletions lib/AlnManipulations.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if ($ENV{'DEBUG'}) {

# Package global variables
my ($in, $out, $aln, %opts, $file, $in_format, $out_format, @alns);
my $RELEASE = '1.0';

## For new options, just add an entry into this table with the same key as in
## the GetOpts function in the main program. Make the key be a reference to
Expand Down Expand Up @@ -54,8 +55,9 @@ my %opt_dispatch = (
"pep2dna" => \&protein_to_dna,
"resample" => \&sample_seqs,
"shuffle-sites" => \&shuffle_sites,
"third-sites" => \&third_sites,
"uppercase" => \&upper_case,
"third-sites" => \&third_sites,
"uppercase" => \&upper_case,
"version" => \&print_version,
);

##################### initializer & option handlers ###################
Expand All @@ -73,6 +75,8 @@ sub initialize {

$in_format = $opts{"input"} || $default_format;

if ($opts{"version"}) { &print_version(); exit }

if ($opts{"concat"}) {
while ( $file = shift @ARGV ) {
$in = Bio::AlignIO->new(-file => $file, -format => $in_format);
Expand Down Expand Up @@ -541,6 +545,11 @@ sub upper_case {
$aln->uppercase();
}

sub print_version {
say "bp-utils release version: ", $RELEASE;
}


########################## internal subroutine #######################

# For use in draw_codon_view
Expand Down
6 changes: 6 additions & 0 deletions lib/SeqManipulations.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if ($ENV{'DEBUG'}) { use Data::Dumper }

# Package global variables
my ($in, $out, $seq, %opts, $filename, $in_format, $out_format);
my $RELEASE = '1.0';

## For new options, just add an entry into this table with the same key as in
## the GetOpts function in the main program. Make the key be a reference to the handler subroutine (defined below), and test that it works.
Expand All @@ -46,6 +47,7 @@ my %opt_dispatch = (
'hydroB' => \&hydroB,
'linearize' => \&linearize,
'reloop' => \&reloop_at,
'version' => \&print_version,
'removestop' => \&remove_stop,
# 'dotplot' => \&draw_dotplot,
# 'extract' => \&reading_frame_ops,
Expand Down Expand Up @@ -325,6 +327,10 @@ sub reloop_at {
$out->write_seq($new_seq)
}

sub print_version {
say "bp-utils release version: ", $RELEASE;
}

sub remove_stop {
my $myCodonTable = Bio::Tools::CodonTable->new();
while ($seq = $in->next_seq()) {
Expand Down

0 comments on commit 5fc7cc3

Please sign in to comment.