comparison phyloconversion/uniprotfasta2phytab.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
comparison
equal deleted inserted replaced
-1:000000000000 0:5b9a38ec4a39
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use FindBin;
6 use lib "$FindBin::Bin/lib";
7 use Bio::DB::Fasta;
8 use Bio::SeqIO;
9 use Bio::Seq;
10
11 #inputs
12 my $infile=shift(@ARGV);
13 my $partition=shift(@ARGV);
14 #my $delpipes=shift(@ARGV);
15 my $species;
16
17 my $seqid;
18 # open infile fasta file
19 my $in_obj = Bio::SeqIO->new(-file => $infile, '-format' =>'fasta');
20
21 while (my $seq = $in_obj->next_seq() ) {
22 my $sequence = $seq->seq;
23 my @rawid = split(/\|/, $seq->id);
24 $seqid = $rawid[1];
25 # $seqid = $seq->id;
26
27 $sequence =~ s/\n//g;
28 $species = $seq->desc;
29 #species Name is after OS=
30 $species =~ s/.+OS\=//;
31 $species =~ s/.+OS\=//;
32 #species Name is before GN= sometimes PE=
33 $species =~ s/ GN\=.+//;
34 $species =~ s/ PE\=.+//;
35 $species =~ s/ /_/g;
36
37 print $species."\t".$partition."\t".$seqid."\t".$sequence."\n";
38 }