* using LinkedHashMap keeps models ordered as added
*/
models = new LinkedHashMap<>();
- BLOSUM62 = loadScoreMatrix("scoreModel/blosum62.scm");
- PAM250 = loadScoreMatrix("scoreModel/pam250.scm");
- DNA = loadScoreMatrix("scoreModel/dna.scm");
+ BLOSUM62 = loadScoreMatrix("scoreModel/blosum62.scm",true);
+ PAM250 = loadScoreMatrix("scoreModel/pam250.scm",true);
+ DNA = loadScoreMatrix("scoreModel/dna.scm",true);
registerScoreModel(new PIDModel());
registerScoreModel(new FeatureDistanceModel());
SECONDARYSTRUCTURE = loadScoreMatrix(
- "scoreModel/secondarystructure.scm");
+ "scoreModel/secondarystructure.scm",false);
registerScoreModel(new SecondaryStructureDistanceModel());
}
/**
* Tries to load a score matrix from the given resource file, and if
- * successful, registers it.
+ * successful, optionally registers it.
*
- * @param string
- * @return
+ * @param resourcePath
+ * @param register (if true)
+ * @return loaded matrix
*/
- ScoreMatrix loadScoreMatrix(String resourcePath)
+ ScoreMatrix loadScoreMatrix(String resourcePath, boolean register)
{
try
{
FileParse fp = new FileParse(resourcePath,
DataSourceType.CLASSLOADER);
ScoreMatrix sm = new ScoreMatrixFile(fp).parseMatrix();
- registerScoreModel(sm);
+ if (register) {
+ registerScoreModel(sm);
+ }
return sm;
} catch (IOException e)
{
public void registerScoreModel(ScoreModelI sm)
{
- if (sm.getName().equals("SECONDARYSTRUCTURE"))
- {
- return;
- }
ScoreModelI sm2 = models.get(sm.getName());
if (sm2 != null)
{
return PAM250;
}
+ /**
+ * get currently configured matrix for comparing secondary structure
+ * @return
+ */
public ScoreMatrix getSecondaryStructureMatrix()
{
return SECONDARYSTRUCTURE;