[Bio] / FigMetagenomeTools / compare_fasta_seqs.pl Repository:
ViewVC logotype

Annotation of /FigMetagenomeTools/compare_fasta_seqs.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1 #!/usr/bin/perl -w
2 :    
3 :     use strict;
4 :     use Rob;
5 :    
6 :     my $f1 = shift || die "file1?";
7 :     my $f2 = shift || die "file2?";
8 :    
9 :     print STDERR "Reading $f1\n";
10 :     my $fa1=Rob->read_fasta($f1);
11 :     my $seq1; my $count;
12 :     map {$fa1->{$_} =~ s/\s+//g; $count->{uc($fa1->{$_})}++; $seq1->{uc($fa1->{$_})}=$_} keys %$fa1;
13 :     print "Duplicates in $f1\n";
14 :     map {print $seq1->{uc($fa1->{$_})}, "\n" if ($count->{$_} > 1)} keys %$count;
15 :     undef $count;
16 :    
17 :     print STDERR "Reading $f2\n";
18 :     my $fa2=Rob->read_fasta($f2);
19 :     my $seq2;
20 :     map {$fa2->{$_} =~ s/\s+//g; $seq2->{uc($fa2->{$_})}=$_; $count->{uc($fa2->{$_})}++} keys %$fa2;
21 :     print STDERR "THis should be: ", $count->{'ZXD'}, "\n";
22 :     print "Duplicates in $f2\n";
23 :     map {print $seq2->{uc($fa2->{$_})}, "\n" if ($count->{$_} > 1)} keys %$count;
24 :     undef $count;
25 :    
26 :     print "Sequences in $f1 that are NOT in $f2\n";
27 :     map {print $seq1->{$_}, "\n" unless ($seq2->{$_})} keys %$seq1;
28 :    
29 :     print "Sequences in $f2 that are NOT in $f1\n";
30 :     map {print $seq2->{$_}, "\n" unless ($seq1->{$_})} keys %$seq2;
31 :    
32 :     print "Keys in $f1 that are not in $f2\n";
33 :     map {print $_, "\n" unless ($fa2->{$_})} keys %$fa1;
34 :    
35 :     print "Keys in $f2 that are not in $f1\n";
36 :     map {print $_, "\n" unless ($fa1->{$_})} keys %$fa2;
37 :    
38 :    
39 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3