in reply to Count Occurrences of a string
Using Bioperl for easy scripts likes this is a good idea, because it allows you to very easily port your program to almost any sequence file format known to man.#!/usr/bin/perl -w use strict; use Bio::SeqIO; my @files = <*.seq>; my $pattern = '([AN]*)'; foreach my $file (@files) { my $seqio = Bio::SeqIO->new( -file => $file ); while ( my $seqobj = $seqio->next_seq() ) { my $raw_seq = $seqobj->seq(); my @length_of_matches; while ( $raw_seq =~ /$pattern/og ) { push @length_of_matches, length $1; } @length_of_matches = sort { $b <=> $a } @length_of_matches; print $length_of_matches[ 0 ], ' ', $file, "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Samples Help, Thank you
by MiamiGenome (Sexton) on Sep 10, 2003 at 14:38 UTC | |
by biosysadmin (Deacon) on Sep 10, 2003 at 14:58 UTC |