[Bio] / FigKernelScripts / reps_and_close.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/reps_and_close.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : overbeek 1.1 ########################################################################
2 :    
3 :     use strict;
4 :     use gjoseqlib;
5 :     use representative_sequences;
6 :    
7 :     my $usage = "usage: reps_and_close [-t TargetN] [-m MaxIden] Representatives Sets < Seqs";
8 :    
9 :     my $targetN = 50;
10 :     my $max_iden = 0.9;
11 :    
12 :     while ( $ARGV[0] =~ /^-/ )
13 :     {
14 :     $_ = shift;
15 :     if ( s/^-t// ) { $targetN = $_ || shift }
16 :     elsif ( s/^-m// ) { $max_iden = $_ || shift }
17 :     else
18 :     {
19 :     usage( "Bad command flag '$_'\n" );
20 :     }
21 :     }
22 :    
23 :     my($repfile,$setfile);
24 :     (($repfile = shift @ARGV) && open(REPS,">$repfile"))
25 :     || die $usage;
26 :    
27 :     (($setfile = shift @ARGV) && open(SETS,">$setfile"))
28 :     || die $usage;
29 :    
30 :     my $seqs = &gjoseqlib::read_fasta();
31 :     my($reps,$sets) = &representative_sequences::n_rep_seqs({ seqs => $seqs,
32 : overbeek 1.2 by_size => 1,
33 : overbeek 1.1 max_rep => $targetN,
34 :     max_iden => $max_iden
35 :     });
36 :     foreach my $tuple (@$reps)
37 :     {
38 :     &gjoseqlib::print_seq_as_fasta(\*REPS,@$tuple);
39 :     }
40 :     close(REPS);
41 :    
42 :     foreach my $id (keys(%$sets))
43 :     {
44 :     my $x = $sets->{$id};
45 :     print SETS "$id\t",join(",",@$x),"\n";
46 :     }
47 :    
48 :     sub usage
49 :     {
50 :     print STDERR join( "\n", @_, $usage );
51 :     exit;
52 :     }
53 :    
54 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3