-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
further cross-validations and errmsg
- Loading branch information
Giorgio Gonnella
committed
Apr 5, 2017
1 parent
cf6688f
commit 6d25eb7
Showing
9 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import gfapy | ||
|
||
class Validation: | ||
|
||
def validate_positions(self): | ||
"Checks that positions suffixed by $ are the last position of segments" | ||
if self.is_connected(): | ||
for n in ["1","2"]: | ||
seg = self.get("sid"+n).line | ||
seq = seg.sequence | ||
if not gfapy.is_placeholder(seq): | ||
seqlen = len(seq) | ||
for pfx in ["beg", "end"]: | ||
fn = pfx+n | ||
pos = self.get(fn) | ||
if gfapy.islastpos(pos): | ||
if pos != seqlen: | ||
raise gfapy.InconsistencyError( | ||
"Edge: {}\n".format(str(self))+ | ||
"Field {}: $ after ".format(fn)+ | ||
"non-last position\n".format(str(pos))+ | ||
"Segment: {}".format(str(seg))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import gfapy | ||
|
||
class Validation: | ||
|
||
def validate_positions(self): | ||
"Checks that positions suffixed by $ are the last position of segments" | ||
if self.is_connected(): | ||
seg = self.get("sid") | ||
seq = seg.sequence | ||
if not gfapy.is_placeholder(seq): | ||
seqlen = len(seq) | ||
for sfx in ["beg", "end"]: | ||
fn = "s_"+sfx | ||
pos = self.get(fn) | ||
if gfapy.islastpos(pos): | ||
if pos != seqlen: | ||
raise gfapy.InconsistencyError( | ||
"Edge: {}\n".format(str(self))+ | ||
"Field {}: $ after ".format(str(fn))+ | ||
"non-last position ({})\n".format(str(pos))+ | ||
"Segment: {}".format(str(seg))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
H VN:Z:2.0 | ||
H ul:Z:https://github.com/sjackman/assembly-graph/blob/master/sample.gfa | ||
S 1 8 CGATGCAA | ||
S 2 10 TGCAAAGTAC | ||
S 3 21 TGCAACGTATAGACTTGTCAC RC:i:4 | ||
S 4 7 GCATATA | ||
S 5 8 CGATGATA | ||
S 6 4 ATGA | ||
E * 1+ 2+ 3 9$ 0 5 5M | ||
E * 3+ 2+ 21$ 21$ 0 0 0M | ||
E * 3+ 4- 17 21$ 3 7$ 1M1D2M | ||
E * 4- 5+ 0 0 0 0 0M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# File used for the collections test | ||
# similar but NOT equivalent to the gfa1 file! | ||
S 1 122 * | ||
S 3 29 TGCTAGCTGACTGTCGATGCTGTGTG | ||
E 1_to_2 1+ 2+ 110 122$ 0 12 12M | ||
S 5 130 * | ||
S 13 150 * | ||
E 2_to_6 2+ 6+ 0 122$ 10 132 122M | ||
O 14 11+ 12+ | ||
S 11 140 * xx:i:11 | ||
F 3 read1+ 0 42$ 12 55 * id:Z:read1_in_3 | ||
F 2 read2+ 45 62 0 18 * id:Z:read2_in_2 | ||
U 16 1 3 15 2_to_6 16sub | ||
H ac:Z:test2 | ||
# another comment | ||
S 12 150 * | ||
S 4 120 * | ||
H VN:Z:2.0 | ||
E 1_to_3 1+ 3+ 112 122$ 0 12 10M | ||
G 1_to_11 1+ 11- 120 * | ||
E 11_to_12 11+ 12+ 18 140$ 0 122 122M | ||
S 6 150 * | ||
X custom_record xx:Z:testtag | ||
X custom_record X2 | ||
E 11_to_13 11+ 13+ 20 140$ 0 120 120M | ||
G 2_to_12 2- 12+ 500 50 | ||
O 15 11+ 11_to_13+ 13+ xx:i:-1 | ||
Y another_custom_record | ||
U 16sub 2 3 | ||
S 2 120 * xx:Z:sometag | ||
H aa:i:12 ab:Z:test1 | ||
H aa:i:15 | ||
E 1_to_5 1+ 5+ 0 122$ 2 124 * zz:Z:tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
H VN:Z:1.0 | ||
H ul:Z:https://github.com/sjackman/assembly-graph/blob/master/sample.gfa | ||
S 1 CGATGCAA LN:i:12 | ||
S 2 TGCAAAGTAC | ||
S 3 TGCAACGTATAGACTTGTCAC RC:i:4 | ||
S 4 GCATATA | ||
S 5 CGATGATA | ||
S 6 ATGA | ||
L 1 + 2 + 5M | ||
L 3 + 2 + 0M | ||
L 3 + 4 - 1M1D2M1S | ||
L 4 - 5 + 0M |