Skip to content
Snippets Groups Projects
Commit 92a81fba authored by Kevin Howe's avatar Kevin Howe
Browse files

Accommodated change of SWISSPROT and SPTREMBL to Uniprot/SWISSPROT and

Uniprot/SPTREMBL and added support for tetraodon. For what it's worth.
parent a1524b4e
No related branches found
No related tags found
No related merge requests found
......@@ -220,12 +220,14 @@ $s_min /= 100.0;
my %r;
while (defined(my $line = <$in>)) {
# Perl script to calculate the percentage of identity
# and reformat cigar lines. Takes tab-delimited list in
# specific format from exonerate as input on stdin and
# writes comma-separated output to stdout.
next if (($line =~ /^Message:/) || ($line =~ /^--/));
next if $line !~ /\S+/;
next if (($line =~ /^Message:/) || ($line =~ /^Command line:/) || ($line =~ /^--/));
chomp($line);
# Pick out the individual fields (variable names correspond to
......
......@@ -201,6 +201,21 @@ if ($organism eq "fugu") {
}
if ($organism eq "tetraodon") {
$check{'sptr_swiss'} = $conf{'sptr_swiss'};
$check{'x_map_out'} = $conf{'x_map_out'};
foreach my $k (keys %check) {
print STDERR $check{$k}."\n";
if ($check{$k} !~ /(\S+)/) {
usage();
}
}
}
#End of check
if ((!defined $organism) || (!defined $sptr_swiss) || (!defined $out)) {
......@@ -630,9 +645,9 @@ sub process_parsed_sp{
die "you have no data tag can't decide if data is from swissprot or trembl for id ".$id." ac ".$ac." entry ".$entry."\n"
}
if($tag =~ /STANDARD/){
$db = 'SWISSPROT';
$db = 'Uniprot/SWISSPROT';
}elsif($tag =~ /PRELIMINARY/){
$db = 'SPTREMBL';
$db = 'Uniprot/SPTREMBL';
}elsif ($tag =~ /Prediction-SPTREMBL/){
$db = 'prediction-SPTREMBL';
}else {
......
......@@ -27,7 +27,7 @@ my $dbname = $conf{'db'};
my $host = $conf{'host'};
my $user = $conf{'dbuser'};
my $pass = $conf{'password'};
my $port = $conf{'port'};
my $port = $conf{'port'};
my $organism = $conf{'organism'};
my %priority;
......@@ -37,9 +37,12 @@ $priority{'MarkerSymbol'} = 1000;
$priority{'wormbase_transcript'} = 1000;
$priority{'flybase_symbol'} = 1000;
$priority{'Anopheles_symbol'} = 1000;
$priority{'SWISSPROT'} = 900;
$priority{'Genoscope_annotated_gene'} = 1000;
$priority{'Genoscope_predicted_transcript'} = 1000;
$priority{'Genoscope_predicted_gene'} = 999;
$priority{'Uniprot/SWISSPROT'} = 900;
$priority{'RefSeq'} = 800;
$priority{'SPTREMBL'} = 700;
$priority{'Uniprot/SPTREMBL'} = 700;
$priority{'LocusLink'} = 100;
......@@ -64,6 +67,7 @@ my $transadaptor = $db->get_TranscriptAdaptor();
my $geneadaptor = $db->get_GeneAdaptor();
my $xrefadaptor = $db->get_DBEntryAdaptor();
if (0) {
my $query = "select transcript_id from transcript";
my $sth = $db->prepare($query);
$sth->execute();
......@@ -87,38 +91,14 @@ while(my $id = $sth->fetchrow) {
$trans->display_xref($display);
$transadaptor->update($trans);
}
}
print STDERR "Done\n";
print STDERR "Getting gene display_xref_id\n";
if ($organism ne "elegans") {
my $query1 = "select gene_id from gene";
my $sth1 = $db->prepare($query1);
$sth1->execute();
while(my $gene_id = $sth1->fetchrow) {
my $gene = $geneadaptor->fetch_by_dbID($gene_id);
my $transcripts = $gene->get_all_Transcripts();
my $display;
my $current;
TRANS:foreach my $trans(@$transcripts) {
my $xref = $transadaptor->get_display_xref($trans);
if(!$xref){
next TRANS;
}
if ($priority{$xref->database} > $current) {
$display = $xref;
$current = $priority{$xref->database};
}
}
$gene->display_xref($display);
$geneadaptor->update($gene);
}
}
#Not sure id it is really needed if wormbase_gene is put in the priority list... Laura?
elsif ($organism eq "elegans") {
if ($organism eq "elegans") {
my $query1 = "select g.gene_id, x.xref_id from gene_stable_id g, xref x, external_db e where g.stable_id = x.display_label and x.external_db_id = e.external_db_id and e.db_name = 'wormbase_gene'";
my $sth1 = $db->prepare($query1);
$sth1->execute();
......@@ -129,8 +109,8 @@ elsif ($organism eq "elegans") {
$gene->display_xref($xref_obj);
$geneadaptor->update($gene);
}
my $query1 = "select g.gene_id, x.xref_id from gene_stable_id g, xref x, external_db e where g.stable_id = x.display_label and x.external_db_id = e.external_db_id and e.db_name = 'wormbase_pseudogene'";
my $sth1 = $db->prepare($query1);
$query1 = "select g.gene_id, x.xref_id from gene_stable_id g, xref x, external_db e where g.stable_id = x.display_label and x.external_db_id = e.external_db_id and e.db_name = 'wormbase_pseudogene'";
$sth1 = $db->prepare($query1);
$sth1->execute();
while(my ($gene_id,$xref) = $sth1->fetchrow) {
......@@ -140,8 +120,8 @@ elsif ($organism eq "elegans") {
$geneadaptor->update($gene);
}
my $query1 = "select t.transcript_id, x.xref_id from transcript_stable_id t, xref x, external_db e where t.stable_id = x.display_label and x.external_db_id = e.external_db_id and e.db_name = 'wormbase_pseudogene'";
my $sth1 = $db->prepare($query1);
$query1 = "select t.transcript_id, x.xref_id from transcript_stable_id t, xref x, external_db e where t.stable_id = x.display_label and x.external_db_id = e.external_db_id and e.db_name = 'wormbase_pseudogene'";
$sth1 = $db->prepare($query1);
$sth1->execute();
while(my ($gene_id,$xref) = $sth1->fetchrow) {
......@@ -152,6 +132,55 @@ elsif ($organism eq "elegans") {
}
}
elsif ($organism eq "tetraodon") {
# switch the priorityies so that we now favour gene xrefs
$priority{'Genoscope_predicted_transcript'} = 999;
$priority{'Genoscope_predicted_gene'} = 1000;
my $query1 = "select gene_id, type from gene";
my $sth1 = $db->prepare($query1);
$sth1->execute();
while (my ($gene_id, $gene_type) = $sth1->fetchrow) {
my $gene = $geneadaptor->fetch_by_dbID($gene_id);
my $xrefs = $gene->get_all_DBLinks;
my $best_xref;
foreach my $xref (@$xrefs) {
if (not $best_xref or
$priority{$xref->database} > $priority{$best_xref->database}) {
$best_xref = $xref;
}
}
$gene->display_xref($best_xref);
$geneadaptor->update($gene);
}
}
else {
my $query1 = "select gene_id from gene";
my $sth1 = $db->prepare($query1);
$sth1->execute();
while(my $gene_id = $sth1->fetchrow) {
my $gene = $geneadaptor->fetch_by_dbID($gene_id);
my $transcripts = $gene->get_all_Transcripts();
my $display;
my $current;
TRANS:foreach my $trans(@$transcripts) {
my $xref = $transadaptor->get_display_xref($trans);
if(!$xref){
next TRANS;
}
if ($priority{$xref->database} > $current) {
$display = $xref;
$current = $priority{$xref->database};
}
}
$gene->display_xref($display);
$geneadaptor->update($gene);
}
}
print STDERR "Done\n";
......
......@@ -66,7 +66,7 @@ my %embl2sp;
my %errorflag;
my %ref_map_pred;
my $help = $conf{'help'};
$help = $conf{'help'};
print STDERR "$help\n";
......@@ -419,7 +419,7 @@ MAPPING: while (<MAP>) {
if (($a->xDB eq "SPTREMBL") || ($a->xDB eq "SWISSPROT") || ($a->xDB eq "RefSeq") || ($a->xDB eq "ANOSUB") || $a->xDB eq 'BRIGGSAE_HYBRID') {
if (($a->xDB eq "Uniprot/SPTREMBL") || ($a->xDB eq "Uniprot/SWISSPROT") || ($a->xDB eq "RefSeq") || ($a->xDB eq "ANOSUB") || $a->xDB eq 'BRIGGSAE_HYBRID') {
my $dbentry = Bio::EnsEMBL::IdentityXref->new
( -adaptor => $adaptor,
......@@ -431,7 +431,7 @@ MAPPING: while (<MAP>) {
$dbentry->status($a->stat);
if (($check eq "yes") && (($a->xDB eq "SPTREMBL") || ($a->xDB eq "SWISSPROT"))) {
if (($check eq "yes") && (($a->xDB eq "Uniprot/SPTREMBL") || ($a->xDB eq "Uniprot/SWISSPROT"))) {
if (($sp2embl{$a->xAC}) && ($ens2embl{$targetid})) {
......@@ -521,7 +521,7 @@ MAPPING: while (<MAP>) {
}
}
}
}
else {
......@@ -740,6 +740,65 @@ if ($organism eq "elegans") {
}
if ($organism eq "tetraodon") {
my $adaptor = $db->get_DBEntryAdaptor();
my $query = ("select tr.translation_id, ts.stable_id, gs.stable_id, ".
"g.type from transcript t, gene_stable_id gs, ".
"transcript_stable_id ts, gene g, translation tr ".
"where t.gene_id = gs.gene_id and ".
"t.transcript_id = ts.transcript_id and ".
"t.transcript_id = tr.transcript_id and ".
"t.gene_id = g.gene_id");
my $sth = $db->prepare($query);
$sth->execute();
while (my @res = $sth->fetchrow) {
my $transl_dbid = $res[0];
my $transc_stable_id = $res[1];
my $gene_stable_id = $res[2];
my $gene_type = $res[3];
my @xrefs = {
primary_id => $gene_stable_id,
display_id => $gene_stable_id,
};
if ($gene_type =~ /annotated/i) {
$xrefs[0]->{dbname} = "Genoscope_annotated_gene";
$xrefs[0]->{status} = "KNOWN";
} else {
$xrefs[0]->{dbname} = "Genoscope_predicted_gene";
$xrefs[0]->{status} = "XREF";
push @xrefs, {
dbname => "Genoscope_predicted_transcript",
primary_id => $transc_stable_id,
display_id => $transc_stable_id,
status => "XREF"
}
}
foreach my $xref (@xrefs) {
my $dbentry = Bio::EnsEMBL::DBEntry->new
( -adaptor => $adaptor,
-primary_id => $xref->{primary_id},
-display_id => $xref->{display_id},
-version => 1,
-release => 1,
-dbname => $xref->{dbname});
$dbentry->status($xref->{status});
$adaptor->store($dbentry,$transl_dbid,"Translation");
}
}
}
sub usage {
print STDERR <<HELP
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment