File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
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 ()
You can’t perform that action at this time.
0 commit comments