File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ def get_exon_pairs (gtf = 'Reference/mel_r5_good.gtf' , key = 'gene_name' ):
2
+ exon_pairs = {}
3
+ last_type = ''
4
+ last_stop = - 1
5
+ for line in open (gtf ):
6
+ data = line .split ('\t ' )
7
+ chrom = data [0 ]
8
+ line_type = data [2 ]
9
+ start = int (data [3 ])
10
+ stop = int (data [4 ])
11
+ if last_type == 'exon' and line_type == 'exon' :
12
+ annot = {
13
+ d .strip ().split ()[0 ]: d .strip ().split (maxsplit = 1 )[1 ].strip ('";' )
14
+ for d in data [- 1 ].split (';' )
15
+ if d .strip ()
16
+ }
17
+ exon_pairs [(chrom , last_stop , start )] = annot .get (key )
18
+ last_stop = stop
19
+ last_type = line_type
20
+ return exon_pairs
21
+
22
+
Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ def load_juncs(juncfile):
169
169
args .samfile .close ()
170
170
out ['pref_index' ] = (out .ALT - out .REF )/ (out .ALT + out .REF )
171
171
out .ix [out .ALT + out .REF < args .min_reads , 'pref_index' ] = pd .np .nan
172
+ out .index .name = 'clu'
172
173
out .to_csv (args .outfile , sep = '\t ' , na_rep = 'N/A' )
173
174
174
175
You can’t perform that action at this time.
0 commit comments