    001    package calhoun.analysis.crf.features.interval29;
    002
    003    import java.util.Arrays;
    004    import java.util.List;
    005
    006    import calhoun.analysis.crf.BeanModel;
    007
    008
    009    public class Interval29Model extends BeanModel {
    010            private static final long serialVersionUID = 3959312826759045449L;
    011
    012            private static boolean narrowBoundaries = false;
    013
    014            public void setNarrowBoundaries(boolean narrowBoundaries) {
    015                    Interval29Model.narrowBoundaries = narrowBoundaries;
    016            }
    017
    018            public static int getPadExon5prime() {
    019                    if (narrowBoundaries) {
    020                            return 4;
    021                    } else {
    022                            return 6;
    023                    }
    024            }
    025
    026            public static int getPadExon3prime() {
    027                    if (narrowBoundaries) {
    028                            return 1;
    029                    } else {
    030                            return 3;
    031                    }
    032            }
    033
    034            public static int getPadIntron5prime() {
    035                    return 6;
    036            }
    037
    038            public static int getPadIntron3prime() {
    039                    return 9;
    040            }
    041
    042            public static int getPadIntergenic() {
    043                    return 9;
    044            }
    045
    046
    047            static Node[] nodeArray = new Node[] {
    048                    new Node(0, "intergenic"),
    049                    new Node(1, "exon0"),
    050                    new Node(2, "exon1"),
    051                    new Node(3, "exon2"),
    052                    new Node(4, "intron0"),
    053                    new Node(5, "intron1"),
    054                    new Node(6, "intron2"),
    055                    new Node(7, "exon0m"),
    056                    new Node(8, "exon1m"),
    057                    new Node(9, "exon2m"),
    058                    new Node(10, "intron0m"),
    059                    new Node(11, "intron1m"),
    060                    new Node(12, "intron2m"),
    061                    new Node(13, "ig-e"),
    062                    new Node(14, "e-ig"),
    063                    new Node(15, "e-i0"),
    064                    new Node(16, "e-i1"),
    065                    new Node(17, "e-i2"),
    066                    new Node(18, "i-e0"),
    067                    new Node(19, "i-e1"),
    068                    new Node(20, "i-e2"),
    069                    new Node(21, "ig-em"),
    070                    new Node(22, "em-ig"),
    071                    new Node(23, "em-i0m"),
    072                    new Node(24, "em-i1m"),
    073                    new Node(25, "em-i2m"),
    074                    new Node(26, "im-e0m"),
    075                    new Node(27, "im-e1m"),
    076                    new Node(28, "im-e2m")
    077            };
    078
    079            static Edge[] edgeArray = new Edge[] {
    080                    // To self
    081                    new Edge(nodeArray[0], nodeArray[0]),
    082                    new Edge(nodeArray[1], nodeArray[1]),
    083                    new Edge(nodeArray[2], nodeArray[2]),
    084                    new Edge(nodeArray[3], nodeArray[3]),
    085                    new Edge(nodeArray[4], nodeArray[4]),
    086                    new Edge(nodeArray[5], nodeArray[5]),
    087                    new Edge(nodeArray[6], nodeArray[6]),
    088                    new Edge(nodeArray[7], nodeArray[7]),
    089                    new Edge(nodeArray[8], nodeArray[8]),
    090                    new Edge(nodeArray[9], nodeArray[9]),
    091                    new Edge(nodeArray[10], nodeArray[10]),
    092                    new Edge(nodeArray[11], nodeArray[11]),
    093                    new Edge(nodeArray[12], nodeArray[12]),
    094                    new Edge(nodeArray[13], nodeArray[13]),
    095                    new Edge(nodeArray[14], nodeArray[14]),
    096                    new Edge(nodeArray[15], nodeArray[15]),
    097                    new Edge(nodeArray[16], nodeArray[16]),
    098                    new Edge(nodeArray[17], nodeArray[17]),
    099                    new Edge(nodeArray[18], nodeArray[18]),
    100                    new Edge(nodeArray[19], nodeArray[19]),
    101                    new Edge(nodeArray[20], nodeArray[20]),
    102                    new Edge(nodeArray[21], nodeArray[21]),
    103                    new Edge(nodeArray[22], nodeArray[22]),
    104                    new Edge(nodeArray[23], nodeArray[23]),
    105                    new Edge(nodeArray[24], nodeArray[24]),
    106                    new Edge(nodeArray[25], nodeArray[25]),
    107                    new Edge(nodeArray[26], nodeArray[26]),
    108                    new Edge(nodeArray[27], nodeArray[27]),
    109                    new Edge(nodeArray[28], nodeArray[28]),
    110
    111                    // Intergenic to intergenic-exon_i boundary
    112                    new Edge(nodeArray[0], nodeArray[13]),
    113                    // Intergenic-exon_i boundary to exon_i
    114                    new Edge(nodeArray[13], nodeArray[1]),
    115                    new Edge(nodeArray[13], nodeArray[2]),
    116                    new Edge(nodeArray[13], nodeArray[3]),
    117                    // Intergenic to intergenic-exon_im boundary
    118                    new Edge(nodeArray[0], nodeArray[21]),
    119                    // Intergenic-exonm boundary to exonm
    120                    new Edge(nodeArray[21], nodeArray[7]),
    121                    new Edge(nodeArray[21], nodeArray[8]),
    122                    new Edge(nodeArray[21], nodeArray[9]),
    123
    124                    // Exon_i to exon-intergenic boundary
    125                    new Edge(nodeArray[1], nodeArray[14]),
    126                    new Edge(nodeArray[2], nodeArray[14]),
    127                    new Edge(nodeArray[3], nodeArray[14]),
    128                    // Exon-intergenic boundary to intergenic
    129                    new Edge(nodeArray[14], nodeArray[0]),
    130                    // Exon_im to exonm-intergenic boundary
    131                    new Edge(nodeArray[7], nodeArray[22]),
    132                    new Edge(nodeArray[8], nodeArray[22]),
    133                    new Edge(nodeArray[9], nodeArray[22]),
    134                    // Exonm-intergenic boundary to intergenic
    135                    new Edge(nodeArray[22], nodeArray[0]),
    136
    137                    // Exon_i to exon-intron_j boundary
    138                    new Edge(nodeArray[1], nodeArray[15]),
    139                    new Edge(nodeArray[2], nodeArray[15]),
    140                    new Edge(nodeArray[3], nodeArray[15]),
    141                    new Edge(nodeArray[1], nodeArray[16]),
    142                    new Edge(nodeArray[2], nodeArray[16]),
    143                    new Edge(nodeArray[3], nodeArray[16]),
    144                    new Edge(nodeArray[1], nodeArray[17]),
    145                    new Edge(nodeArray[2], nodeArray[17]),
    146                    new Edge(nodeArray[3], nodeArray[17]),
    147                    // Exon-intron_i boundary to intron_i
    148                    new Edge(nodeArray[15], nodeArray[4]),
    149                    new Edge(nodeArray[16], nodeArray[5]),
    150                    new Edge(nodeArray[17], nodeArray[6]),
    151
    152                    // Intron_i to intron-exon_j boundary
    153                    new Edge(nodeArray[4], nodeArray[18]),
    154                    new Edge(nodeArray[5], nodeArray[18]),
    155                    new Edge(nodeArray[6], nodeArray[18]),
    156                    new Edge(nodeArray[4], nodeArray[19]),
    157                    new Edge(nodeArray[5], nodeArray[19]),
    158                    new Edge(nodeArray[6], nodeArray[19]),
    159                    new Edge(nodeArray[4], nodeArray[20]),
    160                    new Edge(nodeArray[5], nodeArray[20]),
    161                    new Edge(nodeArray[6], nodeArray[20]),
    162                    // Intron-exon_i boundary to exon_i
    163                    new Edge(nodeArray[18], nodeArray[1]),
    164                    new Edge(nodeArray[19], nodeArray[2]),
    165                    new Edge(nodeArray[20], nodeArray[3]),
    166
    167                    // Exon_im to exonm-intron_jm boundary
    168                    new Edge(nodeArray[7], nodeArray[23]),
    169                    new Edge(nodeArray[8], nodeArray[23]),
    170                    new Edge(nodeArray[9], nodeArray[23]),
    171                    new Edge(nodeArray[7], nodeArray[24]),
    172                    new Edge(nodeArray[8], nodeArray[24]),
    173                    new Edge(nodeArray[9], nodeArray[24]),
    174                    new Edge(nodeArray[7], nodeArray[25]),
    175                    new Edge(nodeArray[8], nodeArray[25]),
    176                    new Edge(nodeArray[9], nodeArray[25]),
    177                    // Exonm-intron_im boundary to intron_im
    178                    new Edge(nodeArray[23], nodeArray[10]),
    179                    new Edge(nodeArray[24], nodeArray[11]),
    180                    new Edge(nodeArray[25], nodeArray[12]),
    181
    182                    // Intron_im to intronm-exon_jm boundary
    183                    new Edge(nodeArray[10], nodeArray[26]),
    184                    new Edge(nodeArray[11], nodeArray[26]),
    185                    new Edge(nodeArray[12], nodeArray[26]),
    186                    new Edge(nodeArray[10], nodeArray[27]),
    187                    new Edge(nodeArray[11], nodeArray[27]),
    188                    new Edge(nodeArray[12], nodeArray[27]),
    189                    new Edge(nodeArray[10], nodeArray[28]),
    190                    new Edge(nodeArray[11], nodeArray[28]),
    191                    new Edge(nodeArray[12], nodeArray[28]),
    192                    // Intronm-exonm boundary to exonm
    193                    new Edge(nodeArray[26], nodeArray[7]),
    194                    new Edge(nodeArray[27], nodeArray[8]),
    195                    new Edge(nodeArray[28], nodeArray[9])  // done
    196            };
    197
    198            public List checkValidTransitions(List data) {
    199                    return Interval29Tools.checkValidTransitions(data);
    200            }
    201
    202            public Interval29Model() {
    203                    nodes = Arrays.asList(nodeArray);
    204                    edges = Arrays.asList(edgeArray);
    205            }
    206    }