Changeset 2666


Ignore:
Timestamp:
02/26/10 18:10:09 (2 years ago)
Author:
rwagner
Message:
 
Location:
molgenis_projects/col7a1
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • molgenis_projects/col7a1/handwritten/java/LoadExamples.java

    r2659 r2666  
    125125                        mutation.setExon(exon1); 
    126126                        mutation.setConsequence("PTC"); 
     127                        mutation.setDominance("dominant"); 
    127128                        mutation.setReportedSNP(true); 
    128129                        mutation.setConservedAA(true); 
  • molgenis_projects/col7a1/handwritten/java/plugin/ui/SearchPlugin.ftl

    r2659 r2666  
    8484<#list screen.mutationVOResult as mutationVO> 
    8585<table border="1"> 
    86 <tr> 
     86<tr bgcolor="#eeeeee"> 
    8787<td>cDNA</td> 
    8888<td>gDNA</td> 
     
    109109<td>${mutationVO.exon}</td> 
    110110<td>${mutationVO.consequence}</td> 
    111 <td>(to be implemented)</td> 
     111<td>${mutationVO.dominance}</td> 
    112112<td>${mutationVO.reportedSNP?string("yes", "no")}</td> 
    113113<td>${mutationVO.conservedAA?string("yes", "no")}</td> 
  • molgenis_projects/col7a1/handwritten/java/plugin/ui/SearchPlugin.java

    r2659 r2666  
    2020 
    2121import service.MutationService; 
     22import vo.ExonVO; 
    2223import vo.MutationVO; 
     24import vo.ProteinDomainVO; 
    2325 
    2426import col7a1.Exon; 
     
    4143        private String param_aaNo; 
    4244        private String param_exon; 
    43         private List<Exon> param_exons; 
     45        private List<ExonVO> param_exons; 
    4446        private List<String> param_types; 
    45         private List<ProteinDomain> param_domains; 
    46         private HashMap<Integer, List<Exon>> exonsPerDomainId; 
     47        private List<ProteinDomainVO> param_domains; 
     48        private HashMap<Integer, List<ExonVO>> exonsPerDomainId; 
    4749         
    4850        private List<MutationVO> mutationVOResult; 
     
    6163                this.param_aaNo       = AANO; 
    6264                this.param_exon       = EXON; 
    63                 this.exonsPerDomainId = new HashMap<Integer, List<Exon>>(); 
     65                this.exonsPerDomainId = new HashMap<Integer, List<ExonVO>>(); 
    6466                this.mutationVOResult = new ArrayList<MutationVO>(); 
    6567        } 
     
    8486                try 
    8587                { 
     88//                      Integer id            = Integer.valueOf(request.getString("mutation")); 
     89//                      String cdna_notation  = request.getString("variation"); 
     90//                      String type           = request.getString("type"); 
     91//                      Integer exonId        = Integer.valueOf(request.getString("exonlist")); 
     92//                      Boolean reportedSNP   = request.getBoolean("snpbool"); 
     93// 
     94//                      this.mutationVOResult = mutationService.findMutations(id, cdna_notation, type, reportedSNP, exonId); 
     95                         
    8696                        if (StringUtils.isNotEmpty(request.getString("mutation"))) 
    8797                        { 
     
    142152                        this.param_domains   = this.mutationService.getProteinDomains(); 
    143153                         
    144                         for (ProteinDomain domain : this.param_domains) 
    145                         { 
    146                                 if (!this.exonsPerDomainId.containsKey(domain.getId())) 
    147                                         this.exonsPerDomainId.put(domain.getId(), new ArrayList<Exon>()); 
    148                                 for (Exon exon : this.mutationService.findExonsByProteinDomainId(domain.getId())) 
    149                                         this.exonsPerDomainId.get(domain.getId()).add(exon); 
     154                        for (ProteinDomainVO domainVO : this.param_domains) 
     155                        { 
     156                                if (!this.exonsPerDomainId.containsKey(domainVO.getId())) 
     157                                        this.exonsPerDomainId.put(domainVO.getId(), new ArrayList<ExonVO>()); 
     158                                for (ExonVO exonVO : this.mutationService.findExonsByProteinDomainId(domainVO.getId())) 
     159                                        this.exonsPerDomainId.get(domainVO.getId()).add(exonVO); 
    150160                        } 
    151161                        //do something 
     
    196206        } 
    197207         
    198         public List<Exon> getExons() 
     208        public List<ExonVO> getExons() 
    199209        { 
    200210                return this.param_exons; 
    201211        } 
    202212 
    203         public List<Exon> getExons(ProteinDomain domain) 
    204         { 
    205                 return this.exonsPerDomainId.get(domain.getId()); 
    206         } 
    207  
    208         public Exon getFirstExon(ProteinDomain domain) 
    209         { 
    210                 return this.exonsPerDomainId.get(domain.getId()).get(0); 
    211         } 
    212  
    213         public Exon getLastExon(ProteinDomain domain) 
    214         { 
    215                 return this.exonsPerDomainId.get(domain.getId()).get(this.exonsPerDomainId.get(domain.getId()).size() - 1); 
     213        public List<ExonVO> getExons(ProteinDomainVO domainVO) 
     214        { 
     215                return this.exonsPerDomainId.get(domainVO.getId()); 
     216        } 
     217 
     218        public ExonVO getFirstExon(ProteinDomainVO domainVO) 
     219        { 
     220                return this.exonsPerDomainId.get(domainVO.getId()).get(0); 
     221        } 
     222 
     223        public ExonVO getLastExon(ProteinDomainVO domainVO) 
     224        { 
     225                return this.exonsPerDomainId.get(domainVO.getId()).get(this.exonsPerDomainId.get(domainVO.getId()).size() - 1); 
    216226        } 
    217227         
     
    221231        } 
    222232         
    223         public List<ProteinDomain> getProteinDomains() 
     233        public List<ProteinDomainVO> getProteinDomains() 
    224234        { 
    225235                return this.param_domains; 
  • molgenis_projects/col7a1/handwritten/java/service/MutationService.java

    r2659 r2666  
    66import java.util.List; 
    77 
     8import org.apache.commons.lang.StringUtils; 
    89import org.molgenis.framework.db.Database; 
    9  
     10import org.molgenis.framework.db.Query; 
     11 
     12import vo.ExonVO; 
    1013import vo.MutationVO; 
     14import vo.ProteinDomainVO; 
    1115import col7a1.Exon; 
    1216import col7a1.Gene; 
     
    2630        } 
    2731 
    28         //TODO: Create VO 
    29         public List<Exon> findExonsByProteinDomainId(Integer proteinDomainId) throws Exception 
    30         { 
    31                 return this.db.query(Exon.class).equals("proteinDomain", proteinDomainId).sortASC("number_").find(); 
     32        public List<ExonVO> findExonsByProteinDomainId(Integer proteinDomainId) throws Exception 
     33        { 
     34                List<Exon> exons = this.db.query(Exon.class).equals("proteinDomain", proteinDomainId).sortASC("number_").find(); 
     35                return this.toExonVOList(exons); 
     36        } 
     37 
     38        public List<MutationVO> findMutations(Integer id, String cdna_notation, String type, Boolean reportedSNP, Integer exonId) throws Exception 
     39        { 
     40                return this.findMutationById(id); 
     41//              Query<Mutation> query = this.db.query(Mutation.class).equals("id", id); 
     42                 
     43//              if (id != null) 
     44//                      query = query.equals("id", id); 
     45//              else if (StringUtils.isNotEmpty(cdna_notation)) 
     46//                      query = query.equals("cdna_notation", cdna_notation); 
     47//              else if (StringUtils.isNotEmpty(type)) 
     48//                      query = query.equals("type_", type); 
     49//              else if (exonId != null) 
     50//                      query = query.equals("exon", exonId); 
     51                //TODO: Howto AND? 
     52                //if (reportedSNP) 
     53                //      query = query.equals("reportedSNP", reportedSNP).and(); 
     54                 
     55//              List<Mutation> mutations = query.find(); 
     56//              return this.toMutationVOList(mutations); 
    3257        } 
    3358 
     
    5681        } 
    5782         
    58         //TODO: Create VO 
    59         public List<Exon> getExons() throws Exception 
    60         { 
    61                 return this.db.query(Exon.class).find(); 
     83        public List<ExonVO> getExons() throws Exception 
     84        { 
     85                List<Exon> exons = this.db.query(Exon.class).find(); 
     86                return this.toExonVOList(exons); 
    6287        } 
    6388 
     
    6893        } 
    6994 
    70         //TODO: Create VO 
    71         public List<ProteinDomain> getProteinDomains() throws Exception 
    72         { 
    73                 return this.db.query(ProteinDomain.class).find(); 
     95        public List<ProteinDomainVO> getProteinDomains() throws Exception 
     96        { 
     97                List<ProteinDomain> domains = this.db.query(ProteinDomain.class).find(); 
     98                return this.toProteinDomainVOList(domains); 
    7499        } 
    75100 
     
    83108        } 
    84109 
    85         public List<MutationVO> toMutationVOList(List<Mutation> mutations) 
    86         { 
    87                 List<MutationVO> mutationVOs = new ArrayList<MutationVO>(); 
    88                  
    89                 for (Mutation mutation : mutations) 
    90                         mutationVOs.add(this.toMutationVO(mutation)); 
    91                  
    92                 return mutationVOs; 
     110        public ExonVO toExonVO(Exon exon) 
     111        { 
     112                ExonVO exonVO = new ExonVO(); 
     113                 
     114                try 
     115                { 
     116                        Gene gene                   = this.db.findById(Gene.class, exon.getGene()); 
     117                        ProteinDomain proteinDomain = this.db.findById(ProteinDomain.class, exon.getProteinDomain()); 
     118                        exonVO.setCdna_position(exon.getCdna_position()); 
     119                        exonVO.setGdna_position(exon.getGdna_position()); 
     120                        exonVO.setGene(gene.getName()); 
     121                        exonVO.setId(exon.getId()); 
     122                        exonVO.setLength(exon.getLength()); 
     123                        exonVO.setName(exon.getName()); 
     124                        exonVO.setNumber_(exon.getNumber_()); 
     125                        exonVO.setProteinDomain(proteinDomain.getName()); 
     126                } 
     127                catch (Exception e) 
     128                { 
     129                        //TODO: What to do here? 
     130                } 
     131                 
     132                return exonVO; 
     133        } 
     134 
     135        public List<ExonVO> toExonVOList(List<Exon> exons) 
     136        { 
     137                List<ExonVO> exonVOs = new ArrayList<ExonVO>(); 
     138                 
     139                for (Exon exon : exons) 
     140                        exonVOs.add(this.toExonVO(exon)); 
     141                 
     142                return exonVOs; 
    93143        } 
    94144         
     
    112162                        mutationVO.setCodon_change(mutation.getCodon_change()); 
    113163                        mutationVO.setConsequence(mutation.getConsequence()); 
     164                        mutationVO.setDominance(mutation.getDominance()); 
    114165                        mutationVO.setConservedAA(mutation.getConservedAA()); 
    115166                        mutationVO.setEffectOnSplicing(mutation.getEffectOnSplicing()); 
     
    131182                return mutationVO; 
    132183        } 
     184         
     185        public List<MutationVO> toMutationVOList(List<Mutation> mutations) 
     186        { 
     187                List<MutationVO> mutationVOs = new ArrayList<MutationVO>(); 
     188                 
     189                for (Mutation mutation : mutations) 
     190                        mutationVOs.add(this.toMutationVO(mutation)); 
     191                 
     192                return mutationVOs; 
     193        } 
     194         
     195        public ProteinDomainVO toProteinDomainVO(ProteinDomain domain) 
     196        { 
     197                ProteinDomainVO domainVO = new ProteinDomainVO(); 
     198                 
     199                try 
     200                { 
     201                        ProteinDomain superDomain = this.db.findById(ProteinDomain.class, domain.getSuperDomain()); 
     202                        domainVO.setId(domain.getId()); 
     203                        domainVO.setName(domain.getName()); 
     204                        domainVO.setSuperDomain(superDomain.getName()); 
     205                } 
     206                catch (Exception e) 
     207                { 
     208                        //TODO: What to do here? 
     209                } 
     210                 
     211                return domainVO; 
     212        } 
     213         
     214        public List<ProteinDomainVO> toProteinDomainVOList(List<ProteinDomain> domains) 
     215        { 
     216                List<ProteinDomainVO> ProteinDomainVOs = new ArrayList<ProteinDomainVO>(); 
     217                 
     218                for (ProteinDomain domain : domains) 
     219                        ProteinDomainVOs.add(this.toProteinDomainVO(domain)); 
     220                 
     221                return ProteinDomainVOs; 
     222        } 
    133223} 
  • molgenis_projects/col7a1/handwritten/java/vo/MutationVO.java

    r2659 r2666  
    1313        private String _exon = null; 
    1414        private String _consequence = null; 
     15        private String _dominance = null; 
    1516        private Boolean _reportedSNP = null; 
    1617        private Boolean _conservedAA = null; 
     
    141142        } 
    142143 
     144        public String getDominance() 
     145        { 
     146                return this._dominance; 
     147        } 
     148         
     149        public void setDominance(String _dominance) 
     150        { 
     151                this._dominance = _dominance; 
     152        } 
     153 
    143154        /** 
    144155         * Get the Reported as SNP? Should be calculated automatically.. 
  • molgenis_projects/col7a1/molgenis_db.xml

    r2660 r2666  
    102102                <field name="exon" type="xref" xref_field="Exon.id" xref_label="name" description="Exon. Should be calculated automatically."/> 
    103103                <field name="consequence" type="enum" enum_options="[PTC,No initiation,Altered splicing,Missense]"/> 
     104                <field name="dominance" type="enum" enum_options="[dominant,recessive]" description="Is the mutation dominant or recessive?"/> 
    104105                <field name="reportedSNP" type="bool" description="Reported as SNP? Should be calculated automatically."/> 
    105106                <field name="conservedAA" type="bool" description="Conserved amino acid.? Should be calculated automatically."/> 
Note: See TracChangeset for help on using the changeset viewer.