de.charite.compbio.jannovar.reference.DuplicationChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jannovar-core Show documentation
Show all versions of jannovar-core Show documentation
jannovar-core is a library for the functional annotation of genomic variants
package de.charite.compbio.jannovar.reference;
/**
* Helper class for checking whether an insertion in a string is a duplication.
*
* @author Manuel Holtgrewe
*/
public final class DuplicationChecker {
/**
* @param ref
* reference string for insertion
* @param insertion
* the string to be inserted at pos
* @param pos
* the 0-based position in ref
that insertion
is to be inserted
*
* @return true
if the described insertion is a duplication
*/
public static boolean isDuplication(String ref, String insertion, int pos) {
if (pos + insertion.length() <= ref.length()) {
// can be duplication with string after pos
if (ref.substring(pos, pos + insertion.length()).equals(insertion))
return true;
}
if (pos >= insertion.length()) {
// can be duplication with string before pos
if (ref.substring(pos - insertion.length(), pos).equals(insertion))
return true;
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy