Mercurial > repos > dcouvin > concatenatemultifasta
comparison concatenateMultiFasta.pl @ 0:640361a4d2ef draft default tip
Uploaded
author | dcouvin |
---|---|
date | Fri, 17 Sep 2021 19:23:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:640361a4d2ef |
---|---|
1 #!/usr/bin/perl -w | |
2 use strict; | |
3 | |
4 ################################################################ | |
5 # Script allowing to concatenate multiFasta file, | |
6 # generating an output file containing a single sequence | |
7 ################################################################ | |
8 | |
9 # example of use: perl concatenateMultiFasta.pl multiFasta_file.fasta | |
10 # other example: perl concatenateMultiFasta.pl *.fasta | |
11 | |
12 my @listFastaFiles = @ARGV; | |
13 | |
14 foreach my $multiFasta ( @listFastaFiles ) { | |
15 my $outFasta = 'concatenated_'.$multiFasta ; | |
16 open(FILE,"<$multiFasta") || die ("Error opening $multiFasta $!"); | |
17 #open(OUT, '>', $outFasta) or die $!; | |
18 print ">$outFasta\n"; | |
19 while (my $row = <FILE>) { | |
20 chomp $row; | |
21 if ($row=~m/^>/){ | |
22 } | |
23 else{ | |
24 print "$row\n"; | |
25 } | |
26 } | |
27 } | |
28 | |
29 close(FILE); | |
30 #close(OUT); |