Skip to content

Commit

Permalink
update the spec to enable zero length regions and zero length sequenc…
Browse files Browse the repository at this point in the history
…es when min_len is zero
  • Loading branch information
sbooeshaghi committed Aug 7, 2024
1 parent 19298dc commit 7c1a6a5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions seqspec/Region.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def update_attr(self):
self.sequence = self.get_sequence()
self.min_len, self.max_len = self.get_len()
if self.sequence_type == "random":
self.sequence = "X" * self.max_len
self.sequence = "X" * self.min_len
if self.sequence_type == "onlist":
self.sequence = "N" * self.max_len
self.sequence = "N" * self.min_len
return

def __repr__(self) -> str:
Expand Down
29 changes: 26 additions & 3 deletions seqspec/schema/seqspec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
},
"sequence": {
"description": "The sequence",
"type": "string",
"pattern": "^[ACGTRYMKSWHBVDNX]+$"
"type": "string"
},
"min_len": {
"description": "The minimum length of the sequence",
Expand Down Expand Up @@ -194,7 +193,31 @@
"sequence",
"min_len",
"max_len"
]
],
"if": {
"properties": {
"min_len": {
"const": 0
}
}
},
"then": {
"properties": {
"sequence": {
"type": "string",
"pattern": "^[ACGTRYMKSWHBVDNX]*$"
}
}
},
"else": {
"properties": {
"sequence": {
"type": "string",
"minLength": 1,
"pattern": "^[ACGTRYMKSWHBVDNX]+$"
}
}
}
},
"read": {
"title": "Read",
Expand Down

0 comments on commit 7c1a6a5

Please sign in to comment.