[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.1 - (view) (download) (as text)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3