Dear Mr./Mrs.,
I would like to learn how to write my own script in Bioperl. For example, I found the following script on some website to extract header fasta from fasta file:
#!/bin/env perl
use strict;
use warnings;
use Bio::SeqIO;
my $seq_in = Bio::SeqIO->new( -file => 'seq.txt', '-format' => 'Fasta' );
my $seq_out = Bio::SeqIO->new( -file => '>output.fas', '-format' => 'Fasta' );
while ( my $seq = $seq_in->next_seq ) {
my $shortened_seq = Bio::Seq->new(
-desc => $seq->desc,
-display_id => ( split /\|/, $seq->id )[-1]
);
$seq_out->write_seq($shortened_seq);
}
I wish to know why these characters are used. Why adding spaces. Why these arguments were used. (Why writing [-1]). So that I can create/invent a different approach. If it is already known to everyone, then pardon my ignorance. Kindly, if you can, provide a link so that I can follow it.
Best regards,
Mohamed
first, learn perl. http://www.perl.org/learn.html
Dear Pierre and medhat,
Many thanks for your kind and quick response. I will do as suggested. About learning Python, it will be a great opportunity to start learning it. However, I do believe that I'm not that talent to understand two languages. I only wish to focus on bioinformatics tools. But I guess your recommendation sound good. I will see and try it IN SHAA ALLAH.
Best regards,
Mohamed