Mercurial > repos > iuc > spades_biosyntheticspades
annotate write_tsv_script.py @ 9:c33a476f4001 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit f53f7f297e551bf58e753752edd0dae5205bbc77
author | iuc |
---|---|
date | Mon, 15 Apr 2024 19:39:30 +0000 |
parents | 1fc82fe7ebef |
children |
rev | line source |
---|---|
2
1bb12736175c
"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 |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
2 |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
3 import re |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
4 import sys |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
5 |
5
1fc82fe7ebef
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit a09a5e3ee3c76550526f082b97de8da75181a1dd
iuc
parents:
2
diff
changeset
|
6 search_str = r"^>(NODE|\S+)_(\d+)(?:_|\s)length_(\d+)_cov_(\d+\.*\d*)(.*\$)?" |
2
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
7 |
1bb12736175c
"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" |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
9 |
1bb12736175c
"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) |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
11 |
1bb12736175c
"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") |
1bb12736175c
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
iuc
parents:
diff
changeset
|
13 |
1bb12736175c
"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): |
1bb12736175c
"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): |
1bb12736175c
"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)) |