
org.snpeff.interval.Gtf2Marker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SnpEff Show documentation
Show all versions of SnpEff Show documentation
Variant annotation and effect prediction package.
The newest version!
package org.snpeff.interval;
import java.util.HashMap;
import java.util.HashSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* An interval intended as a mark
*
* @author pcingola
*
*/
public class Gtf2Marker extends GffMarker {
private static final long serialVersionUID = 5416962964309837838L;
static final String ATTRIBUTE_PATTERN_REGEX = "\\s*(\\S+)\\s+\"(.*?)\"\\s*;";
static final Pattern ATTRIBUTE_PATTERN = Pattern.compile(ATTRIBUTE_PATTERN_REGEX);
public Gtf2Marker() {
super();
}
public Gtf2Marker(Genome genome, String line) {
super(genome, line);
}
public Gtf2Marker(Marker parent, int start, int end, boolean strandMinus, String id) {
super(parent, start, end, strandMinus, id);
}
/**
* Parse attributes
*/
@Override
protected void parseAttributes(String attrStr) {
keyValues = new HashMap<>();
keys = new HashSet();
if (attrStr.length() > 0) {
Matcher matcher = ATTRIBUTE_PATTERN.matcher(attrStr);
while (matcher.find()) {
if (matcher.groupCount() >= 2) {
String key = matcher.group(1).toLowerCase();
String value = matcher.group(2);
add(key, value);
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy