Skip to content

Commit 21ec595

Browse files
jamesmorrisjamesmorris
authored andcommitted
Handle partial locations in typical cases
1 parent a69e00a commit 21ec595

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ private String _insdc_location_string_ignoring_strand_and_subfeatures(
283283
ref = ""
284284
assert not location.ref_db
285285
*/
286+
287+
286288
String ref = "";
287289
if(!sequenceLocation.getStart().isUncertain() && !sequenceLocation.getEnd().isUncertain() && sequenceLocation.getStart() == sequenceLocation.getEnd()) {
288290
//Special case, for 12:12 return 12^13
@@ -338,7 +340,20 @@ private String _insdc_location_string_ignoring_strand_and_subfeatures(
338340
}
339341
} else {
340342
//Typical case, e.g. 12..15 gets mapped to 11:15
341-
return ref + _insdc_feature_position_string(sequenceLocation.getStart(), 0) + ".." + _insdc_feature_position_string(sequenceLocation.getEnd());
343+
String start = _insdc_feature_position_string(sequenceLocation.getStart());
344+
String end = _insdc_feature_position_string(sequenceLocation.getEnd());
345+
346+
if (sequenceLocation.isPartial()) {
347+
if (sequenceLocation.isPartialOn5prime()) {
348+
start = "<" + start;
349+
}
350+
351+
if (sequenceLocation.isPartialOn3prime()) {
352+
end = ">" + end;
353+
}
354+
}
355+
356+
return ref + start + ".." + end;
342357
}
343358
}
344359
private String _insdc_feature_position_string(Point location) {

0 commit comments

Comments
 (0)