use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class Gap method valueOf.
/**
* Parse a gap GFA 2.0 record from the specified value.
*
* @param value value, must not be null
* @return a gap GFA 2.0 record parsed from the specified value
*/
public static Gap valueOf(final String value) {
checkNotNull(value);
checkArgument(value.startsWith("G"), "gap value must start with G");
List<String> tokens = Splitter.on("\t").splitToList(value);
if (tokens.size() < 6) {
throw new IllegalArgumentException("gap value must have at least six tokens, was " + tokens.size());
}
String id = "*".equals(tokens.get(1)) ? null : tokens.get(1);
Reference source = Reference.valueOf(tokens.get(2));
Reference target = Reference.valueOf(tokens.get(3));
int distance = Integer.parseInt(tokens.get(4));
Integer variance = "*".equals(tokens.get(5)) ? null : Integer.parseInt(tokens.get(5));
ImmutableMap.Builder<String, Annotation> annotations = ImmutableMap.builder();
for (int i = 6; i < tokens.size(); i++) {
String token = tokens.get(i);
if (!token.isEmpty()) {
Annotation annotation = Annotation.valueOf(token);
annotations.put(annotation.getName(), annotation);
}
}
return new Gap(id, source, target, distance, variance, annotations.build());
}
use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class SetTest method setUp.
@Before
public void setUp() {
id = "id";
ids = ImmutableSet.of("source", "target");
annotations = ImmutableMap.<String, Annotation>builder().put("aa", new Annotation("aa", "i", "42")).build();
}
use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class PathTest method setUp.
@Before
public void setUp() {
name = "name";
segments = ImmutableList.of(Reference.valueOf("source+"), Reference.valueOf("target+"));
overlaps = ImmutableList.of("10M");
annotations = ImmutableMap.<String, Annotation>builder().put("aa", new Annotation("aa", "i", "42")).build();
}
use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class SegmentTest method setUp.
@Before
public void setUp() {
id = "id";
sequence = "actg";
annotations = ImmutableMap.<String, Annotation>builder().put("aa", new Annotation("aa", "i", "42")).build();
}
use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class TraversalTest method setUp.
@Before
public void setUp() {
pathName = "pathName";
ordinal = 0;
source = Reference.valueOf("1+");
target = Reference.valueOf("2-");
overlap = "0M";
annotations = ImmutableMap.<String, Annotation>builder().put("aa", new Annotation("aa", "i", "42")).build();
}
Aggregations