public psidev.psi.mi.xml.model.Names fromJaxb( psidev.psi.mi.xml253.jaxb.NamesType jNames ) { if ( jNames == null ) { throw new IllegalArgumentException( "You must give a non null JAXB Names." ); } psidev.psi.mi.xml.model.Names mNames = new psidev.psi.mi.xml.model.Names(); // Initialise the model reading the Jaxb object // 1. set attributes // shortlabel mNames.setShortLabel( jNames.getShortLabel() ); // fullname mNames.setFullName( jNames.getFullName() ); // 2. set encapsulated objects // aliases for ( NamesType.Alias jAlias : jNames.getAlias() ) { mNames.getAliases().add( aliasConverter.fromJaxb( jAlias ) ); } return mNames; }
public psidev.psi.mi.xml253.jaxb.NamesType toJaxb( psidev.psi.mi.xml.model.Names mNames ) { if ( mNames == null ) { throw new IllegalArgumentException( "You must give a non null model Names." ); } psidev.psi.mi.xml253.jaxb.NamesType jNames = new psidev.psi.mi.xml253.jaxb.NamesType(); // Initialise the JAXB object reading the model // 1. set attributes // shortlabel jNames.setShortLabel( mNames.getShortLabel() ); // fullname jNames.setFullName( mNames.getFullName() ); // 2. set encapsulated objects // aliases for ( psidev.psi.mi.xml.model.Alias mAlias : mNames.getAliases() ) { jNames.getAlias().add( aliasConverter.toJaxb( mAlias ) ); } return jNames; } }
private String getName(Names name) { if (name.hasShortLabel()) { return name.getShortLabel(); } else if (name.hasFullName()) { return name.getFullName(); } return null; }
public static Names createNames(String name, String description) { Names names = new Names(); names.setShortLabel(name); names.setFullName(description); return names; }
public static String getShortLabelFromNames(Names names) { if ( names == null || names.getShortLabel() == null ) { return IntactConverterUtils.createTempShortLabel(); } String shortLabel = names.getShortLabel(); String fullName = names.getFullName(); // If the short label is null, but not the full name, use the full name as short label. // Truncate the full name if its length > SHORT_LABEL_LENGTH if (shortLabel == null) { if (fullName != null) { if (log.isWarnEnabled()) log.warn("Short label is null. Using full name as short label: " + fullName); shortLabel = fullName; } else { throw new NullPointerException("Both fullName and shortLabel are null"); } } if (shortLabel.length() > AnnotatedObject.MAX_SHORT_LABEL_LEN) { shortLabel = shortLabel.substring(0, AnnotatedObject.MAX_SHORT_LABEL_LEN); if (log.isWarnEnabled()) { String msg = "\tFull name to short label truncated to: '" + shortLabel+"'"; if (ConverterContext.getInstance().getLocation() != null && ConverterContext.getInstance().getLocation().getCurrentLocation() != null) { msg = msg + " in location: "+ ConverterContext.getInstance().getLocation().getCurrentLocation().pathFromRootAsString(); } log.warn(msg); } } return shortLabel; }
interactorName = new Names(); interactorName.setShortLabel(shortLabel); } else { log.debug("No valid uniprot interactorName found. default : 1.interactor identifier of db = "+interactor.getIdentifiers().iterator().next().getDatabase()); interactorName = new Names(); interactorName.setShortLabel(interactor.getIdentifiers().iterator().next().getIdentifier()); interactorName.getAliases().addAll(aliases);
Names psiNames = interactor.getNames(); if (psiNames != null) { name = (psiNames.hasFullName()) ? psiNames.getFullName() : null; shortName = (psiNames.hasShortLabel()) ? psiNames.getShortLabel() : null; if (psiNames.hasAliases()) { for (Alias alias : psiNames.getAliases()) { if (alias.hasValue()) { synonyms.add(alias.getValue());
String shortLabel = interactionName.getShortLabel().concat("-".concat(String.valueOf(numberOfInteraction))); numberOfInteraction++; interactionName.setShortLabel(shortLabel); interaction.setNames(interactionName); unit.setNames(new Names()); unit.getNames().setShortLabel(tabConfidence.getType()); if (tabConfidence.getText() != null) unit.getNames().setFullName(tabConfidence.getText());
/** * @param interaction * @return names of these interaction. */ private Names getInteractionName(Interaction interaction) { Names interactionName = null; Collection<Participant> participants = interaction.getParticipants(); for (Participant participant : participants) { if (interactionName != null) { String shortLabel = interactionName.getShortLabel().concat("-"); shortLabel = shortLabel.concat(participant.getInteractor().getNames().getShortLabel().split("_")[0]); interactionName.setShortLabel(shortLabel); } if (interactionName == null) { interactionName = new Names(); interactionName.setShortLabel(participant.getInteractor().getNames().getShortLabel().split("_")[0]); } } if (interactionName == null) { log.warn("Interaction don't have a name"); } return interactionName; }
private void mapInteractionType(final Collection<InteractionType> types, final CyTable table, final Long suid) { if(types == null) return; final List<String> typeList = new ArrayList<String>(); for(final InteractionType type: types) { final String label = type.getNames().getShortLabel(); typeList.add(label); } table.getRow(suid).set(INTERACTION_TYPE, typeList); }
public static void populateNames(Names names, AnnotatedObject<?, ?> annotatedObject) { String shortLabel = getShortLabelFromNames(names); if (names == null && (annotatedObject instanceof Experiment) ) { shortLabel = createExperimentTempShortLabel(); } if ( ! ( annotatedObject instanceof Institution ) ) { if ( shortLabel != null ) { shortLabel = shortLabel.toLowerCase(); } } annotatedObject.setShortLabel(shortLabel); if (names != null) { annotatedObject.setFullName(names.getFullName()); Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(annotatedObject.getClass()); AliasConverter aliasConverter = new AliasConverter(getInstitution(annotatedObject), aliasClass); populateAliases(names.getAliases(), annotatedObject, aliasConverter); } }
names = new Names(); names.setShortLabel(shortLabel);
/** * Get the interactor's shortlabel. * @param interactor * @return the name of null of no shortlabel available. */ private String getName(Interactor interactor) { if( interactor.getNames() != null ) { if ( interactor.getNames().hasShortLabel() ) { return interactor.getNames().getShortLabel(); } } return null; } }
/** * Collect all DbReference under an xref. * * @param names aliases holder. * * @return a non null collection. */ @Deprecated public static Collection<Alias> getAllAliases( Names names ) { ArrayList<Alias> aliases = new ArrayList<Alias>( names.getAliases().size() ); for ( Alias alias : names.getAliases() ) { aliases.add( alias ); } return aliases; } }
experiment.setFullName(psiObject.getNames().getFullName());
private boolean isStatusOfType( RangeStatus status, String psimiName, String psimiIdentifier ) { boolean hasMiNumber = false; if (status.getXref() != null){ if (status.getXref().getPrimaryRef() != null){ final DbReference ref = status.getXref().getPrimaryRef(); if (ref.getDbAc() != null){ if (ref.getDbAc().equals(CvDatabase.PSI_MI_MI_REF)){ hasMiNumber = true; } else if (ref.getDb().equalsIgnoreCase(CvDatabase.PSI_MI)){ hasMiNumber = true; } } } } if ( status.getXref() != null && psimiIdentifier != null && hasMiNumber) { final DbReference ref = status.getXref().getPrimaryRef(); return psimiIdentifier.equalsIgnoreCase( ref.getId() ); } else if (status.getNames() != null){ final Names names = status.getNames(); return psimiName.equalsIgnoreCase(names.getShortLabel()) || psimiName.equalsIgnoreCase(names.getFullName()); } return false; }
private static <T extends CvType> T createUnspecifiedRole( Class<T> roleClass ) { T role; try { role = roleClass.newInstance(); } catch ( Exception e ) { throw new RuntimeException( e ); } Names names = new Names(); names.setShortLabel(CvExperimentalRole.UNSPECIFIED); names.setFullName(CvExperimentalRole.UNSPECIFIED); role.setNames( names ); Xref xref = new Xref(); String unspecifiedRoleMiRef = CvExperimentalRole.UNSPECIFIED_PSI_REF; DbReference dbRef = new DbReference( unspecifiedRoleMiRef, CvDatabase.PSI_MI ); dbRef.setRefType( CvXrefQualifier.IDENTITY ); dbRef.setRefTypeAc( CvXrefQualifier.IDENTITY_MI_REF ); dbRef.setDbAc( CvDatabase.PSI_MI_MI_REF ); xref.setPrimaryRef( dbRef ); role.setXref( xref ); return role; }
interactorName = new Names(); interactorName.setShortLabel( interactorId + "_" + organismName ); interactorName.getAliases().addAll( aliases );
protected String displayParticipant(Participant p) { // fetch role String role = ""; for (ExperimentalRole aRole : p.getExperimentalRoles()) { if (role.length() > 0) { role += "&"; } if (aRole.hasNames()) { role += aRole.getNames().getShortLabel(); } else { role += "?"; } } // fetch interactor String interactor = p.getInteractor().getNames().getShortLabel(); return interactor + ":" + role; }
public static void populateNames(Names names, AnnotatedObject<?, ?> annotatedObject, AliasConverter aliasConverter) { String shortLabel = getShortLabelFromNames(names); if (names == null && (annotatedObject instanceof Experiment) ) { shortLabel = createExperimentTempShortLabel(); } if ( ! ( annotatedObject instanceof Institution ) ) { if ( shortLabel != null ) { shortLabel = shortLabel.toLowerCase(); } } annotatedObject.setShortLabel(shortLabel); if (names != null) { annotatedObject.setFullName(names.getFullName()); if (aliasConverter == null){ Class<?> aliasClass = AnnotatedObjectUtils.getAliasClassType(annotatedObject.getClass()); aliasConverter = new AliasConverter(getInstitution(annotatedObject), aliasClass); } populateAliases(names.getAliases(), annotatedObject, aliasConverter); } }