2 // forester -- software libraries and applications
3 // for genomics and evolutionary biology research.
5 // Copyright (C) 2010 Christian M Zmasek
6 // Copyright (C) 2010 Sanford-Burnham Medical Research Institute
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 // Contact: phylosoft @ gmail . com
24 // WWW: www.phylosoft.org/forester
26 package org.forester.ws.uniprot;
28 import java.util.List;
30 import sun.reflect.generics.reflectiveObjects.NotImplementedException;
32 public final class EbiDbEntry implements SequenceDatabaseEntry {
33 //http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/emb/AAR37336/
39 private String _tax_id;
40 private String _symbol;
42 private EbiDbEntry() {
46 public Object clone() {
47 throw new NotImplementedException();
50 public static SequenceDatabaseEntry createInstanceFromPlainText( final List<String> lines ) {
51 final EbiDbEntry e = new EbiDbEntry();
52 for( final String line : lines ) {
53 if ( line.startsWith( "PA" ) ) {
54 e.setPA( DatabaseTools.extract( line, "PA", ";" ) );
56 else if ( line.startsWith( "DE" ) ) {
57 // if ( ( line.indexOf( "RecName:" ) > 0 ) && ( line.indexOf( "Full=" ) > 0 ) ) {
58 e.setDe( DatabaseTools.extract( line, "DE" ) );
61 // else if ( line.startsWith( "GN" ) ) {
62 // if ( ( line.indexOf( "Name=" ) > 0 ) ) {
63 // e.setSymbol( extract( line, "Name=", ";" ) );
66 else if ( line.startsWith( "OS" ) ) {
67 if ( line.indexOf( "(" ) > 0 ) {
68 e.setOs( DatabaseTools.extract( line, "OS", "(" ) );
71 e.setOs( DatabaseTools.extract( line, "OS" ) );
74 else if ( line.startsWith( "OX" ) ) {
75 if ( line.indexOf( "NCBI_TaxID=" ) > 0 ) {
76 e.setTaxId( DatabaseTools.extract( line, "NCBI_TaxID=", ";" ) );
84 public String getAccession() {
88 private void setPA( final String pa ) {
95 public String getSequenceName() {
99 private void setDe( final String rec_name ) {
106 public String getTaxonomyScientificName() {
110 private void setOs( final String os ) {
117 public String getTaxonomyIdentifier() {
121 private void setTaxId( final String tax_id ) {
122 if ( _tax_id == null ) {
128 public String getSequenceSymbol() {
132 private void setSymbol( final String symbol ) {
133 if ( _symbol == null ) {