[BiO BB] program for sequence length

Dan Bolser dan.bolser at gmail.com
Fri May 7 03:44:54 EDT 2010


Here is a BioPerl script for one processing one fasta file [1]:

#!/usr/bin/perl -w

use strict;
use Bio::SeqIO;

my $seq_io_object = Bio::SeqIO->
  new( -file => @ARGV[0], -format => 'fasta' );

while(my $seq_object = $seq_io_object->next_seq){
  print $seq_object->id, "\t";
  print $seq_object->length, "\n";
}

warn "OK\n";


Run that over your 1000 files using bash...

for f in *.fasta; do
  echo $f
  my_bp_script.plx $f
done


(Untested!)

HTH,
Dan.

[1] For more info see http://www.bioperl.org/wiki/HOWTO:SeqIO


On 5 May 2010 10:16, Pankaj Khurana <pkhurana08 at gmail.com> wrote:
> Hi all,
>
> I have a few 1000 fasta files. I would like to get the list showing the
> sequence name and their respective lengths.
> Is there a program for this?
> I can write one but why reinvent the wheel.
> Thanking all in advance
>
> Regards,
> Pankaj
> _______________________________________________
> BBB mailing list
> BBB at bioinformatics.org
> http://www.bioinformatics.org/mailman/listinfo/bbb
>




More information about the BBB mailing list