Skip to content

Commit 6b57a95

Browse files
committed
Minor fixes
1 parent 77b2b69 commit 6b57a95

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

flic_src/modules/extract_fasta.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
from collections import defaultdict
33

4+
45
D_OF_COMPLEMENT = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G', 'N': 'N', '-': '-'}
56

67

@@ -107,10 +108,8 @@ def extract_transcripts_seq(file_isoform_coords, d_of_gene_coords, d_of_fasta, o
107108
transcript_seq = d_of_fasta[chrom][start:stop]
108109
correct_transcript_seq = change_introns_to_gap(transcript_seq, splice_sites, start)
109110
# add 5'- and 3'-gaps
110-
correct_transcript_seq = (['-'] * compare_starts_ends(start, d_of_gene_coords[gene_id][
111-
0])) + correct_transcript_seq
112-
correct_transcript_seq = correct_transcript_seq + (
113-
['-'] * compare_starts_ends(stop, d_of_gene_coords[gene_id][1]))
111+
correct_transcript_seq = (['-'] * compare_starts_ends(start, d_of_gene_coords[gene_id][0])) + correct_transcript_seq
112+
correct_transcript_seq = correct_transcript_seq + (['-'] * compare_starts_ends(stop, d_of_gene_coords[gene_id][1]))
114113

115114
if orientation == '-':
116115
correct_transcript_seq = complement(correct_transcript_seq)

flic_src/modules/make_genes_from_iso.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def read_annot_file(annot_file):
197197
return d_of_annot_genes
198198

199199

200-
def intersection_with_genes(gene_coords, d_of_ref):
200+
def intersection_with_genes(gene_coords, d_of_ref, counter_unassigned_genes):
201201
start_gene, stop_gene = gene_coords
202202

203203
for key, gene_id in d_of_ref.items():
@@ -211,10 +211,11 @@ def intersection_with_genes(gene_coords, d_of_ref):
211211

212212
if prop_intersection >= 0.8:
213213
return gene_id
214-
return 'unassigned_gene'
214+
return f'unassigned_gene_{str(counter_unassigned_genes)}'
215215

216216

217217
def move_geneids_from_annot(annot_file, genes_file, out_dir):
218+
counter_unassigned_genes = 1
218219
out_fname = f'{out_dir}final_results/{os.path.basename(genes_file)}'
219220
os.mkdir(f'{out_dir}final_results/')
220221

@@ -229,8 +230,11 @@ def move_geneids_from_annot(annot_file, genes_file, out_dir):
229230
start = int(line_l[2])
230231
stop = int(line_l[4])
231232

232-
gene_id = intersection_with_genes((start, stop), d_annot_file[chrom_and_orientation])
233+
gene_id = intersection_with_genes((start, stop), d_annot_file[chrom_and_orientation],
234+
counter_unassigned_genes)
233235
line_l.append(gene_id)
236+
if gene_id.startswith('unassigned_gene_'):
237+
counter_unassigned_genes += 1
234238

235239
with open(out_fname, 'a') as ouf:
236240
ouf.write('\t'.join(line_l) + '\n')

flic_src/run_flic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def run_tool():
6464

6565
cagefightr_res_dir = find_start_polya.find_starts_polya(bam_dir, arguments.ref_fasta,
6666
arguments.output_dir)
67-
dirs_for_delete.append(os.path.split(os.path.abspath(cagefightr_res_dir)))
67+
dirs_for_delete.append(os.path.split(os.path.abspath(cagefightr_res_dir))[0])
6868

6969
for changed_splice_file in os.listdir(changed_splice_sites_dir):
7070
iso_dir = make_iso.create_isoforms(cagefightr_res_dir, changed_splice_sites_dir,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
author='Alexandra Kasianova',
88
author_email='[email protected]',
99
url='https://github.com/albidgy/FLIC',
10-
description='A tool for reconstruction of splicing isoform from transcription start site to polyA site',
10+
description='A tool for isoform reconstruction based on long reads',
1111
license='MIT',
1212
install_requires=['joblib', 'networkx', 'numpy'],
1313
packages=['flic_src', 'flic_src/modules', 'flic_src/scripts'],

0 commit comments

Comments
 (0)