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

Annotation of /FigKernelScripts/align_fasta.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : golsen 1.3 #! /usr/bin/perl -w
2 : olson 1.2 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 : golsen 1.3 # Align sequeneces with clustalw or muscle and output in fasta.
19 :     #
20 : olson 1.2
21 : golsen 1.1 use strict;
22 : golsen 1.3 use gjoseqlib;
23 :     use gjoalignment;
24 : golsen 1.1
25 : golsen 1.3 my $usage = <<'End_of_Usage';
26 :     Align fasta format sequences
27 : golsen 1.1
28 : golsen 1.3 Usage: align_fasta [options] fasta-file > aligned
29 :     align_fasta [options] < fasta-file > aligned
30 : golsen 1.1
31 : golsen 1.3 Options:
32 : golsen 1.1
33 : golsen 1.3 -c # Align with clustalw (D)
34 :     -m # Align with muscle
35 : golsen 1.1
36 : golsen 1.3 End_of_Usage
37 : golsen 1.1
38 : golsen 1.3 my $prog = 'clustal';
39 : golsen 1.1
40 : golsen 1.3 while ( @ARGV && $ARGV[0] =~ s/^-// )
41 :     {
42 :     local $_ = shift;
43 :     if ( s/c//g ) { $prog = 'clustal' }
44 :     if ( s/m//g ) { $prog = 'muscle' }
45 :     if ( m/./ ) { print STDERR "Bad flag '$_'.\n\n", $usage; exit }
46 : golsen 1.1 }
47 :    
48 : golsen 1.3 my @seqs = gjoseqlib::read_fasta( $ARGV[0] || \*STDIN );
49 : golsen 1.1
50 : golsen 1.3 @seqs or print STDERR "No input sequences.\n\n", $usage and exit;
51 : golsen 1.1
52 : golsen 1.3 my @align = @seqs < 2 ? @seqs
53 :     : $prog eq 'muscle' ? gjoalignment::align_with_muscle( \@seqs )
54 :     : gjoalignment::align_with_clustal( \@seqs );
55 : golsen 1.1
56 : golsen 1.3 gjoseqlib::print_alignment_as_fasta( @align );

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3