Mercurial > repos > ucsb-phylogenetics > osiris_phylogenetics
view phyloconversion/fasta2phytab.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 source
#!/usr/bin/perl -w use strict; use FindBin; use lib "$FindBin::Bin/lib"; use Bio::DB::Fasta; use Bio::SeqIO; use Bio::Seq; #inputs my $infile=shift(@ARGV); my $species=shift(@ARGV); my $partition=shift(@ARGV); my $delpipes=shift(@ARGV); my $fromfasta; #for debugging xml input #print "$infile $species $partition $delpipes\n"; #exit; if($species eq "from fasta"){ $fromfasta=1; } my $seqid; # open infile fasta file my $in_obj = Bio::SeqIO->new(-file => $infile, '-format' =>'fasta'); #no warnings 'uninitialized'; #Was getting error on one fasta for uninitialized sequences. Never could track down why and used this as a workaround while (my $seq = $in_obj->next_seq() ) { my $sequence = $seq->seq; $seqid = $seq->id; if($delpipes eq 'yes'){ $seqid =~ s/\|/_/g; } if($fromfasta){ $species = $seqid; } $sequence =~ s/\n//g; print $species."\t".$partition."\t".$seqid."\t".$sequence."\n"; }