/** * Calculates the next available suffix using a short label - which is * the highest suffix + 1 * * @param shortLabel the label to use * @return the next available suffix. */ protected static Integer calculateNextSuffix( String shortLabel ) { String labelWithoutSuffix = removeSuffix( shortLabel ); // we get all the labels with the same bait-prey combination List<String> shortLabelsWithSuffix = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInteractionDao().getShortLabelsLike( labelWithoutSuffix + "%" ); int maxSuffix = -1; for ( String labelWithSuffix : shortLabelsWithSuffix ) { InteractionShortLabel label = new InteractionShortLabel( labelWithSuffix ); Integer suffix = label.getSuffix(); if ( suffix != null ) { maxSuffix = Math.max( maxSuffix, suffix ); } else { maxSuffix = 0; } } if ( maxSuffix == -1 ) { return null; } return maxSuffix + 1; }
/** * Calculates the next available suffix using a short label - which is * the highest suffix + 1 * * @param shortLabel the label to use * @return the next available suffix. */ protected static Integer calculateNextSuffix( String shortLabel ) { String labelWithoutSuffix = removeSuffix( shortLabel ); // we get all the labels with the same bait-prey combination List<String> shortLabelsWithSuffix = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInteractionDao().getShortLabelsLike( labelWithoutSuffix + "%" ); int maxSuffix = -1; for ( String labelWithSuffix : shortLabelsWithSuffix ) { InteractionShortLabel label = new InteractionShortLabel( labelWithSuffix ); Integer suffix = label.getSuffix(); if ( suffix != null ) { maxSuffix = Math.max( maxSuffix, suffix ); } else { maxSuffix = 0; } } if ( maxSuffix == -1 ) { return null; } return maxSuffix + 1; }
/** * Calculates the next available suffix using a short label - which is * the highest suffix + 1 * * @param shortLabel the label to use * * @return the next available suffix. */ protected static Integer calculateNextSuffix(String shortLabel) { String labelWithoutSuffix = removeSuffix(shortLabel); // we get all the labels with the same bait-prey combination List<String> shortLabelsWithSuffix = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInteractionDao().getShortLabelsLike(labelWithoutSuffix + "%"); int maxSuffix = -1; for (String labelWithSuffix : shortLabelsWithSuffix) { InteractionShortLabel label = new InteractionShortLabel(labelWithSuffix); Integer suffix = label.getSuffix(); if (suffix != null) { maxSuffix = Math.max(maxSuffix, suffix); } else { maxSuffix = 0; } } if (maxSuffix == -1) { return null; } return maxSuffix + 1; }
/** * Gets the next available suffix for a provided shortLabel * * @param shortLabel Can already have a suffix or not. * * @return The next available shortLabel */ public static String nextAvailableShortlabel(String shortLabel) { Integer nextSuffix = calculateNextSuffix(shortLabel); InteractionShortLabel label = new InteractionShortLabel(shortLabel); if (nextSuffix != null) { label.setSuffix(nextSuffix); } return label.getCompleteLabel(); }
/** * Gets the next available suffix for a provided shortLabel * * @param shortLabel Can already have a suffix or not. * @return The next available shortLabel */ public static String nextAvailableShortlabel( String shortLabel ) { Integer nextSuffix = calculateNextSuffix( shortLabel ); InteractionShortLabel label = new InteractionShortLabel( shortLabel ); if ( nextSuffix != null ) { label.setSuffix( nextSuffix ); } return label.getCompleteLabel(); }
/** * Gets the next available suffix for a provided shortLabel * * @param shortLabel Can already have a suffix or not. * @return The next available shortLabel */ public static String nextAvailableShortlabel( String shortLabel ) { Integer nextSuffix = calculateNextSuffix( shortLabel ); InteractionShortLabel label = new InteractionShortLabel( shortLabel ); if ( nextSuffix != null ) { label.setSuffix( nextSuffix ); } return label.getCompleteLabel(); }
/** * Creates a candiate short label - not taking into account if an interaction with the same name exists in the database * * @param baitShortLabel bait gene name * @param preyShortLabel prey gene name * @param suffix e.g. "1" * @return the short label */ protected static String createCandidateShortLabel( String baitShortLabel, String preyShortLabel, Integer suffix ) { InteractionShortLabel label = new InteractionShortLabel( baitShortLabel, preyShortLabel, suffix ); return label.getCompleteLabel(); }
/** * Creates a candiate short label - not taking into account if an interaction with the same name exists in the database * * @param completeLabel label * @return the short label */ protected static String createCandidateShortLabel( String completeLabel ) throws IllegalLabelFormatException { InteractionShortLabel label = new InteractionShortLabel( completeLabel ); return label.getCompleteLabel(); }
/** * Creates a candiate short label - not taking into account if an interaction with the same name exists in the database * * @param baitShortLabel bait gene name * @param preyShortLabel prey gene name * @param suffix e.g. "1" * * @return the short label */ protected static String createCandidateShortLabel(String baitShortLabel, String preyShortLabel, Integer suffix) { InteractionShortLabel label = new InteractionShortLabel(baitShortLabel, preyShortLabel, suffix); return label.getCompleteLabel(); }
/** * Removes the suffix of a shortLabel * * @param shortLabel a shortLabel with or without suffix * @return the shortlabel without suffix */ protected static String removeSuffix( String shortLabel ) { InteractionShortLabel label = new InteractionShortLabel( shortLabel ); return label.getCompleteLabel( false ); }
/** * Creates a candiate short label - not taking into account if an interaction with the same name exists in the database * * @param baitShortLabel bait gene name * @param preyShortLabel prey gene name * @param suffix e.g. "1" * @return the short label */ protected static String createCandidateShortLabel( String baitShortLabel, String preyShortLabel, Integer suffix ) { InteractionShortLabel label = new InteractionShortLabel( baitShortLabel, preyShortLabel, suffix ); return label.getCompleteLabel(); }
/** * Removes the suffix of a shortLabel * * @param shortLabel a shortLabel with or without suffix * * @return the shortlabel without suffix */ protected static String removeSuffix(String shortLabel) { InteractionShortLabel label = new InteractionShortLabel(shortLabel); return label.getCompleteLabel(false); }
/** * Creates a candiate short label - not taking into account if an interaction with the same name exists in the database * * @param completeLabel label * @return the short label */ protected static String createCandidateShortLabel( String completeLabel ) throws IllegalLabelFormatException { InteractionShortLabel label = new InteractionShortLabel( completeLabel ); return label.getCompleteLabel(); }
/** * Removes the suffix of a shortLabel * * @param shortLabel a shortLabel with or without suffix * @return the shortlabel without suffix */ protected static String removeSuffix( String shortLabel ) { InteractionShortLabel label = new InteractionShortLabel( shortLabel ); return label.getCompleteLabel( false ); }