view concatenateMultiFasta.pl @ 0:640361a4d2ef draft default tip

Uploaded
author dcouvin
date Fri, 17 Sep 2021 19:23:57 +0000
parents
children
line wrap: on
line source

#!/usr/bin/perl -w
use strict;

################################################################
# Script allowing to concatenate multiFasta file,
# generating an output file containing a single sequence
################################################################

# example of use: perl concatenateMultiFasta.pl multiFasta_file.fasta
# other example:  perl concatenateMultiFasta.pl *.fasta

my @listFastaFiles = @ARGV;

foreach my $multiFasta ( @listFastaFiles ) {
        my $outFasta = 'concatenated_'.$multiFasta ;
        open(FILE,"<$multiFasta") || die ("Error opening $multiFasta $!");
        #open(OUT, '>', $outFasta) or die $!;
        print ">$outFasta\n";
        while (my $row = <FILE>) {
                chomp $row;
                if ($row=~m/^>/){
                }
                else{
                    print "$row\n";
                }
        }
}

close(FILE);
#close(OUT);