A
Adebiyi Marion
the error message is;
Can't modify concatenation (.) or string in scalar assignment at theScript.pl line 67, near ");"
theScript is as below;
use strict;
my $file = shift @ARGV;
open(FILE, "$file") or die "Cannot open file: $!";
while(<FILE>)
{
chomp;
my $gene = $_;
system("wget -O " . $gene . ".fasta
\"http://www.uniprot.org/uniprot/?query=gene:" . $gene .
"&format=fasta\"");
open(FASTA, $gene . ".fasta") or die "Cannot open FASTA file
$gene: $!";
my $sequence;
while(<FASTA>)
{
chomp;
$sequence .= $_ unless /^>/;
}
close FASTA;
system("wget -O " . $gene . ".out
\"http://web.expasy.org/cgi-bin/blast/blast.pl?sequence=\"" . $sequence
.. "\"&action=PlainText&protdb_section=HUMAN&showsc=3&showal=0\"");
open(BLAST, $gene . ".out") or die "Cannot open BLAST file
$gene: $!";
my $idMapping;
while(<BLAST>)
{
if (/^(sp|tr)\!([A-Z\d]+)/)
{
$idMapping .= $2 . " ";
}
}
close BLAST;
if ($idMapping)
{
open(OUT, ">$gene.up2ensembl") or die "Cannot open OUT
for writing: $!";
print OUT &getIdMappingResult($idMapping);
}
}
close FILE;
sub getIdMappingResult
{
my ($list) = (@_);
my $base = 'http://www.uniprot.org';
my $tool = 'mapping';
my $params = {
from => 'ACC',
to => 'ENSEMBL_ID',
format => 'tab',
query => $list
};
my $contact = '(e-mail address removed)'; # Please set your email address here to help
us debug in case of problems.
my $agent = LWP::UserAgent->new(agent => "libwww-perl $contact");
push @{$agent->requests_redirectable}, 'POST';
my $response = $agent->post("$base/$tool/", $params);
while (my $wait = $response->header('Retry-After')) {
print STDERR "Waiting ($wait) ; Query: $base/$tool/ ;
Parameters: ...\n";
sleep $wait;
$response = $agent->get($response->base);
}
$response->is_success ?
return $response->content :
die 'Failed, got ' . $response->status_line . ' for ' .
$response->request->uri . "\n";
}
My list can be attached asap if need be.
Marion
Can't modify concatenation (.) or string in scalar assignment at theScript.pl line 67, near ");"
theScript is as below;
use strict;
my $file = shift @ARGV;
open(FILE, "$file") or die "Cannot open file: $!";
while(<FILE>)
{
chomp;
my $gene = $_;
system("wget -O " . $gene . ".fasta
\"http://www.uniprot.org/uniprot/?query=gene:" . $gene .
"&format=fasta\"");
open(FASTA, $gene . ".fasta") or die "Cannot open FASTA file
$gene: $!";
my $sequence;
while(<FASTA>)
{
chomp;
$sequence .= $_ unless /^>/;
}
close FASTA;
system("wget -O " . $gene . ".out
\"http://web.expasy.org/cgi-bin/blast/blast.pl?sequence=\"" . $sequence
.. "\"&action=PlainText&protdb_section=HUMAN&showsc=3&showal=0\"");
open(BLAST, $gene . ".out") or die "Cannot open BLAST file
$gene: $!";
my $idMapping;
while(<BLAST>)
{
if (/^(sp|tr)\!([A-Z\d]+)/)
{
$idMapping .= $2 . " ";
}
}
close BLAST;
if ($idMapping)
{
open(OUT, ">$gene.up2ensembl") or die "Cannot open OUT
for writing: $!";
print OUT &getIdMappingResult($idMapping);
}
}
close FILE;
sub getIdMappingResult
{
my ($list) = (@_);
my $base = 'http://www.uniprot.org';
my $tool = 'mapping';
my $params = {
from => 'ACC',
to => 'ENSEMBL_ID',
format => 'tab',
query => $list
};
my $contact = '(e-mail address removed)'; # Please set your email address here to help
us debug in case of problems.
my $agent = LWP::UserAgent->new(agent => "libwww-perl $contact");
push @{$agent->requests_redirectable}, 'POST';
my $response = $agent->post("$base/$tool/", $params);
while (my $wait = $response->header('Retry-After')) {
print STDERR "Waiting ($wait) ; Query: $base/$tool/ ;
Parameters: ...\n";
sleep $wait;
$response = $agent->get($response->base);
}
$response->is_success ?
return $response->content :
die 'Failed, got ' . $response->status_line . ' for ' .
$response->request->uri . "\n";
}
My list can be attached asap if need be.
Marion