diff phyloconversion/phylip2fasta.pl @ 0:5b9a38ec4a39 draft default tip

First commit of old repositories
author osiris_phylogenetics <ucsb_phylogenetics@lifesci.ucsb.edu>
date Tue, 11 Mar 2014 12:19:13 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phyloconversion/phylip2fasta.pl	Tue Mar 11 12:19:13 2014 -0700
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+
+my $infile = $ARGV[0];
+my $interlv = $ARGV[1];
+my $idlen = $ARGV[2];
+my $outfile = $ARGV[3];
+
+#open (OUT, ">$outfile");
+
+use strict;
+    use Bio::AlignIO;
+    use Bio::SimpleAlign;
+    #you can set the name length to something other than the default 10
+    #if you use a version of phylip (hacked) that accepts ids > 10
+    my $outstream = Bio::AlignIO->new(-format  => 'fasta',
+                                        -fh      => \*STDOUT );
+
+    # convert data from one format to another
+    my $phylipstream     =  Bio::AlignIO->new(-interleaved => $interlv,
+					  -format => 'phylip',
+					  -file => '<'.$infile,
+					  -idlength=>$idlen );
+  while( my $aln = $phylipstream->next_aln ) {
+        $outstream->write_aln($aln);
+    }
+