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 public final class UniProtEntry implements SequenceDatabaseEntry {
33 private String _rec_name;
34 private String _os_scientific_name;
35 private String _tax_id;
36 private String _symbol;
38 private UniProtEntry() {
42 public Object clone() throws CloneNotSupportedException {
43 throw new CloneNotSupportedException();
46 public static SequenceDatabaseEntry createInstanceFromPlainText( final List<String> lines ) {
47 final UniProtEntry e = new UniProtEntry();
48 for( final String line : lines ) {
49 if ( line.startsWith( "AC" ) ) {
50 e.setAc( DatabaseTools.extract( line, "AC", ";" ) );
52 else if ( line.startsWith( "DE" ) ) {
53 if ( ( line.indexOf( "RecName:" ) > 0 ) && ( line.indexOf( "Full=" ) > 0 ) ) {
54 e.setRecName( DatabaseTools.extract( line, "Full=", ";" ) );
57 else if ( line.startsWith( "GN" ) ) {
58 if ( ( line.indexOf( "Name=" ) > 0 ) ) {
59 e.setSymbol( DatabaseTools.extract( line, "Name=", ";" ) );
62 else if ( line.startsWith( "OS" ) ) {
63 if ( line.indexOf( "(" ) > 0 ) {
64 e.setOsScientificName( DatabaseTools.extract( line, "OS", "(" ) );
67 e.setOsScientificName( DatabaseTools.extract( line, "OS", "." ) );
70 else if ( line.startsWith( "OX" ) ) {
71 if ( line.indexOf( "NCBI_TaxID=" ) > 0 ) {
72 e.setTaxId( DatabaseTools.extract( line, "NCBI_TaxID=", ";" ) );
80 public String getAccession() {
84 private void setAc( final String ac ) {
91 public String getSequenceName() {
95 private void setRecName( final String rec_name ) {
96 if ( _rec_name == null ) {
102 public String getTaxonomyScientificName() {
103 return _os_scientific_name;
106 private void setOsScientificName( final String os_scientific_name ) {
107 if ( _os_scientific_name == null ) {
108 _os_scientific_name = os_scientific_name;
113 public String getTaxonomyIdentifier() {
117 private void setTaxId( final String tax_id ) {
118 if ( _tax_id == null ) {
124 public String getSequenceSymbol() {
128 private void setSymbol( final String symbol ) {
129 if ( _symbol == null ) {