Skip to content

Commit

Permalink
rearrangenment fot stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
bretonics committed May 9, 2017
1 parent e97437a commit 8cd7ea4
Showing 1 changed file with 26 additions and 63 deletions.
89 changes: 26 additions & 63 deletions Bioinformatics/Seq.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,65 @@ package Bioinformatics::Seq;

use Exporter qw(import);
our @ISA = qw(Exporter);
our @EXPORT = qw(); #functions exported by default
our @EXPORT_OK = qw(); #functions for explicit export
our @EXPORT = qw(genbank2fasta);
our @EXPORT_OK = qw();

use strict; use warnings; use diagnostics; use feature qw(say);
use Carp;
use Bio::SeqIO;

# Own Modules (https://github.com/bretonics/Modules)
use MyConfig;

use Bio::SeqIO;

# ==============================================================================
#
# CAPITAN: Andres Breton
# FILE: Seq.pm
# LICENSE:
# USAGE: Manipulate sequences
# DEPENDENCIES: - BioPerl modules
#
# ==============================================================================

=head1 NAME
Seq -
Seq - package for sequence manipulation
=head1 SYNOPSIS
Creation:
use Seq;
use Bioinformatics::Seq;
=head1 DESCRIPTION
This module was designed for use in common sequence manipulation tasks.
=head1 EXPORTS
=head2 Default Behaviors
Exports subroutine by default
use Bioinformatics::Seq;
use Seq;
Exports 'genbank2fasta' function by default
=head2 Optional Behaviors
Seq::;
=head1 FUNCTIONS
=head2 genbank2fasta
Arg [1] :
Example :
Description:
Returntype :
Status :
=head2 sub
Arg [1] :
Example :
Description:
Arg [1] : Genbank file
Returntype :
Example : genbank2fasta($file.gb);
Status :
Description : Converts Genbank file to fasta file format
Returntype : Fasta file
=head1 COPYRIGHT AND LICENSE
Andres Breton © 2016
[LICENSE]
=head1 CONTACT
Please email comments or questions to Andres Breton me@andresbreton.com
=head1 SETTING PATH
If PERL5LIB was not set, do something like this:
use FindBin; use lib "$FindBin::RealBin/lib";
This finds and uses subdirectory 'lib' in current directoy as library location
Status : Stable
=cut
# ==============================================================================

#-------------------------------------------------------------------------------
# SUBS
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# $input = ($file.gb);
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -107,19 +70,19 @@ This finds and uses subdirectory 'lib' in current directoy as library location
# $output = ($file.fasta);
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub genbank2fasta {
my $filledUsage = 'Usage: genbank2fasta($file.gb);';
@_ == 1 or croak wrongNumberArguments(), $filledUsage;
my $filledUsage = 'Usage: genbank2fasta($file.gb);';
@_ == 1 or croak wrongNumberArguments(), $filledUsage;

my ($inFile) = @_;
my ($outFile) = $inFile =~ /(.*).gb/;
$outFile = $outFile . ".fasta";
my ($inFile) = @_;
my ($outFile) = $inFile =~ /(.*).gb/;
$outFile = $outFile . ".fasta";

my $seqIn = Bio::SeqIO->new(-file => $inFile, -format => 'genbank');
my $seqOut = Bio::SeqIO->new(-file => ">$outFile", -format => 'fasta');
my $seqIn = Bio::SeqIO->new( -file => $inFile, -format => 'genbank' );
my $seqOut = Bio::SeqIO->new( -file => ">$outFile", -format => 'fasta' );

while (my $seq = $seqIn->next_seq) {
$seqOut->write_seq($seq);
}
while (my $seq = $seqIn->next_seq) {
$seqOut->write_seq($seq);
}
}

=head1 COPYRIGHT AND LICENSE
Expand Down

0 comments on commit 8cd7ea4

Please sign in to comment.