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 UniProtEntry implements SequenceDatabaseEntry {
35 private String _rec_name;
36 private String _os_scientific_name;
37 private String _tax_id;
38 private String _symbol;
40 private UniProtEntry() {
44 public Object clone() throws CloneNotSupportedException {
45 throw new CloneNotSupportedException();
48 public static SequenceDatabaseEntry createInstanceFromPlainText( final List<String> lines ) {
49 final UniProtEntry e = new UniProtEntry();
50 for( final String line : lines ) {
51 if ( line.startsWith( "AC" ) ) {
52 e.setAc( DatabaseTools.extract( line, "AC", ";" ) );
54 else if ( line.startsWith( "DE" ) ) {
55 if ( ( line.indexOf( "RecName:" ) > 0 ) && ( line.indexOf( "Full=" ) > 0 ) ) {
56 e.setRecName( DatabaseTools.extract( line, "Full=", ";" ) );
59 else if ( line.startsWith( "GN" ) ) {
60 if ( ( line.indexOf( "Name=" ) > 0 ) ) {
61 e.setSymbol( DatabaseTools.extract( line, "Name=", ";" ) );
64 else if ( line.startsWith( "OS" ) ) {
65 if ( line.indexOf( "(" ) > 0 ) {
66 e.setOsScientificName( DatabaseTools.extract( line, "OS", "(" ) );
69 e.setOsScientificName( DatabaseTools.extract( line, "OS", "." ) );
72 else if ( line.startsWith( "OX" ) ) {
73 if ( line.indexOf( "NCBI_TaxID=" ) > 0 ) {
74 e.setTaxId( DatabaseTools.extract( line, "NCBI_TaxID=", ";" ) );
82 public String getAccession() {
86 private void setAc( final String ac ) {
93 public String getSequenceName() {
97 private void setRecName( final String rec_name ) {
98 if ( _rec_name == null ) {
104 public String getTaxonomyScientificName() {
105 return _os_scientific_name;
108 private void setOsScientificName( final String os_scientific_name ) {
109 if ( _os_scientific_name == null ) {
110 _os_scientific_name = os_scientific_name;
115 public String getTaxonomyIdentifier() {
119 private void setTaxId( final String tax_id ) {
120 if ( _tax_id == null ) {
126 public String getSequenceSymbol() {
130 private void setSymbol( final String symbol ) {
131 if ( _symbol == null ) {
137 public boolean isEmpty() {
138 return ( ForesterUtil.isEmpty( getAccession() ) && ForesterUtil.isEmpty( getSequenceName() )
139 && ForesterUtil.isEmpty( getTaxonomyScientificName() )
140 && ForesterUtil.isEmpty( getTaxonomyIdentifier() ) && ForesterUtil.isEmpty( getSequenceSymbol() ) );
144 public String getProvider() {