Skip to content

Commit

Permalink
the max_pos is the index, and so add always 1 after calculating it. O…
Browse files Browse the repository at this point in the history
…therwise it could be 0 as index
anastasiia committed Jan 10, 2019
1 parent b102737 commit b2f3773
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/1.1_footprint_extraction/footprints_extraction.py
Original file line number Diff line number Diff line change
@@ -143,6 +143,8 @@ def save_footprint(footprint_count, footprint_scores, peak_footprints, chromosom
else:
max_pos = first_max_pos

max_pos = max_pos + 1 #as the index of an array starts with 0

#calculate the score for the current footprint as mean of all scores from the bigwig file
footprint_score = np.mean(footprint_scores)

@@ -527,6 +529,10 @@ def write_to_bed_file(all_footprints, sorted_output_file_name):

#write each footprint line for line to the output file
for footprint in all_footprints:
#if footprint[1]['start'] >= footprint[1]['end']:
# print(footprint)
#if footprint[1]['max_pos'] == 0:
# print(footprint)
output_file.write('\t'.join([footprint[1]['chromosom'], str(footprint[1]['start']), str(footprint[1]['end']), footprint[0], str(round(footprint[1]['score'], 6)), '.', str(footprint[1]['len']), str(footprint[1]['max_pos']), ';'.join(footprint[1]['bonus'])]) + '\n')

output_file.close()

0 comments on commit b2f3773

Please sign in to comment.