uniprot_dat2tsv.pl 461 B

12345678910111213141516171819
  1. #!/bin/perl -w
  2. open IN,"gzip -dc $ARGV[0] |";
  3. local $/="//\n";
  4. while(<IN>){
  5. chomp;
  6. my ($AC, $entry_id, $goid) = ("-","-","-");
  7. ($AC)=$_=~/\nAC ([^;]+)/;
  8. ($entry_id)=$_=~/\nDR GeneID; (\d+)/ if /\nDR GeneID;/;
  9. if(/\nDR GO; GO:\d+/){
  10. my @go=$_=~/\nDR GO; (GO:\d+)/g ;
  11. my %hash;
  12. my @unique = grep { !$hash{$_}++ } @go;
  13. $goid=join(";",@unique);
  14. }
  15. print "$AC\t$entry_id\t$goid\n";
  16. }
  17. close IN;