Mercurial > repos > dcouvin > concatenatemultifasta
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/concatenateMultiFasta.pl Fri Sep 17 19:23:57 2021 +0000 @@ -0,0 +1,30 @@ +#!/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);