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; }
/** * 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; }
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 ); } }
@Override public int hashCode() { int result = fromIntervalStart; result = 31 * result + fromIntervalEnd; result = 31 * result + toIntervalStart; result = 31 * result + toIntervalEnd; result = 31 * result + ( undetermined ? 1 : 0 ); result = 31 * result + ( linked ? 1 : 0 ); result = 31 * result + ( fromCvFuzzyType != null ? fromCvFuzzyType.hashCode() : 0 ); result = 31 * result + ( toCvFuzzyType != null ? toCvFuzzyType.hashCode() : 0 ); result = 31 * result + ( sequence != null ? sequence.hashCode() : 0 ); result = 31 * result + ( fullSequence != null ? fullSequence.hashCode() : 0 ); result = 31 * result + ( upStreamSequence != null ? upStreamSequence.hashCode() : 0 ); result = 31 * result + ( downStreamSequence != null ? downStreamSequence.hashCode() : 0 ); // Include the feature this range is linked to. result = 31 * result + ( feature != null ? feature.getAc() != null? feature.getAc().hashCode() : feature.hashCode( true, false ) : 0 ); return result; }
if ( feature.getCvFeatureType() != null ) { CvObject2xmlFactory.getInstance( session ).create( session, element, feature.getCvFeatureType() ); } else { System.err.println( "There should be a CvFeatureType in that Feature( " + feature.getAc() + " )." ); if ( feature.getCvFeatureIdentification() != null ) { CvObject2xmlFactory.getInstance( session ).create( session, element, feature.getCvFeatureIdentification() ); Collection ranges = feature.getRanges();
PsiConverterUtils.populateAttributes(intactObject, psiFeature, annotationConverter); if (intactObject.getCvFeatureIdentification()!= null) { FeatureDetectionMethod featureMethod = featureDetMethodConverter.intactToPsi(intactObject.getCvFeatureIdentification()); psiFeature.setFeatureDetectionMethod(featureMethod); if (intactObject.getCvFeatureType() != null){ FeatureType featureType = featureTypeConverter.intactToPsi(intactObject.getCvFeatureType()); psiFeature.setFeatureType(featureType); log.error("Feature without feature type " + intactObject.getShortLabel()); ranges = intactObject.getRanges(); log.error("Feature without any ranges : " + intactObject.getShortLabel());
Component component = compPersister.syncIfTransient(intactObject.getComponent()); intactObject.setComponent(component); if (intactObject.getCvFeatureIdentification() != null) { CvFeatureIdentification syncedFeatureDetMethod = (CvFeatureIdentification) cvObjectPersister.syncIfTransient(intactObject.getCvFeatureIdentification()); intactObject.setCvFeatureIdentification(syncedFeatureDetMethod); if (intactObject.getCvFeatureType() != null) { CvFeatureType syncedFeatureType = (CvFeatureType) cvObjectPersister.syncIfTransient(intactObject.getCvFeatureType()); intactObject.setCvFeatureType(syncedFeatureType); for (Range range : intactObject.getRanges()) { if ( range.getFromCvFuzzyType() != null ) { CvFuzzyType synchedFromFuzzyType = (CvFuzzyType) cvObjectPersister.syncIfTransient(range.getFromCvFuzzyType());
@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()); } } }
Feature feature = new Feature( institution, featureTag.getShortlabel(), component, featureType ); feature.setFullName( featureTag.getFullname() ); detectionId = featureTag.getFeatureDetection().getPsiDefinition().getId(); CvFeatureIdentification featureDetection = FeatureChecker.getCvFeatureIdentification( detectionId ); feature.setCvFeatureIdentification( featureDetection ); xrefTag.getVersion(), qualifier ); feature.addXref( xref ); IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getXrefDao().persist( xref ); feature.addRange( range );
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; } }
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); } }
String text = null; if (feature.getCvFeatureType() != null && feature.getCvFeatureType().getFullName() != null){ name = feature.getCvFeatureType().getFullName(); else if (feature.getCvFeatureType() != null && feature.getCvFeatureType().getShortLabel() != null){ name = feature.getCvFeatureType().getShortLabel(); List<String> rangesMitab = new ArrayList<String>(feature.getRanges().size()); for (Range range : feature.getRanges()){ String rangeAsString = FeatureUtils.convertRangeIntoString(range); if (rangeAsString != null){ for (FeatureXref refs : feature.getXrefs()){
Feature feature = (Feature) iterator1.next(); Feature boundDomain = feature.getBoundDomain(); if ( boundDomain == null ) { continue; // that feature doesn't interact with an other one, skip it. Component boundComponent = boundDomain.getComponent(); Interactor interactor2 = boundComponent.getInteractor();
public Collection<GeneralMessage> check( Feature feature ) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); if ( feature.getCvFeatureType() == null ) { messages.add( new GeneralMessage( MessageDefinition.FEATURE_WITHOUT_TYPE, feature ) ); } return messages; } }
feature.setOwner(getInstitution()); feature.setCvFeatureType(featureType); log.error("Feature without feature type : " + feature.getShortLabel()); feature.setCvFeatureIdentification(cvFeatureDetMethod); log.error("Feature without any ranges : " + feature.getShortLabel()); feature.addRange(range);
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; } }
if ( !component.equals( feature.getComponent() ) ) { return false; if ( feature.getComponent() != null ) { return false; return CollectionUtils.isEqualCollection( ranges, feature.getRanges() );
if (component == null && feature.getComponent() == null) { } else if ((component == null && feature.getComponent() != null) || (component != null && feature.getComponent() == null)) { return false; } else if (component.getAc() != null && feature.getComponent().getAc() != null) { if (!component.getAc().equals(feature.getComponent().getAc())) { return false; if ( binds != null ? !binds.equals( feature.binds, false, false ) : feature.binds != null ) return false;
Feature feature = featureConverter.psiToIntact(psiFeature); component.getBindingDomains().add(feature); feature.setComponent(component); for (Range r : feature.getRanges()){