private static Transcript makeTranscript(Feature feature) { Transcript transcript = new Transcript(); transcript.setFmin(feature.getRankZeroFeatureLoc().getFmin()); transcript.setFmax(feature.getRankZeroFeatureLoc().getFmax()); transcript.setUniqueName(feature.getDisplayName()); Set<TranscriptComponent> exons = new HashSet<TranscriptComponent>(); for (FeatureRelationship fr : feature.getFeatureRelationshipsForObjectId()) { Feature relatedFeature = fr.getSubjectFeature(); String relatedFeatureName = relatedFeature.getType().getName(); if (relatedFeatureName.equals("polypeptide")) { transcript.setProtein(relatedFeature); } else if (relatedFeatureName.equals("exon")) { FeatureLoc otherFeatLoc = relatedFeature.getRankZeroFeatureLoc(); exons.add(new Exon(otherFeatLoc.getFmin(), otherFeatLoc.getFmax())); } } transcript.setComponents(exons); Feature protein = transcript.getProtein(); if (protein != null) { List<String> products = new ArrayList<String>(); for (FeatureCvTerm fcvt : protein.getFeatureCvTerms()) { CvTerm featCvTerm = fcvt.getType(); if (featCvTerm.getCv().getName().equals("genedb_products")) { products.add(featCvTerm.getName()); } } transcript.setProducts(products); } return transcript; }
private Collection<String> populateFromFeatureCvTerms(String cvNamePrefix) { List<String> ret = new ArrayList<String>(); for (FeatureCvTerm fct : getFeatureCvTermsFilteredByCvNameStartsWith(cvNamePrefix)) { ret.add( String.format( "%s %s", fct.getCvTerm().getName(), fct.getCvTerm().getDbXRef().getAccession())); } return ret; }
@Transient public List<String> getProducts() { List<String> products = new ArrayList<String>(); for (FeatureCvTerm featureCvTerm : this.getFeatureCvTerms()) { if (featureCvTerm.getType().getCv().getName().equals("genedb_products")) { products.add(featureCvTerm.getType().getName()); } } return products; }