Skip to content

Commit

Permalink
Resolving merge conflicts and python 2 vs python 3 conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimwolff committed Oct 30, 2017
1 parent e81d9d0 commit bc03450
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/content/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Command line installation using ``pip``

Install HiCExplorer using the following command:
::

--
$ pip install hicexplorer

All python requirements should be automatically installed.
Expand Down
8 changes: 7 additions & 1 deletion hicexplorer/HiCMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,13 @@ def getDekkerBins(self, fileName):
self.header = []
try:
for line in gzip.open(fileName, 'r').readlines():
if line.startswith(b"#"):
if type(line) is bytes:
query = b"#"

if type(line) is str:
query = "#"

if line.startswith(query):
self.header.append(line)
continue
i += 1
Expand Down
2 changes: 1 addition & 1 deletion hicexplorer/hicBuildMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ def main(args=None):
start_pos_coverage, end_pos_coverage)))
start_pos_coverage = None
end_pos_coverage = None
coverage = Array(c_uint, number_of_elements_coverage)
coverage = Array(c_uint, [0] * number_of_elements_coverage)

# define global shared ctypes arrays for row, col and data
args.threads = args.threads - 1
Expand Down
3 changes: 2 additions & 1 deletion hicexplorer/hicFindTADs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,8 @@ def load_bedgraph_matrix(self, filename):
end_list = []
with open(filename, 'r') as fh:
for line in fh:
if line.startswith(b"#"):
# if type(line)
if line.startswith("#"):
# recover the parameters used to generate the spectrum_matrix
parameters = json.loads(line[1:].strip())
continue
Expand Down
10 changes: 5 additions & 5 deletions hicexplorer/hicPrepareQCreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def save_html(filename, unmap_table, discard_table, distance_table, orientation_
html = open(os.path.join(root, "qc_template.html"), "r")
html_content = html.read()
# the html code has a placeholder for the html table
html = html.replace("%%TABLE_UNMAP%%", unmap_table.style
html_content = html_content.replace("%%TABLE_UNMAP%%", unmap_table.style
.format(lambda x: '{:,}'.format(x) if x > 1 else '{:.2%}'.format(x)).render())
html = html.replace("%%TABLE_DISCARDED%%", discard_table.style
html_content = html_content.replace("%%TABLE_DISCARDED%%", discard_table.style
.format(lambda x: '{:,}'.format(x) if x > 1 else '{:.2%}'.format(x)).render())
html = html.replace("%%TABLE_DISTANCE%%", distance_table.style
html_content = html_content.replace("%%TABLE_DISTANCE%%", distance_table.style
.format(lambda x: '{:,}'.format(x) if x > 1 else '{:.2%}'.format(x)).render())
html = html.replace("%%TABLE_ORIENTATION%%", orientation_table.style
html_content = html_content.replace("%%TABLE_ORIENTATION%%", orientation_table.style
.format(lambda x: '{:,}'.format(x) if x > 1 else '{:.2%}'.format(x)).render())

all_table = all_table[['Pairs considered', 'Pairs mappable, unique and high quality', 'Pairs used',
Expand All @@ -69,7 +69,7 @@ def save_html(filename, unmap_table, discard_table, distance_table, orientation_
'self circle', 'duplicated pairs', 'inter chromosomal', 'short range < 20kb',
'long range', 'inward pairs', 'outward pairs', 'left pairs', 'right pairs']]

html = html.replace("%%TABLE%%", all_table.style.render())
html_content = html_content.replace("%%TABLE%%", all_table.style.render())
with open(filename, 'w') as fh:
fh.write(html_content)
html.close()
Expand Down
2 changes: 1 addition & 1 deletion hicexplorer/test/test_buildMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_build_matrix_rf():
qc_folder).split()
hicBuildMatrix.main(args)

test = hm.hiCMatrix(ROOT + "small_test_rf_matrix_parallel.h5")
test = hm.hiCMatrix(ROOT + "small_test_rf_matrix.h5")
new = hm.hiCMatrix(outfile.name)
# print("MATRIX NAME RF:", outfile.name)

Expand Down
4 changes: 2 additions & 2 deletions hicexplorer/trackPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,11 @@ def plot(self, ax, label_ax, chrom_region, start_region, end_region):
import pyBigWig
self.bw = pyBigWig.open(self.properties['file'])

print "error found while reading bigwig scores ({}).\nTrying again. Iter num: {}".format(e, num_tries)
print("error found while reading bigwig scores ({}).\nTrying again. Iter num: {}".format(e, num_tries))
pass
else:
if num_tries > 1:
print "After {} the scores could be computed".format(num_tries)
print("After {} the scores could be computed".format(num_tries))
break

x_values = np.linspace(start_region, end_region, num_bins)
Expand Down

0 comments on commit bc03450

Please sign in to comment.