Skip to content

Commit 0a46fd9

Browse files
author
Kate Weaver
committed
gene body coordinates
1 parent 713e0d8 commit 0a46fd9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import numpy as np
5+
6+
#usage:
7+
'''
8+
./save_gene_body_coords.py rnaTPM_train_pc.txt 19012 trainGeneCoords_pc.npz
9+
./save_gene_body_coords.py rnaTPM_test_pc.txt 1967 testGeneCoords_pc.npz
10+
./save_gene_body_coords.py rnaTPM_ref_pc.txt 857 refGeneCoords_pc.npz
11+
'''
12+
13+
input_file = sys.argv[1]
14+
tssN = int(sys.argv[2])
15+
16+
to_save = np.zeros((tssN, 3), dtype=np.object)
17+
18+
for i, line in enumerate(open(input_file)):
19+
fields = line.strip('\r\n').split()
20+
if i != 0:
21+
to_save[i-1,0] = fields[0] #set chr
22+
to_save[i-1,1] = int(fields[1]) #set "start", but really just the minimum gene body edge value
23+
to_save[i-1,2] = int(fields[2]) #set "end", but really just the maximum gene body edge value
24+
25+
output_file = sys.argv[3]
26+
f = open(output_file, 'wb')
27+
np.savez(f, geneBodyCoords = to_save)
28+
f.close()

0 commit comments

Comments
 (0)