Skip to content
Snippets Groups Projects
Select Git revision
  • 728b6836d2c22776ca2f8af1421deeea07c51468
  • master default protected
  • gh-pages
  • build-process-upgrade-merge
  • eb-apollo-generate_names
  • BT5_travis
  • hello_github
  • v18.1.0
  • v18.0.3
  • v18.0.2
  • v18.0.1
  • v18.0.0
  • v18.0.0-RC1
  • v17.0.1
  • v17.0.0
  • v16.0.17
  • v16.0.0
  • v15.0.0
  • v14.0.0
  • v13.2.0
20 results

FeatureLoc.xml

Blame
  • FeatureLoc.xml 4.41 KiB
    <?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="srcFeatureId" column="srcfeature_id" nullValue="-999" />
            <result property="featureBySrcFeatureId" column="{featureId=srcfeature_id}" 
                                                     select="getLazyFeatureById" />
            <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"/>
         </resultMap>
         
    	 <resultMap id="map-location"
                    class="FeatureLoc">
            <result property="srcFeatureId" column="srcfeature_id" nullValue="-999" />
            <result property="featureBySrcFeatureId" column="{featureId=srcfeature_id}" 
                                                     select="getFeatureById" />
            <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"  nullValue="0" />
            <result property="residueInfo"  column="residue_info"/>
            <result property="locGroup"  column="locgroup"/>
            <result property="rank"      column="rank"/>
         </resultMap>
    	  
         <!--  select featureloc -->
         <select id="getFeatureLoc" resultMap="map-location-lazy">
           SELECT srcfeature_id, fmin, fmax, strand, phase, residue_info, locgroup, rank
           FROM  featureloc
           WHERE featureloc.feature_id=#id#
         </select>
         
         <!-- used to find match meature 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$, rank=$rank$, strand=$strand$
          <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>
        </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>