8 run_neighbor - run Phylip's 'protdist' program through Bioperl
12 run_protdist [-i inputfile] [-o outfilename]
16 Provide an alignment file to run protdist on. File should be named
17 either .aln or .phy. This is required so that we can determine if we
18 need to convert a clustalw alignment into phylip. You are welcome to
19 extend the script to work on other MSA formats which bioperl supports.
20 This is intended to be used in very simple manual pipelines.
22 The input file should be named in the form of file.phy or file.aln
23 the program expects a file in the form of (\S+)\.(\S+).
25 This will run the application 'protdist' using the 'KIMURA' formula to
26 build a a protein distance matrix. Those with phylip3.6 will want to
27 make some changes if they want to use JTT. I'm happy to help add this
28 in as a cmd-line argument if it is requested.
32 Jason Stajich, jason-AT-open-bio-DOT-org
37 use Bio
::Tools
::Run
::Phylo
::Phylip
::ProtDist
;
40 my @params = ( 'MODEL' => 'KIMURA',
49 'h|help' => sub { exec('perldoc',$0); exit(0) }
52 ($file) ||= shift @ARGV;
54 my ($stem,$ext) = ($file =~ /(\S+)\.(\S+)$/);
59 open($outfh, ">$out") || die($!);
61 open($outfh, ">$stem.matrix") || die($!);
65 my $inaln = new Bio
::AlignIO
(-file
=> $file,
66 -format
=> 'clustalw');
69 my $outreformat = new Bio
::AlignIO
(-file
=> ">$file",
72 while( my $aln = $inaln->next_aln ) {
73 $outreformat->write_aln($aln);
75 $outreformat->close();
80 my $factory = new Bio
::Tools
::Run
::Phylo
::Phylip
::ProtDist
(@params);
81 my (@matrix) = $factory->create_distance_matrix($file);
83 foreach my $mat ( @matrix ) {
84 print $outfh $mat->print_matrix;