diff --git a/uk/ac/sanger/artemis/chado/ChadoDemo.java b/uk/ac/sanger/artemis/chado/ChadoDemo.java index 17d49dc42ca379a10f1486817985c1669c5135e9..f533a4f8d462e42d1234e5c34b525044864fa869 100644 --- a/uk/ac/sanger/artemis/chado/ChadoDemo.java +++ b/uk/ac/sanger/artemis/chado/ChadoDemo.java @@ -358,8 +358,10 @@ public class ChadoDemo { feature = (ChadoFeature) featureList.get(i); - int fmin = feature.getFeatureloc().getFmin() + 1; - int fmax = feature.getFeatureloc().getFmax(); + // assume only one featureloc + ChadoFeatureLoc loc = (ChadoFeatureLoc)feature.getFeaturelocsForFeatureId().get(0); + int fmin = loc.getFmin() + 1; + int fmax = loc.getFmax(); rowData[i][0] = feature.getOrganism().getAbbreviation(); rowData[i][1] = feature.getUniquename(); @@ -367,7 +369,7 @@ public class ChadoDemo //rowData[i][2] = (String)cvterm.get(new Long(feature.getType_id())); rowData[i][3] = Integer.toString(feature.getId()); rowData[i][4] = fmin + "..." + fmax; - rowData[i][5] = Integer.toString(feature.getFeatureloc().getStrand()); + rowData[i][5] = Integer.toString(loc.getStrand()); rowData[i][6] = feature.getTimelastmodified().toString(); } return rowData; diff --git a/uk/ac/sanger/artemis/chado/ChadoFeature.java b/uk/ac/sanger/artemis/chado/ChadoFeature.java index dbd304096d2fe0f05db45bc0d823bd220df3df9b..eb24f47edcf007295ae2113c564c7cbef6492a8b 100644 --- a/uk/ac/sanger/artemis/chado/ChadoFeature.java +++ b/uk/ac/sanger/artemis/chado/ChadoFeature.java @@ -26,7 +26,9 @@ package uk.ac.sanger.artemis.chado; import java.sql.Timestamp; +import java.util.HashSet; import java.util.Hashtable; +import java.util.Set; import java.util.Vector; import java.util.List; @@ -56,7 +58,7 @@ public class ChadoFeature private ChadoCvterm cvterm; /** feature property */ private ChadoFeatureProp featureprop; - /** feature location */ + /** feature location (for a given srcfeature) */ private ChadoFeatureLoc featureloc; /** feature relationship */ private ChadoFeatureRelationship feature_relationship; @@ -72,9 +74,13 @@ public class ChadoFeature private List featureRelationshipsForObjectId; /** list of ChadoFeatureRelationship parent */ private List featureRelationshipsForSubjectId; - + /** list of feature dbxrefs (ChadoFeatureDbxref) */ + private List featureDbxrefs; + /** list of feature locations for a feature_id */ + private List featurelocsForFeatureId; private List featureCvterms = new Vector(); + /** * Get the feature_id. * @return the feature_id @@ -361,28 +367,80 @@ public class ChadoFeature } } + /** + * Get a list of <code>ChadoFeatureRelationship</code> children + * @return + */ public List getFeatureRelationshipsForObjectId() { return featureRelationshipsForObjectId; } + /** + * Set a list of <code>ChadoFeatureRelationship</code> children + * @param featureRelationshipsForObjectId + */ public void setFeatureRelationshipsForObjectId( List featureRelationshipsForObjectId) { this.featureRelationshipsForObjectId = featureRelationshipsForObjectId; } + /** + * Get a list of <code>ChadoFeatureRelationship</code> parent + * @return + */ public List getFeatureRelationshipsForSubjectId() { return featureRelationshipsForSubjectId; } + /** + * Set a list of <code>ChadoFeatureRelationship</code> parent + * @param featureRelationshipsForSubjectId + */ public void setFeatureRelationshipsForSubjectId( List featureRelationshipsForSubjectId) { this.featureRelationshipsForSubjectId = featureRelationshipsForSubjectId; } + /** + * Get a list of feature dbxrefs (<code>ChadoFeatureDbxref</code>) + * @return + */ + public List getFeatureDbxrefs() + { + return featureDbxrefs; + } + + /** + * Set a list of feature dbxrefs (<code>ChadoFeatureDbxref</code>) + * @param featureDbxrefs + */ + public void setFeatureDbxrefs(List featureDbxrefs) + { + this.featureDbxrefs = featureDbxrefs; + } + + /** + * Get list of feature locations for a feature_id + * @return + */ + public List getFeaturelocsForFeatureId() + { + return featurelocsForFeatureId; + } + + /** + * Set a list of feature locations for a feature_id + * @param featurelocsForFeatureId + */ + public void setFeaturelocsForFeatureId(List featurelocsForFeatureId) + { + this.featurelocsForFeatureId = featurelocsForFeatureId; + } + /** * Used in merging the qualifiers to store them as a <code>Hashtable</code> of * the cvterm type_id (of the property name) and the property values as a @@ -419,5 +477,23 @@ public class ChadoFeature { return qualifiers; } + + /** + * Utility for finding a feature location from a List that corresponds + * to a particular srcfeature. + * @param locs List of ChadoFeatureLoc + * @param srcfeature_id srcfeature id + * @return + */ + public static ChadoFeatureLoc getFeatureLoc(List locs, int srcfeature_id) + { + for(int i=0; i<locs.size(); i++) + { + ChadoFeatureLoc loc = (ChadoFeatureLoc)locs.get(i); + if(loc.getSrcfeature_id() == srcfeature_id) + return loc; + } + return null; + } } diff --git a/uk/ac/sanger/artemis/chado/IBatisDAO.java b/uk/ac/sanger/artemis/chado/IBatisDAO.java index 7276ff54bb10bc9837e3087363b69b9986543da5..ad615761ca73533c7eee7db8785a74248f8a59b1 100644 --- a/uk/ac/sanger/artemis/chado/IBatisDAO.java +++ b/uk/ac/sanger/artemis/chado/IBatisDAO.java @@ -181,7 +181,7 @@ public class IBatisDAO implements ChadoDAO feature.setSchema(schema); feature.setFeatureCvterms(cvterm_ids); - return sqlMap.queryForList("getSchemaResidueFeatures", + return sqlMap.queryForList("getResidueFeatures", feature); }