Skip to content
Snippets Groups Projects
Commit d099fc1f authored by Laura Urbanska's avatar Laura Urbanska
Browse files

Updated gtf writer file

parent 2b364a6d
No related branches found
No related tags found
No related merge requests found
def gtf_file_writer (original_file, output_file):
output = []
rep_transcript_dict = get_rep_trans(original_file)
with open(original_file, 'r') as f:
for entry in f:
if entry[0] != '#':
attributes = attributs_converter(entry)
type_ = attributes[2]
if type_ == 'gene':
gene_id = find_in_attributs(attributes, 'gene_id')
output.append(entry)
if type_ != 'gene':
transcript_id = find_in_attributs(attributes, 'transcript_id')
if rep_transcript_dict[gene_id] == transcript_id:
output.append(entry)
with open(output_file, 'w') as last_file:
last_file.write(output)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment