Create a processor module that adds a reference to the sequence. In genbank this addition will result in an extra entry in the header section:
REFERENCE 1
AUTHORS <your name>
TITLE BITS/VIB Bioperl Training
JOURNAL Direct submission
Create the reference object in the process_all.pl script and pass that as an argument to the BITS::Training::SeqProcessor::Reference constructor.
Every sequence object in the stream will receive the same reference.
process_all.pl
|
#!/usr/bin/perl use strict; use Bio::SeqIO; use BITS::Training::SeqProcessor::Fuzzpro; use BITS::Training::SeqProcessor::Species; use BITS::Training::SeqProcessor::Reference; use Bio::Annotation::Reference; # io object to read in the fasta from 'proteins.fa' my $in = Bio::SeqIO->new(-format => 'fasta', -file => '< proteins.fa'); my $reference = Bio::Annotation::Reference->new( -title => 'BITS/VIB Bioperl Training', -location => 'Direct submission', -authors => '<your name>', ); my $fuzzpro = BITS::Training::SeqProcessor::Fuzzpro->new; my $taxon_processor = BITS::Training::SeqProcessor::Species->new('Saccharomyces cerevisiae'); my $ref_processor = BITS::Training::SeqProcessor::Reference->new($reference); # io object to write genbank to STDOUT my $out = Bio::SeqIO->new(-format => 'genbank', -fh => \*STDOUT); # for every sequence while (my $seq = $in->next_seq) { $fuzzpro->process_seq($seq); $taxon_processor->process_seq($seq); $ref_processor->process_seq($seq); $out->write_seq($seq); }
|
BITS::Training::SeqProcessor::Reference
|
package BITS::Training::SeqProcessor::Reference; use strict; sub new { my ($class, @args) = @_; my $self = {_ref => $args[0]}; bless $self; } sub process_seq { my ($self, $seq) = @_; my $collection = $seq->annotation; $collection->add_Annotation(reference => $self->{_ref}); # return sequence object return $seq; } 1;
|