X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to extract a sequence from multifasta with range !

  • Public
By BioStar 2303 days ago
# filterfastarange.pl #!/usr/bin/perl use strict; use warnings; #perl filterfastarange.pl 301 600 contigs.fasta > contigs-gt300-lte600.fasta my $minlen = shift or die "Error: `minlen` parameter not provided\n"; my $maxlen = shift or die "Error: `maxlen` parameter not provided\n"; { local $/=">"; while(<>) { chomp; next unless /\w/; s/>$//gs; my @chunk = split /\n/; my $header = shift @chunk; my $seqlen = length join "", @chunk; print ">$_" if($seqlen >= $minlen and $seqlen <= maxlen); } local $/="\n"; }