Qiang Lin
unread,Sep 6, 2011, 4:59:30 AM9/6/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bioinformatics_linq26
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # not running under
some shell
#===============================================================================
#
# NAME:
#
# AUTHOR: LinQiang
#
# COMMENT:Perl script template.
#
# VERSION:
#
#===============================================================================
# Include Modules
#===============================================================================
use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
#===============================================================================
# Global Variables Declaration
#===============================================================================
my %opts;
my $version=1.0;
my %name;
my %go;
#===============================================================================
# Argument Check
#===============================================================================
GetOptions(\%opts,"input=s","output=s","h");
&usage if (!(defined ($opts{input} and $opts{output})) || defined
$opts{h});
#===============================================================================
# Prototypes Section
#===============================================================================
#===============================================================================
# main()
#===============================================================================
open IN,$opts{input};
while (<IN>) {
chomp;
my @tt=split/\t/,$_;
next if $tt[3] eq "Seg";
next if $tt[3] eq "Coil";
my $id=$tt[0];
( $name{$id}=() and $go{$id}=() ) if !exists $name{$id};
my $method=$tt[3];
my $dsp=$tt[5];
my $fun=$tt[13];
$name{$id}.="[".$method."|".$dsp."]";
next unless $fun;
next unless $fun=~/\((GO\:\d+)\)/;
foreach ($fun=~/\((GO\:\d+)\)/g) {
$go{$id}.="$1|";
}
}
my %go2;
foreach (keys %go) {
my @tmp=split/\|/,$go{$_};
my %saw;
@saw{@tmp}=();
my $out=join("|",sort keys %saw);
$go2{$_}=$out;
}
open OUT1,">$opts{output}";
#open OUT2,">$opts{output}\.golist";
foreach (keys %name) {
print OUT1 "$_\tNA\t$name{$_}\n" if !exists $go2{$_};
print OUT1 "$_\t$go2{$_}\t$name{$_}\n" if exists $go2{$_};
}
sub usage{
print <<"USAGE";
Version $version
Usage:
$0 -input -output
options:
[REQUIRED]
-h help
-input inproscan output with raw format
USAGE
exit(1);
}
__END__