use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class LinkTest method setUp.
@Before
public void setUp() {
source = Reference.valueOf("source+");
target = Reference.valueOf("target+");
overlap = "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 Header method valueOf.
/**
* Parse a header GFA 2.0 record from the specified value.
*
* @param value value, must not be null
* @return a header GFA 2.0 record parsed from the specified value
*/
public static Header valueOf(final String value) {
checkNotNull(value);
checkArgument(value.startsWith("H"), "header value must start with H");
List<String> tokens = Splitter.on("\t").splitToList(value);
ImmutableMap.Builder<String, Annotation> annotations = ImmutableMap.builder();
for (int i = 1; i < tokens.size(); i++) {
String token = tokens.get(i);
if (!token.isEmpty()) {
Annotation annotation = Annotation.valueOf(token);
annotations.put(annotation.getName(), annotation);
}
}
return new Header(annotations.build());
}
use of org.dishevelled.bio.annotation.Annotation in project dishevelled-bio by heuermh.
the class Segment method valueOf.
/**
* Parse a segment GFA 2.0 record from the specified value.
*
* @param value value, must not be null
* @return a segment GFA 2.0 record parsed from the specified value
*/
public static Segment valueOf(final String value) {
checkNotNull(value);
checkArgument(value.startsWith("S"), "segment value must start with S");
List<String> tokens = Splitter.on("\t").splitToList(value);
if (tokens.size() < 4) {
throw new IllegalArgumentException("segment value must have at least four tokens, was " + tokens.size());
}
String id = tokens.get(1);
int length = Integer.parseInt(tokens.get(2));
String sequence = "*".equals(tokens.get(3)) ? null : tokens.get(3);
ImmutableMap.Builder<String, Annotation> annotations = ImmutableMap.builder();
for (int i = 4; i < tokens.size(); i++) {
String token = tokens.get(i);
if (!token.isEmpty()) {
Annotation annotation = Annotation.valueOf(token);
annotations.put(annotation.getName(), annotation);
}
}
return new Segment(id, length, sequence, annotations.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";
length = 42;
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 FragmentTest method setUp.
@Before
public void setUp() {
segmentId = "segmentId";
external = Reference.valueOf("external+");
segmentStart = Position.valueOf("1");
segmentEnd = Position.valueOf("10");
fragmentStart = Position.valueOf("101");
fragmentEnd = Position.valueOf("110");
alignment = Alignment.valueOf("10M");
annotations = ImmutableMap.<String, Annotation>builder().put("aa", new Annotation("aa", "i", "42")).build();
}
Aggregations