org.biojava.nbio.structure.scop.ScopDescription Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biojava-structure Show documentation
Show all versions of biojava-structure Show documentation
The protein structure modules of BioJava.
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
*/
package org.biojava.nbio.structure.scop;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/** Contains data from
* dir.des.scop.txt_1.75
*
* e.g
*
* SunID Cat Class Name Description
* ----- --- ----- ---- -----------
* 26154 px b.47.1.2 d1nrs.1 1nrs L:,H:
* 125030 px b.47.1.2 d1zgia1 1zgi A:1A-245
*
*
* @author Andreas Prlic
*
*/
@XmlRootElement(name = "ScopDescription", namespace ="http://source.rcsb.org")
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class ScopDescription implements Serializable,Cloneable{
private static final long serialVersionUID = 8579808155176839161L;
int sunID;
ScopCategory category;
String classificationId;
String name;
String description;
@Override
public String toString(){
StringBuilder buf = new StringBuilder();
buf.append(String.valueOf(sunID));
buf.append("\t");
buf.append(category);
buf.append("\t");
buf.append(classificationId);
buf.append("\t");
buf.append(name);
buf.append("\t");
buf.append(description);
return buf.toString();
}
public int getSunID()
{
return sunID;
}
public void setSunID(int sunID)
{
this.sunID = sunID;
}
public ScopCategory getCategory()
{
return category;
}
public void setCategory(ScopCategory category)
{
this.category = category;
}
public String getClassificationId()
{
return classificationId;
}
public void setClassificationId(String classificationId)
{
this.classificationId = classificationId;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
// Methods to return parts of the classificationID
/**
* Return a portion of the classificationID corresponding to the specified
* category (class, fold, superfamily, family).
*
* Example: for SCOP family "b.5.1.1",
* getClassificationId(ScopCategory.Superfamily) => "b.5.1"
*/
public String getClassificationId(ScopCategory category) {
if(classificationId == null || classificationId.isEmpty()) {
return null;
}
int numParts = 0;
switch(category) {
case Family: numParts++;
case Superfamily: numParts++;
case Fold: numParts++;
case Class: numParts++; break;
default:
throw new IllegalArgumentException("Only Class, Fold, Superfamily, and Family are supported.");
}
int endChar = -1;
for(int i = 0;i