Change header template for a new version
[jabaws.git] / datamodel / compbio / data / sequence / SMERFSConstraints.java
1 /* Copyright (c) 2011 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
4  * \r
5  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
6  *  Apache License version 2 as published by the Apache Software Foundation\r
7  * \r
8  *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
9  *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
10  *  License for more details.\r
11  * \r
12  *  A copy of the license is in apache_license.txt. It is also available here:\r
13  * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
14  * \r
15  * Any republication or derived work distributed in source code form\r
16  * must include this copyright and license notice.\r
17  */\r
18 package compbio.data.sequence;\r
19 \r
20 /**\r
21  * Enumeration defining two constraints for SMERFS columns score calculation.\r
22  * MAX_SCORE gives the highest core of all the windows the column belongs to.\r
23  * MID_SCORE gives the window score to the column in the middle.\r
24  * \r
25  * @author Agnieszka Golicz & Peter Troshin\r
26  */\r
27 public enum SMERFSConstraints {\r
28 \r
29         MAX_SCORE, MID_SCORE;\r
30 \r
31         /**\r
32          * Default column scoring schema\r
33          */\r
34         public static final SMERFSConstraints DEFAULT_COLUMN_SCORE = SMERFSConstraints.MID_SCORE;\r
35 \r
36         /**\r
37          * Default window size value for SMERFS algorithm\r
38          */\r
39         public static final int DEFAULT_WINDOW_SIZE = 7;\r
40 \r
41         /**\r
42          * Default gap threshold value for SMERFS algorithm\r
43          */\r
44         public static final double DEFAULT_GAP_THRESHOLD = 0.1;\r
45 \r
46         public static SMERFSConstraints getSMERFSColumnScore(String score) {\r
47 \r
48                 score = score.trim().toLowerCase();\r
49                 if (score.equalsIgnoreCase(SMERFSConstraints.MAX_SCORE.toString())) {\r
50                         return SMERFSConstraints.MAX_SCORE;\r
51                 }\r
52                 if (score.equalsIgnoreCase(SMERFSConstraints.MID_SCORE.toString())) {\r
53                         return SMERFSConstraints.MID_SCORE;\r
54                 }\r
55                 return null;\r
56         }\r
57 }\r