uk.ac.ebi.intact.model.Feature.getRanges()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.7k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中uk.ac.ebi.intact.model.Feature.getRanges()方法的一些代码示例,展示了Feature.getRanges()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getRanges()方法的具体详情如下:
包路径:uk.ac.ebi.intact.model.Feature
类名称:Feature
方法名:getRanges

Feature.getRanges介绍

[英]Provides the List of Range objects related to a Feature instance.
[中]提供与要素实例相关的范围对象列表。

代码示例

代码示例来源:origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

public Collection<GeneralMessage> check(Feature feature) throws SanityRuleException {
    Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();
    if(feature.getRanges().isEmpty()){
      messages.add(new GeneralMessage( MessageDefinition.FEATURE_WITHOUT_RANGE, feature));
    }
    return messages;
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

protected void copyFeature( Feature source, Feature target ) {
  //copyProperty(source, "component", target);
  copyProperty(source, "cvFeatureIdentification", target);
  copyProperty(source, "cvFeatureType", target);
  copyCollection( source.getRanges(), target.getRanges() );
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

protected void copyFeature( Feature source, Feature target ) {
  //copyProperty(source, "component", target);
  copyProperty(source, "cvFeatureIdentification", target);
  copyProperty(source, "cvFeatureType", target);
  copyCollection( source.getRanges(), target.getRanges() );
}

代码示例来源:origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

public Collection<GeneralMessage> check( Feature feature ) throws SanityRuleException {
    Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>();

    if ( feature.getCvFeatureType() == null ) {
      return messages;
    }

    String cvFeatureTypeIdentityMi = feature.getCvFeatureType().getMiIdentifier();

    if ( CvFeatureType.MUTATION_DECREASING_MI_REF.equals( cvFeatureTypeIdentityMi ) ||
       CvFeatureType.MUTATION_INCREASING_MI_REF.equals( cvFeatureTypeIdentityMi ) ||
       CvFeatureType.MUTATION_MI_REF.equals( cvFeatureTypeIdentityMi ) ||
       CvFeatureType.MUTATION_DISRUPTING_MI_REF.equals( cvFeatureTypeIdentityMi )
        ) {
      Collection<Range> ranges = feature.getRanges();
      for ( Range range : ranges ) {
        // tointervalstart - r.fromintervalend
        int width = range.getToIntervalStart() - range.getFromIntervalEnd();
        if ( width > 2 ) {
          messages.add( new GeneralMessage(MessageDefinition.FEATURE_DELETION_FEATURE_TOO_LONG, feature ) );
        }
      }
    }
    return messages;
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * @param protein : the protein to check
 * @return a set of the protein feature ranges which are overlapping or out of bound
 */
public static Set<Range> getBadRanges(Protein protein) {
  Collection<Component> components = protein.getActiveInstances();
  Set<Range> badRanges = new HashSet<Range>();
  for (Component component : components) {
    Collection<Feature> features = component.getFeatures();
    for (Feature feature : features) {
      Collection<Range> ranges = feature.getRanges();
      for (Range range : ranges) {
        if (isABadRange(range, protein.getSequence())) {
          badRanges.add(range);
        }
      }
    }
  }
  return badRanges;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * @param protein : the protein to check
 * @return a set of the protein features containing bad ranges (overlapping or out of bound)
 */
public static Set<Feature> getFeaturesWithBadRanges(Protein protein) {
  Collection<Component> components = protein.getActiveInstances();
  Set<Feature> badFeatures = new HashSet<Feature>();
  for (Component component : components) {
    Collection<Feature> features = component.getBindingDomains();
    for (Feature feature : features) {
      Collection<Range> ranges = feature.getRanges();
      for (Range range : ranges) {
        if (isABadRange(range, protein.getSequence())) {
          badFeatures.add(feature);
          break;
        }
      }
    }
  }
  return badFeatures;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * @param protein : the protein to check
 * @return a set of the protein feature ranges which are overlapping or out of bound
 */
public static Set<Range> getBadRanges(Protein protein) {
  Collection<Component> components = protein.getActiveInstances();
  Set<Range> badRanges = new HashSet<Range>();
  for (Component component : components) {
    Collection<Feature> features = component.getFeatures();
    for (Feature feature : features) {
      Collection<Range> ranges = feature.getRanges();
      for (Range range : ranges) {
        if (isABadRange(range, protein.getSequence())) {
          badRanges.add(range);
        }
      }
    }
  }
  return badRanges;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * Retrieves the ranges from a feature, initializing them if necessary.
 *
 * @param feature the feature
 * @return The returned ranges are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Range> ensureInitializedRanges(Feature feature) {
  Collection<Range> ranges;
  if (IntactCore.isInitialized(feature.getRanges())) {
    ranges = feature.getRanges();
  } else {
    ranges = IntactContext.getCurrentInstance().getDaoFactory().getRangeDao().getByFeatureAc(feature.getAc());
  }
  return ranges;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * @param protein : the protein to check
 * @return a set of the protein features containing bad ranges (overlapping or out of bound)
 */
public static Set<Feature> getFeaturesWithBadRanges(Protein protein) {
  Collection<Component> components = protein.getActiveInstances();
  Set<Feature> badFeatures = new HashSet<Feature>();
  for (Component component : components) {
    Collection<Feature> features = component.getBindingDomains();
    for (Feature feature : features) {
      Collection<Range> ranges = feature.getRanges();
      for (Range range : ranges) {
        if (isABadRange(range, protein.getSequence())) {
          badFeatures.add(feature);
          break;
        }
      }
    }
  }
  return badFeatures;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * Retrieves the ranges from a feature, initializing them if necessary.
 *
 * @param feature the feature
 * @return The returned ranges are ensured to be initialized
 * @since 2.4.0
 */
public static Collection<Range> ensureInitializedRanges(Feature feature) {
  Collection<Range> ranges;
  if (IntactCore.isInitialized(feature.getRanges())) {
    ranges = feature.getRanges();
  } else {
    ranges = IntactContext.getCurrentInstance().getDaoFactory().getRangeDao().getByFeatureAc(feature.getAc());
  }
  return ranges;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

private void synchronizeFeature( Feature feature, boolean synchronizeAnnotatedAttributes ) {
  feature.setBoundDomain( synchronize( feature.getBoundDomain() ) );
  feature.setComponent( synchronize( feature.getComponent() ) );
  feature.setCvFeatureIdentification( synchronize( feature.getCvFeatureIdentification() ) );
  feature.setCvFeatureType( synchronize( feature.getCvFeatureType() ) );
  // cannot call setRanges in interaction because of orphan relationship limitation
  if (IntactCore.isInitializedAndDirty(feature.getRanges())){
    Collection<Range> ranges = synchronizeRanges(feature.getRanges(), feature);
    feature.getRanges().clear();
    feature.getRanges().addAll(ranges);
  }
  if (synchronizeAnnotatedAttributes){
    synchronizeAnnotatedObjectCommons( feature );
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

private void synchronizeFeature( Feature feature, boolean synchronizeAnnotatedAttributes ) {
  feature.setBoundDomain( synchronize( feature.getBoundDomain() ) );
  feature.setComponent( synchronize( feature.getComponent() ) );
  feature.setCvFeatureIdentification( synchronize( feature.getCvFeatureIdentification() ) );
  feature.setCvFeatureType( synchronize( feature.getCvFeatureType() ) );
  // cannot call setRanges in interaction because of orphan relationship limitation
  if (IntactCore.isInitializedAndDirty(feature.getRanges())){
    Collection<Range> ranges = synchronizeRanges(feature.getRanges(), feature);
    feature.getRanges().clear();
    feature.getRanges().addAll(ranges);
  }
  if (synchronizeAnnotatedAttributes){
    synchronizeAnnotatedObjectCommons( feature );
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

protected void traverseFeature(Feature feature, IntactVisitor ... visitors) {
  if (feature == null) return;
  for (IntactVisitor visitor : visitors) {
    visitor.visitFeature(feature);
  }
  // check if this element has been traversed already, to avoid cyclic recursion
  if (recursionChecker.isAlreadyTraversed(feature)) {
    return;
  }
  traverse(feature.getCvFeatureType(), visitors);
  traverse(feature.getCvFeatureIdentification(), visitors);
  for (Range range : feature.getRanges()) {
    traverse(range, visitors);
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

protected void traverseFeature(Feature feature, IntactVisitor ... visitors) {
  if (feature == null) return;
  for (IntactVisitor visitor : visitors) {
    visitor.visitFeature(feature);
  }
  // check if this element has been traversed already, to avoid cyclic recursion
  if (recursionChecker.isAlreadyTraversed(feature)) {
    return;
  }
  traverse(feature.getCvFeatureType(), visitors);
  traverse(feature.getCvFeatureIdentification(), visitors);
  for (Range range : feature.getRanges()) {
    traverse(range, visitors);
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

protected UniquenessStringBuilder createUniquenessString(Feature feature) {
  if (keyExists(feature)) {
    UniquenessStringBuilder builder = getKey(feature);
    if (builder != null){
      return builder;
    }
    else{
      identityToCrc.remove(System.identityHashCode(feature));
    }
  }
  UniquenessStringBuilder sb = new UniquenessStringBuilder();
  putKey(feature, sb);
  if (feature == null) return sb;
  // short label
  // We need to add the short label for the feature because in mutations in the same amino acid is the only way to
  // distinguish between two features when the AC is not assigned yet.
  sb.append(feature.getShortLabel());
  // feature type
  sb.append(createUniquenessString(feature.getCvFeatureType()));
  // feature identification
  sb.append(createUniquenessString(feature.getCvFeatureIdentification()));
  // ranges
  List<Range> ranges = new ArrayList<Range>(feature.getRanges());
  Collections.sort(ranges, new RangeComparator());
  for (Range range : ranges) {
    sb.append(createUniquenessString(range));
  }
  return sb;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

protected UniquenessStringBuilder createUniquenessString(Feature feature) {
  if (keyExists(feature)) {
    UniquenessStringBuilder builder = getKey(feature);
    if (builder != null){
      return builder;
    }
    else{
      identityToCrc.remove(System.identityHashCode(feature));
    }
  }
  UniquenessStringBuilder sb = new UniquenessStringBuilder();
  putKey(feature, sb);
  if (feature == null) return sb;
  // short label
  // We need to add the short label for the feature because in mutations in the same amino acid is the only way to
  // distinguish between two features when the AC is not assigned yet.
  sb.append(feature.getShortLabel());
  // feature type
  sb.append(createUniquenessString(feature.getCvFeatureType()));
  // feature identification
  sb.append(createUniquenessString(feature.getCvFeatureIdentification()));
  // ranges
  List<Range> ranges = new ArrayList<Range>(feature.getRanges());
  Collections.sort(ranges, new RangeComparator());
  for (Range range : ranges) {
    sb.append(createUniquenessString(range));
  }
  return sb;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-persister

@Override
protected void saveOrUpdateAttributes(Feature intactObject) throws PersisterException {
  super.saveOrUpdateAttributes(intactObject);
  ComponentPersister.getInstance().saveOrUpdate(intactObject.getComponent());
  CvObjectPersister cvObjectPersister = CvObjectPersister.getInstance();
  if (intactObject.getCvFeatureIdentification() != null) {
    cvObjectPersister.saveOrUpdate(intactObject.getCvFeatureIdentification());
  }
  if (intactObject.getCvFeatureType() != null) {
    cvObjectPersister.saveOrUpdate(intactObject.getCvFeatureType());
  }
  for (Range range : intactObject.getRanges()) {
    if ( range.getFromCvFuzzyType() != null ) {
      cvObjectPersister.saveOrUpdate(range.getFromCvFuzzyType());
    }
    if ( range.getToCvFuzzyType() != null ) {
      cvObjectPersister.saveOrUpdate(range.getToCvFuzzyType());
    }
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

public Feature cloneFeature(Feature feature) throws IntactClonerException {
  if (feature == null) return null;
  Feature clone = new Feature();
  clonerManager.addClone(feature, clone);
  clone.setOwner(clone(feature.getOwner()));
  clone.setShortLabel(feature.getShortLabel());
  clone.setCvFeatureType(clone(feature.getCvFeatureType()));
  clone.setCvFeatureIdentification(clone(feature.getCvFeatureIdentification()));
  if (isCollectionClonable(feature.getRanges())) {
    Collection<Range> ranges = IntactCore.ensureInitializedRanges(feature);
    for (Range range : ranges) {
      clone.addRange(clone(range));
    }
  }
  clone.setComponent(clone(feature.getComponent()));
  return clone;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

public Feature cloneFeature(Feature feature) throws IntactClonerException {
  if (feature == null) return null;
  Feature clone = new Feature();
  clonerManager.addClone(feature, clone);
  clone.setOwner(clone(feature.getOwner()));
  clone.setShortLabel(feature.getShortLabel());
  clone.setCvFeatureType(clone(feature.getCvFeatureType()));
  clone.setCvFeatureIdentification(clone(feature.getCvFeatureIdentification()));
  if (isCollectionClonable(feature.getRanges())) {
    Collection<Range> ranges = IntactCore.ensureInitializedRanges(feature);
    for (Range range : ranges) {
      clone.addRange(clone(range));
    }
  }
  clone.setComponent(clone(feature.getComponent()));
  return clone;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-persister

for (Range range : intactObject.getRanges()) {
  if ( range.getFromCvFuzzyType() != null ) {
    CvFuzzyType synchedFromFuzzyType = (CvFuzzyType) cvObjectPersister.syncIfTransient(range.getFromCvFuzzyType());

相关文章