Skip to content
Snippets Groups Projects
Commit 1368ccf7 authored by Jakob Rien's avatar Jakob Rien
Browse files

Replace find_representative_transcripts.py

parent d9b2b067
No related branches found
No related tags found
No related merge requests found
#### Find representative transcripts #### #### Find representative transcripts ####
"""Version 1.0.0""" """Version 1.0.1"""
### Imports ### ### Imports ###
import argparse import argparse
...@@ -36,7 +36,7 @@ def find_in_attributs (attributs,look_for): ...@@ -36,7 +36,7 @@ def find_in_attributs (attributs,look_for):
index = attributs.index(look_for)+1 index = attributs.index(look_for)+1
return attributs[index] return attributs[index]
except: except:
#print("No",look_for,"in the entry the return was set to NA\n",attributs) print("No",look_for,"in the entry the return was set to NA\n",attributs)
return "NA" return "NA"
def exon_length(entry): def exon_length(entry):
...@@ -108,10 +108,10 @@ def get_rep_trans(file_name = "test"): ...@@ -108,10 +108,10 @@ def get_rep_trans(file_name = "test"):
if ignor_trans: if ignor_trans:
continue continue
elif cur_gID != attributs[1]: elif cur_gID != attributs[1]:
print("ERROR exon from an unexpected Gen") raise ValueError("ERROR exon from an unexpected Gen")
continue continue
elif find_in_attributs (attributs,"transcript_id") != cur_tID: elif find_in_attributs (attributs,"transcript_id") != cur_tID:
print("ERROR exon from an unexpected transcript") raise ValueError("exon from an unexpected transcript")
continue continue
#calculating exon_length and adding it to the appropriat list and chackin for changes in best transcript #calculating exon_length and adding it to the appropriat list and chackin for changes in best transcript
...@@ -129,7 +129,7 @@ def get_rep_trans(file_name = "test"): ...@@ -129,7 +129,7 @@ def get_rep_trans(file_name = "test"):
#varryfi that the gen is correct #varryfi that the gen is correct
if cur_gID != attributs[1]: if cur_gID != attributs[1]:
print("ERROR transcript from an unexpected Gen") raise ValueError("ERROR transcript from an unexpected Gen")
continue continue
#finding the transcript id and the support level #finding the transcript id and the support level
...@@ -175,7 +175,7 @@ def get_rep_trans(file_name = "test"): ...@@ -175,7 +175,7 @@ def get_rep_trans(file_name = "test"):
#raises an error for unidentifyable entrys #raises an error for unidentifyable entrys
else: else:
print("This entry could not be identified\n",entry) raise ValueError("This entry could not be identified\n",entry)
del rep_trans[""] del rep_trans[""]
rep_transcripts = _re_format(rep_trans) rep_transcripts = _re_format(rep_trans)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment