Skip to content

Instantly share code, notes, and snippets.

@soh-i
Last active October 6, 2015 16:48
Show Gist options
  • Save soh-i/3023539 to your computer and use it in GitHub Desktop.
Save soh-i/3023539 to your computer and use it in GitHub Desktop.
Yeastgenome.orgから頑張ってUniprotIDに変換して配列とる
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
my $file = './list';
open my $fh, '<', $file or die "$!";
open my $out, ">>", "get_seq.fa" or die "$!";
while (my $id=<$fh>) {
my $sacchano_db = "http://www.yeastgenome.org/cgi-bin/locus.fpl\?locus\=$id";
my $data = get($sacchano_db);
unless (defined $data) {
print "$id\n";
print "Error: Cant get data from yeastgenome.org\n";
}
$data =~ /url\=http\:\/\/www\.uniprot\.org\/uniprot\/(\w+\d+)/;
my $uniprot = $1;
sleep 1;
unless (defined $uniprot) {
print "$id\n";
print "Error: Cant get data from togows\n";
}
my $swiss = "http://togows.dbcls.jp/entry/uniprot/$uniprot.fasta";
my $seq = get($swiss);
print $uniprot, "....finished\n";
print $out $seq;
sleep 1;
}
close $fh;
close $out;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment