-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Scrape Number and Specify Description (#34)
* 🔨 Added import of custom desc from config 🔨 Add number field scrape * 🧹 minor cleanup * 📝 add rc version * 🧹 catch impossible 🧹 cleanup naming 📝 add semicolon * 📝 restored original default str to output for desc * 📝 added PR requested updates 🚧 test in progress * ✅ added test for poposed feature * 💍 feature proposal to add cmd line * 🧹 cleanup epaths print 📝 default to 1 when INFO is A R G 🧪 updated tests * ⏪ revert desc prepend tag --------- Co-authored-by: Miller <[email protected]>
- Loading branch information
Showing
9 changed files
with
94 additions
and
10 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
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,29 @@ | ||
""" | ||
Small test to ensure expected INFO fields generated | ||
""" | ||
import sys | ||
import gzip | ||
|
||
fpath = sys.argv[1] | ||
field = sys.argv[2] | ||
num = sys.argv[3] | ||
desc = sys.argv[4] | ||
|
||
ok = False | ||
for line in gzip.open(sys.argv[1], 'rt'): | ||
if line.startswith("##INFO=<ID={},".format(field)): | ||
toks = line.rstrip("\n").split(",") | ||
num_to_check = "Number={}".format(num) | ||
assert toks[1].startswith(num_to_check), f"Expected Desciption=\"{num}\" for {field}, got {num_to_check} in {toks[1]}" | ||
desc_to_check = "Description=\"{}\"".format(desc) | ||
assert toks[3].startswith(desc_to_check), f"Expected Desciption=\"{desc}\" for {field}, got {desc_to_check} in {toks[3]}" | ||
ok = True | ||
break | ||
# only want to look through header | ||
elif line.startswith("#CHROM"): | ||
break | ||
if not ok: | ||
print(f"Expected field {field} not found in INFO", file=sys.stderr) | ||
sys.exit(1) | ||
else: | ||
sys.exit(0) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[ | ||
{"field": "val0", "alias": "aval"} | ||
{"field": "val0", "alias": "aval", "description": "TEST description field"}, | ||
{"field": "AC", "alias": "external_AC", "description": "Theoretical AC from another source"} | ||
] |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[ | ||
{"field": "val1", "alias": "aval1"} | ||
{"field": "val1", "alias": "aval1"}, | ||
{"field": "str", "alias": "external_str"} | ||
] |