Commit 4695066f authored by Glenn Proctor's avatar Glenn Proctor
Browse files

Now store external synonyms as additional fields rather than cross references.

parent 0fd869b8
......@@ -56,7 +56,7 @@ my @indexes = split ',', $ind;
@indexes = map { /dump(\w+)/ ? $1 : () } keys %ebi_search_dump::
if $ind eq 'ALL';
warn Dumper \@indexes;
#warn Dumper \@indexes;
my $dbHash = get_databases();
#warn Dumper $dbHash;
......@@ -353,7 +353,7 @@ sub familyLineXML {
}
sub dumpGene {
warn "in dumpGene";
my ( $dbspecies, $conf ) = @_;
foreach my $DB ( 'core', 'otherfeatures', 'vega' ) {
......@@ -406,6 +406,7 @@ warn "in dumpGene";
$xrefs{$type}{ $_->[0] }{ $_->[3] }{ $_->[2] } = 1 if $_->[2];
$xrefs{$type}{ $_->[0] }{ $_->[3] . "_synonym" }{ $_->[4] } = 1 if $_->[4];
$xrefs_desc{$type}{ $_->[0] }{ $_->[5] } = 1 if $_->[5];
}
warn "XREF $type query...";
......@@ -636,30 +637,52 @@ sub geneLineXML {
<name>$gene_id $altid</name>
<description>$description</description>};
my $synonyms = "";
my $cross_references = qq{
<cross_references>};
# for some types of xref, merge the subtypes into the larger type
# e.g. Uniprot/SWISSPROT and Uniprot/TREMBL become just Uniprot
# synonyms are stored as additional fields rather than cross references
foreach my $ext_db_name ( keys %$external_identifiers ) {
if ($ext_db_name =~ /(Uniprot|GO|Interpro|Medline|Sequence_Publications|EMBL)/) {
my $matched_db_name = $1;
# synonyms
if ($ext_db_name =~ /_synonym/) {
$matched_db_name .= "_synonym";
}
map { $synonyms .= qq{
<field name="${matched_db_name}_synonym">$_</field>}; } keys %{ $external_identifiers->{$ext_db_name} }
} else { # non-synonyms
map { $cross_references .= qq{
<ref dbname="$matched_db_name" dbkey="$_"/>}; } keys %{ $external_identifiers->{$ext_db_name} }
}
} else {
foreach my $key (keys %{ $external_identifiers->{$ext_db_name} }) {
$key =~ s/</&lt;/g;
$key =~ s/>/&gt;/g;
$key =~ s/&/&amp;/g;
$ext_db_name =~s/^Ens.*/ENSEMBL/;
if ($ext_db_name =~ /_synonym/) {
$synonyms .= qq{
<field name="$ext_db_name">$key"</field>};
} else {
$cross_references .= qq{
<ref dbname="$ext_db_name" dbkey="$key"/>};
}
}
}
......@@ -715,12 +738,13 @@ sub geneLineXML {
} keys %$peptides
)
)
. $synonyms
. qq{
</additional_fields>
};
$counter->();
return $xml . $cross_references . $additional_fields . '</entry>';
......
Markdown is supported
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