Skip to content

Commit ffc1825

Browse files
committed
Easier parsing of output
1 parent 102fc52 commit ffc1825

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CluToGene.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+

VelvetAnt.py

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def load_juncs(juncfile):
169169
args.samfile.close()
170170
out['pref_index'] = (out.ALT - out.REF)/(out.ALT + out.REF)
171171
out.ix[out.ALT + out.REF < args.min_reads, 'pref_index'] = pd.np.nan
172+
out.index.name = 'clu'
172173
out.to_csv(args.outfile, sep='\t', na_rep='N/A')
173174

174175

0 commit comments

Comments
 (0)