Mercurial > repos > nml > spades
annotate write_tsv_script.py @ 16:d2d1df21dfb9 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
author | iuc |
---|---|
date | Tue, 25 Jan 2022 07:55:17 +0000 |
parents | |
children | 78ced22d09a2 |
rev | line source |
---|---|
16
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
2 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
3 import re |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
4 import sys |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
5 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
6 search_str = r"^>(NODE|\S+)_(\d+)(?:_|\s)length_(\d+)_cov_(\d+\.*\d*).*\$" |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
7 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
8 replace_str = r"\1_\2\t\3\t\4" |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
9 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
10 cmd = re.compile(search_str) |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
11 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
12 sys.stdout.write("#name\tlength\tcoverage\n") |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
13 |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
14 for i, line in enumerate(sys.stdin): |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
15 if cmd.match(line): |
d2d1df21dfb9
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
16 sys.stdout.write(cmd.sub(replace_str, line)) |