Alternatively you will have to process things yourself, eg while( <> ) { $_ =~ s/[^atgcATGCNn]//g; $seq_string .=$_; } $new_seq = Bio::Seq->new( -seq => $seq_string, -id => 'myseqeunce');