diff phyloconversion/raxify_fasta.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/raxify_fasta.pl	Tue Mar 11 12:19:13 2014 -0700
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $infile = $ARGV[0];
+my $outfile = $ARGV[1];
+
+open(IN, "$infile") or exit;
+open(OUT, ">$outfile") or exit;
+
+while (<IN>) {
+	my $line = $_;
+	if($line =~ m/\>/ ){
+		$line=raxify($line);
+	}
+	if($line =~ m/\n/){
+		print OUT $line;
+	}else{
+		print OUT $line."\n";
+	}
+}
+close(IN);
+close(OUT);
+
+sub raxify
+{
+	my $raxline = shift;
+	$raxline = substr($raxline,0,51);
+	$raxline =~ s/\./_/g;
+	$raxline =~ s/\|/_/g;
+	$raxline =~ s/ /_/g;
+	return $raxline;
+}