Skip to content

Commit

Permalink
Fix for #51
Browse files Browse the repository at this point in the history
  • Loading branch information
basti committed Jan 10, 2019
1 parent a161ed0 commit 97c526d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions bin/3.1_create_gtf/Modules/Ensembl/ActivityCategorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ def activity_comparator(self, aliaslist):
concatenated_array = bytearray([])
length = len(self.activity[aliaslist[0]])
input_arrays = [self.activity[index] for index in aliaslist]
try:
for x in range(length):
for x in range(length):
# This try-catch block is needed because of inconsistency in file-lengths in Ensembl-release-95
try:
if any(y[x] == 0 for y in input_arrays):
concatenated_array.append(0)
elif any(y[x] == 1 for y in input_arrays):
Expand All @@ -134,8 +135,9 @@ def activity_comparator(self, aliaslist):
concatenated_array.append(3)
elif any(y[x] == 4 for y in input_arrays):
concatenated_array.append(4)
except IndexError:
print("Indexerror occured")
except IndexError:
concatenated_array.append(4)

return concatenated_array


Expand Down
5 changes: 4 additions & 1 deletion bin/3.1_create_gtf/Modules/Ensembl/GTFGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ def generate_activity_list(self, activity, index):

activity_list = []
for key, value in activity.items():
# if no index is found the key will be annotated as "NA"
# this is needed due to an inconsistency in ensembl-release-95
# some activity-files contain less entries than others
try:
activity_list.append(key+">"+self.value_map[value[index]])
except IndexError:
pass
activity_list.append(key+">NA")
return activity_list

def get_gtf(self, release, activity):
Expand Down
2 changes: 1 addition & 1 deletion bin/3.1_create_gtf/config/celltypes_homo_sapiens.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
{
"type": "Heart",
"alias_ucsc": ["heart"],
"alias_ensembl": ["Right_Atrium", "Left_Ventricle", "cardiac_muscle_cell", "heart_right_ventricle"]
"alias_ensembl": ["Right_Atrium", "Left_Ventricle", "cardiac_muscle_cell", "heart_right_ventricle", "heart"]
},
{
"type": "Osteoblast",
Expand Down

0 comments on commit 97c526d

Please sign in to comment.