Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
  /**
   * Returns the featurelocs of amino acid features located on the polypeptide.
   *
   * @param <T> the type of feature, must be a subclass of amino acid feature For example <code>
   *     ModifiedAminoAcidFeature.class</code>.
   * @return a sorted set of featurelocs
   */
  @Transient
  public <T extends AminoAcid> List<FeatureLoc> getAminoAcidFeatureLocs(Class<T> type) {
    List<FeatureLoc> aminoAcidFeatureLocs = new ArrayList<FeatureLoc>();

    for (FeatureLoc domainLoc : this.getFeatureLocsForSrcFeatureId()) {
      Feature domain = domainLoc.getFeature();
      if (type.isAssignableFrom(domain.getClass())) {
        aminoAcidFeatureLocs.add(domainLoc);
      }
    }

    return aminoAcidFeatureLocs;
  }
Exemplo n.º 3
0
  /**
   * Get all the polypeptide regions of the specified type.
   *
   * @param <T> the type of region. Must be a subclass of <code>PolypeptideRegion</code>
   * @param type a class object representing the region type. For example, <code>
   *     PolypeptideDomain.class</code>
   * @return a sorted set of those regions of the requested type
   */
  @Transient
  public <T extends PolypeptideRegion> SortedSet<T> getRegions(Class<T> type) {
    SortedSet<T> domains = new TreeSet<T>();

    for (FeatureLoc domainLoc : this.getFeatureLocsForSrcFeatureId()) {
      Feature domain = domainLoc.getFeature();
      if (type.isAssignableFrom(domain.getClass())) {
        domains.add(type.cast(domain));
      }
    }

    return domains;
  }
Exemplo n.º 4
0
 /**
  * Get a collection of the ProteinMatch features that represent similarities between this
  * polypeptide and another (as defined by a /similarity qualifier in a PSU EMBL file).
  *
  * @return a collection of the ProteinMatch features that represent similarities between this
  *     polypeptide and another.
  */
 @Transient
 public Collection<ProteinMatch> getSimilarityMatches() {
   List<ProteinMatch> proteinMatches = new ArrayList<ProteinMatch>();
   for (FeatureLoc featureLoc : this.getFeatureLocsForSrcFeatureId()) {
     if (featureLoc.getRank() != 0) {
       continue;
     }
     Feature feature = featureLoc.getFeature();
     if (feature instanceof ProteinMatch) {
       proteinMatches.add((ProteinMatch) feature);
     } else {
       logger.debug(
           String.format(
               "getSimilarityMatches: %s is '%s', not ProteinMatch", feature, feature.getClass()));
     }
   }
   return proteinMatches;
 }
Exemplo n.º 5
0
  protected BasicGene geneFromFeature(Feature feat) {
    BasicGene ret = new Gene();

    ret.setUniqueName(feat.getUniqueName());
    ret.setFeatureId(feat.getFeatureId());

    List<String> synonyms = new ArrayList<String>();
    for (FeatureSynonym fs : feat.getFeatureSynonyms()) {
      String type = fs.getSynonym().getType().getName();
      if (type.equals("synonym")) {
        synonyms.add(fs.getSynonym().getName());
      }
    }
    ret.setSynonyms(synonyms);

    if (StringUtils.hasText(feat.getName())) {
      ret.setName(feat.getName());
    }

    for (FeatureRelationship fr : feat.getFeatureRelationshipsForObjectId()) {
      Feature otherFeat = fr.getSubjectFeature();
      if (otherFeat instanceof org.gmod.schema.feature.Transcript) {
        ret.addTranscript(makeTranscript(otherFeat));
      }
    }

    ret.setOrganism(feat.getOrganism().getCommonName());

    FeatureLoc loc = feat.getRankZeroFeatureLoc();
    Feature chromosomeFeature = loc.getSourceFeature();
    Chromosome chromosome =
        new Chromosome(
            chromosomeFeature.getDisplayName(),
            chromosomeFeature.getFeatureId(),
            chromosomeFeature.getSeqLen());
    ret.setChromosome(chromosome);
    ret.setStrand(loc.getStrand());
    ret.setFmin(loc.getFmin());
    ret.setFmax(loc.getFmax());

    return ret;
  }
Exemplo n.º 6
0
 protected Gap gapFromFeature(Feature feat) {
   FeatureLoc loc = feat.getRankZeroFeatureLoc();
   return new Gap(feat.getUniqueName(), loc.getFmin(), loc.getFmax());
 }