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 org.forester.util.ForesterUtil;
32 public final class EbiDbEntry implements SequenceDatabaseEntry {
34 //http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/emb/AAR37336/
38 private String _tax_id;
39 private String _symbol;
41 private EbiDbEntry() {
45 public Object clone() throws CloneNotSupportedException {
46 throw new CloneNotSupportedException();
49 public static SequenceDatabaseEntry createInstanceFromPlainText( final List<String> lines ) {
50 final EbiDbEntry e = new EbiDbEntry();
51 for( final String line : lines ) {
52 if ( line.startsWith( "PA" ) ) {
53 e.setPA( DatabaseTools.extract( line, "PA" ) );
55 else if ( line.startsWith( "DE" ) ) {
56 // if ( ( line.indexOf( "RecName:" ) > 0 ) && ( line.indexOf( "Full=" ) > 0 ) ) {
57 e.setDe( DatabaseTools.extract( line, "DE" ) );
60 // else if ( line.startsWith( "GN" ) ) {
61 // if ( ( line.indexOf( "Name=" ) > 0 ) ) {
62 // e.setSymbol( extract( line, "Name=", ";" ) );
65 else if ( line.startsWith( "OS" ) ) {
66 if ( line.indexOf( "(" ) > 0 ) {
67 e.setOs( DatabaseTools.extract( line, "OS", "(" ) );
70 e.setOs( DatabaseTools.extract( line, "OS" ) );
73 else if ( line.startsWith( "OX" ) ) {
74 if ( line.indexOf( "NCBI_TaxID=" ) > 0 ) {
75 e.setTaxId( DatabaseTools.extract( line, "NCBI_TaxID=", ";" ) );
83 public String getAccession() {
87 private void setPA( final String pa ) {
94 public String getSequenceName() {
98 private void setDe( final String rec_name ) {
105 public String getTaxonomyScientificName() {
109 private void setOs( final String os ) {
116 public String getTaxonomyIdentifier() {
120 private void setTaxId( final String tax_id ) {
121 if ( _tax_id == null ) {
127 public String getSequenceSymbol() {
131 private void setSymbol( final String symbol ) {
132 if ( _symbol == null ) {
138 public boolean isEmpty() {
139 return ( ForesterUtil.isEmpty( getAccession() ) && ForesterUtil.isEmpty( getSequenceName() )
140 && ForesterUtil.isEmpty( getTaxonomyScientificName() )
141 && ForesterUtil.isEmpty( getTaxonomyIdentifier() ) && ForesterUtil.isEmpty( getSequenceSymbol() ) );