File: FeatureLoc.xml

package info (click to toggle)
artemis 17.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 112,044 kB
  • sloc: java: 451,938; sh: 3,370; xml: 2,292; makefile: 182; perl: 83; sql: 47
file content (121 lines) | stat: -rw-r--r-- 4,847 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0" encoding="UTF-8" ?> 
 
<!DOCTYPE sqlMap 
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
    "http://ibatis.apache.org/dtd/sql-map-2.dtd"> 
 

<sqlMap namespace="FeatureLoc"> 
 
     <typeAlias alias="FeatureLoc"
        type="org.gmod.schema.sequence.FeatureLoc"/>
        
     <resultMap id="map-location-lazy"
                class="FeatureLoc">
		<result property="featureByFeatureId.featureId" column="feature_id" />
        <result property="srcFeatureId" column="srcfeature_id" nullValue="-999" />
        <result property="featureBySrcFeatureId" column="{featureId=srcfeature_id}" 
                                                 select="getLazyFeatureNoResiduesById" />
        <result property="fmin"   column="fmin"   nullValue="-999" />
        <result property="fmax"   column="fmax"   nullValue="-999" />
        <result property="strand" column="strand" nullValue="0" />
        <result property="phase"  column="phase" />
        <result property="residueInfo" column="residue_info"/>
        <result property="locGroup"    column="locgroup"/>
        <result property="rank"        column="rank"/>
        <result property="fminPartial" column="is_fmin_partial"/>
        <result property="fmaxPartial" column="is_fmax_partial"/>
     </resultMap>
     
	  
     <!--  select featureloc -->
     <select id="getFeatureLoc" resultMap="map-location-lazy">
       SELECT feature_id, srcfeature_id, fmin, fmax, strand, phase, residue_info, locgroup, rank, is_fmin_partial, is_fmax_partial
       FROM  featureloc
       WHERE featureloc.feature_id=#id#
     </select>
     
     <select id="getFeatureLocBySrcFeatureId" resultMap="map-location-lazy">
       SELECT feature_id, srcfeature_id, fmin, fmax, strand, phase, residue_info, locgroup, rank, is_fmin_partial, is_fmax_partial
       FROM  featureloc
       WHERE srcfeature_id=#id#
     </select>
     
	 <select id="getFeatureLocsByListOfIds" resultMap ="map-location-lazy">
	   SELECT feature_id, srcfeature_id, fmin, fmax, strand, phase, residue_info, locgroup, rank, is_fmin_partial, is_fmax_partial
       FROM  featureloc
       WHERE featureloc.feature_id IN <iterate open="(" close=")" conjunction=","> $[]$ </iterate>
     </select>
	
     <!-- used to find match feature from the subject and query featureId -->
     <select id="getFeatureIdBySrcFeatureId" parameterClass="Feature" resultClass="java.lang.Integer">
        <iterate property="featureLocsForFeatureId" conjunction="INTERSECT" >
           SELECT feature_id FROM featureloc WHERE srcfeature_id=#featureLocsForFeatureId[].featureBySrcFeatureId.featureId#  
        </iterate>
     </select>
     
   <!--  WRITE BACK METHODS  -->
    
   <!--  UPDATE  -->
   <update id="updateFeatureLoc" 
            parameterClass="FeatureLoc">
      UPDATE featureloc
      SET fmin=$fmin$, fmax=$fmax$, strand=$strand$,
          is_fmin_partial=#fminPartial#,
          is_fmax_partial=#fmaxPartial#
      <isNotNull property="phase">
        , phase=$phase$
      </isNotNull>
      <isNull property="phase">
        , phase=NULL
      </isNull>
      WHERE
      <isGreaterThan property="featureByFeatureId.featureId" compareValue="0">
        feature_id=$featureByFeatureId.featureId$
      </isGreaterThan>
      <isLessEqual property="featureByFeatureId.featureId" compareValue="0">
         <isNotNull property="featureByFeatureId.uniqueName">
           feature_id=(SELECT feature_id FROM feature WHERE uniquename=#featureByFeatureId.uniqueName#)
         </isNotNull>
      </isLessEqual>
      <isGreaterThan property="featureBySrcFeatureId.featureId" compareValue="0" prepend="AND">
        srcfeature_id=$featureBySrcFeatureId.featureId$
      </isGreaterThan>
   </update>
   
   <update id="updateFeatureLocByChangingSequence" 
            parameterClass="uk.ac.sanger.artemis.chado.FeatureForUpdatingResidues">
      UPDATE featureloc
      SET 
       <isNotNull property="newSubSequence">
         fmin=fmin+$length$, fmax=fmax+$length$
       </isNotNull>
       <isNull property="newSubSequence">
         fmin=fmin-$length$, fmax=fmax-$length$
       </isNull>
      WHERE fmin >= $startBase$ AND srcfeature_id=$featureId$
    </update>
   
    <insert id="insertFeatureLoc" 
            parameterClass="FeatureLoc">
      INSERT INTO featureloc
        ( featureloc_id, feature_id, srcfeature_id, fmin, fmax, strand, rank
          <isNotNull property="phase">
           , phase
          </isNotNull> 
        )
      VALUES
        ( nextval('featureloc_featureloc_id_seq'),
          $featureByFeatureId.featureId$,
          $featureBySrcFeatureId.featureId$,
          $fmin$,
          $fmax$,
          $strand$,
          $rank$
          <isNotNull property="phase">
            , $phase$
          </isNotNull>
        )
    </insert>
         
</sqlMap>