How (and where) to learn the basics of Bioperl?
1
1
Entering edit mode
10.5 years ago
Mohamed ▴ 70

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

bioperl perl • 4.5k views
ADD COMMENT
1
Entering edit mode

first, learn perl. http://www.perl.org/learn.html

ADD REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
10.5 years ago
Medhat 9.8k

Hi and welcome,

First as suggested in the comment you should begin with Perl that will be much easier because you will learn the syntax,

so you can begin with this post here

A: How To Initiate Learning Perl?

Interactive Perl Learning

and It will cover both learning Perl and bioperl.

a way from this I have an advice for you If you are totally beginner and you just want to learn any programming language I highly recommend you to learn Python instead of Perl for different reasons,I will say it if you accept the suggestion :)

ADD COMMENT
0
Entering edit mode

I second this.

Python has much clearer syntax, and has none of these strange '$', '=>' signs which only hamper your real goal, and that is bioinformatic analysis.

Python also has bioinf module, BioPython. (http://biopython.org/DIST/docs/tutorial/Tutorial.html)

ADD REPLY
0
Entering edit mode

yup ! +1 for Python. On top it has smaller learning curve.

ADD REPLY
0
Entering edit mode

Trust me, people achieved the goal of bioinformatic analysis using Perl for many years before Python became the golden child. I'm not arguing for or against either of them, but I think many students completely lack any historical context.

ADD REPLY
0
Entering edit mode

I totally agree I am a Java programmer not python one, so Java teaches you many discipline from syntax and hard coding and of course OOP, But as you know for small tasks I think I do not need to right classes and overload methods I will simply use python but with out my background really I would be lost in understanding the programming paradigm, So what is you suggestion for new comers to programming field?

ADD REPLY

Login before adding your answer.

Traffic: 1658 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6