Skip to content

Commit

Permalink
deleting print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiia committed Jan 12, 2019
1 parent a9331ac commit 40088b2
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions bin/1.1_footprint_extraction/footprints_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,9 @@ def check_and_merge(peak_footprints, max_bp_between):
peak_footprints_new = {}
merged_footprints = {}

for footprint in peak_footprints_list:
print(footprint[0]) #name of footprint
print(footprint[1]['start']) #the features of saved footprint

#we need to check each footprint within this peak with the other footprints for possible merging
#for footprint_to_check in peak_footprints.keys():
for footprint in peak_footprints_list:
for footprint in peak_footprints_list: #work with sorted footprints
footprint_to_check = footprint[0] #save the name of the footprint which we are working with now
start_to_check = peak_footprints[footprint_to_check]['start']
end_to_check = peak_footprints[footprint_to_check]['end']
Expand All @@ -306,9 +302,6 @@ def check_and_merge(peak_footprints, max_bp_between):

if start_to_check > peak_footprints[compared_footprint]['start'] and start_to_check - peak_footprints[compared_footprint]['end'] < max_bp_between:
#make compared_footprint longer: compared_footprint + footprint_to_check
print()
print(start_to_check, peak_footprints[compared_footprint]['end'])
print("merge right", footprint_to_check, compared_footprint)
merge_footprints_left = False
break
elif end_to_check < peak_footprints[compared_footprint]['end'] and peak_footprints[compared_footprint]['start'] - end_to_check < max_bp_between:
Expand Down Expand Up @@ -357,16 +350,12 @@ def check_and_merge(peak_footprints, max_bp_between):
peak_footprints_new[footprint_to_check] = footprint_update(peak_footprints_new[footprint_to_check], peak_footprints_new[footprint_to_check]['start'], peak_footprints[compared_footprint]['end'], peak_footprints[compared_footprint]['score'])
#the right merging is enabled, start and end of compared footprint should be bigger than the start of the footprint_to_check
elif merge_footprints_left == False:
print("entered right merging")
if end_to_check > peak_footprints[compared_footprint]['end']:
print(end_to_check, peak_footprints[compared_footprint]['end'])
if compared_footprint not in peak_footprints_new.keys():
print("compared_footprint", compared_footprint, "not in peak_footprints_new.keys")
if compared_footprint not in peak_footprints_new.keys():
if any(compared_footprint in merged_footprints[x] for x in merged_footprints.keys()):
for k, v in merged_footprints.items():
if compared_footprint in v:
main_footprint = k
print(main_footprint)
#make merging using the information from the merged_footprints and peak_footprints_new
#UPDATE
peak_footprints_new[main_footprint] = footprint_update(peak_footprints_new[main_footprint], peak_footprints[main_footprint]['start'], peak_footprints[footprint_to_check]['end'], peak_footprints[footprint_to_check]['score'])
Expand All @@ -375,8 +364,6 @@ def check_and_merge(peak_footprints, max_bp_between):
merged_array.append(footprint_to_check)
merged_footprints[main_footprint] = merged_array
else:
print("make normal update")
print("save", compared_footprint)
#make normal update, using data from peak footprints
merged_footprints[compared_footprint] = merged_footprints.get(compared_footprint, [])
merged_footprints[compared_footprint] = [footprint_to_check]
Expand All @@ -385,7 +372,6 @@ def check_and_merge(peak_footprints, max_bp_between):
peak_footprints_new[compared_footprint] = peak_footprints[compared_footprint]
#UPDATE
peak_footprints_new[compared_footprint] = footprint_update(peak_footprints_new[compared_footprint], peak_footprints_new[compared_footprint]['start'], peak_footprints[footprint_to_check]['end'], peak_footprints[footprint_to_check]['score'])
print(peak_footprints_new[compared_footprint])
else:
if compared_footprint in merged_footprints.keys():
#compared_footprint was as main for merging already
Expand All @@ -407,10 +393,6 @@ def check_and_merge(peak_footprints, max_bp_between):
peak_footprints_new[footprint_to_check] = peak_footprints_new.get(footprint_to_check, [])
peak_footprints_new[footprint_to_check] = peak_footprints[footprint_to_check]

#print(len(peak_footprints_new))
for footprint in peak_footprints_new:
print(footprint, peak_footprints_new[footprint])
#sys.exit()
return peak_footprints_new

#this function is used to update the footprint that should to be merged with another one
Expand Down

0 comments on commit 40088b2

Please sign in to comment.