Mercurial > repos > bgruening > salmonquantmerge
annotate vpolo_convert.py @ 5:28e01a2960a5 draft
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit dee6a6f4aa8cbee9f81692fc6f3a2e4ad1f3abf6"
| author | bgruening | 
|---|---|
| date | Sat, 03 Oct 2020 18:19:54 +0000 | 
| parents | 7c618ec039b8 | 
| children | 510af1a0f9c8 | 
| rev | line source | 
|---|---|
| 
2
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
1 #!/usr/bin/env python | 
| 
5
 
28e01a2960a5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit dee6a6f4aa8cbee9f81692fc6f3a2e4ad1f3abf6"
 
bgruening 
parents: 
2 
diff
changeset
 | 
2 import argparse | 
| 
 
28e01a2960a5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit dee6a6f4aa8cbee9f81692fc6f3a2e4ad1f3abf6"
 
bgruening 
parents: 
2 
diff
changeset
 | 
3 import os | 
| 
2
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
4 | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
5 from vpolo.alevin import parser as par | 
| 
5
 
28e01a2960a5
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit dee6a6f4aa8cbee9f81692fc6f3a2e4ad1f3abf6"
 
bgruening 
parents: 
2 
diff
changeset
 | 
6 | 
| 
2
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
7 | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
8 parser = argparse.ArgumentParser() | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
9 parser.add_argument("--mtx", "-m", action="store_true", help="--dumpMtx flag set") | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
10 parser.add_argument("--umi", "-u", action="store_true", help="--dumpUmiGraph flag set") | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
11 args = parser.parse_args() | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
12 | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
13 if args.mtx: | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
14 alevin_df = par.read_quants_bin("output") | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
15 with open("quants_mat.tsv", "w") as f: | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
16 f.write(alevin_df.to_csv(sep="\t")) | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
17 | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
18 if args.umi: | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
19 os.mkdir("umiout") | 
| 
 
7c618ec039b8
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/salmon commit c17bc974bf9bbaa1fc1e47ea72162fd244f0e612"
 
bgruening 
parents:  
diff
changeset
 | 
20 par.read_umi_graph("output", "umiout") | 
