Created
April 26, 2016 06:06
-
-
Save slavailn/81ad90ddd25b8816d3f640e9cca2e7e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
# Universal? bioperl format converter | |
use strict; use warnings; | |
use Bio::SeqIO; | |
use Getopt::Long; | |
my $usage = "format_converter.pl --in-file <input_file> --in-format <input_file_format> --out-file <output_file> --out-format <output_file_format>\n"; | |
my $in_file; | |
my $in_format; | |
my $out_file; | |
my $out_format; | |
GetOptions( | |
'in-file=s' => \$in_file, | |
'in-format=s' => \$in_format, | |
'out-file=s' => \$out_file, | |
'out-format=s' => \$out_format, | |
) or die $usage; | |
my $seq_in = Bio::SeqIO->new( -file => "<$in_file", | |
-format => $in_format, ); | |
my $seq_out = Bio::SeqIO->new( -file => ">$out_file", | |
-format => $out_format, ); | |
while ( my $inseq = $seq_in->next_seq ) | |
{ | |
$seq_out->write_seq($inseq); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment