maint: restructure to use Dist::Zilla
[bioperl-live.git] / bin / bp_seqretsplit
blob7184b275207d0809a9e4e467cc011ac65d02ae22
1 #!/usr/bin/perl
3 =head1 NAME
5 bp_seqretsplit - split a sequence (or stream) into a single file per sequence
7 =head1 SYNOPSIS
9 bp_seqretsplit file1 file2 ..
10 # or
11 bp_seqretsplit < file1
13 =head1 DESCRIPTION
15 The script will split all sequences from fasta file(s) (or stdin) to
16 individual files. The filename is the sequence ID (everything before
17 the 1st whitespace in a FASTA header). Currently it doesn't check to
18 see that it isn't overwriting an existing file so IDs should be unique
20 This is inspired by EMBOSS seqretsplit tool.
22 =head1 FEEDBACK
24 =head2 Mailing Lists
26 User feedback is an integral part of the evolution of this and other
27 Bioperl modules. Send your comments and suggestions preferably to
28 the Bioperl mailing list. Your participation is much appreciated.
30 bioperl-l@bioperl.org - General discussion
31 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
33 =head2 Reporting Bugs
35 Report bugs to the Bioperl bug tracking system to help us keep track
36 of the bugs and their resolution. Bug reports can be submitted via
37 email or the web:
39 https://github.com/bioperl/bioperl-live/issues
41 =head1 AUTHOR
43 Jason Stajich E<lt>jason_AT_bioperl_DOT_orgE<gt>
45 =cut
47 use strict;
48 use warnings;
49 use Bio::SeqIO;
50 my $in = Bio::SeqIO->new(-format => 'fasta',
51 -fh => \*ARGV);
52 while( my $s = $in->next_seq ) {
53 Bio::SeqIO->new(-format => 'fasta',
54 -file => ">".$s->id.".fa")->write_seq($s);