Skip to content

Commit

Permalink
Merge pull request #33 from 4dn-dcic/chr_name_warning_msgs
Browse files Browse the repository at this point in the history
0.7.2
  • Loading branch information
carlvitzthum authored May 31, 2019
2 parents 581144e + 962bca3 commit a6c83b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ You may also provide the optional `-e` flag, which will cause the mitchondrial c


## Changelog
### 0.7.2
* Warning from `hic2cool_utils.parse_hic` will now output chromsome names, not indices
### 0.7.1
* Add `format` and `format-version` to `/` collection for multi-resolution coolers written by hic2cool
* Run `hic2cool_update` to add these attributes to mcool files generated with previous hic2cool versions
Expand Down
2 changes: 1 addition & 1 deletion hic2cool/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.1"
__version__ = "0.7.2"
16 changes: 9 additions & 7 deletions hic2cool/hic2cool_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def read_normalization_vector(f, buf, entry):
return np.frombuffer(buf, dtype=np.dtype('<d'), count=nValues, offset=filepos+4)


def parse_hic(req, buf, outfile, chr_key, unit, binsize,
pair_footer_info, chr_offset_map, chr_bins, show_warnings):
def parse_hic(req, buf, outfile, chr_key, unit, binsize, pair_footer_info,
chr_offset_map, chr_bins, used_chrs, show_warnings):
"""
Adapted from the straw() function in the original straw package.
Mainly, since all chroms are iterated over, the read_header and read_footer
Expand All @@ -332,8 +332,10 @@ def parse_hic(req, buf, outfile, chr_key, unit, binsize,
except KeyError:
WARN = True
if show_warnings:
print_stderr('... The intersection between chr %s and chr %s cannot be found in the hic file.'
% (c1, c2))
c1_name = used_chrs[c1][1]
c2_name = used_chrs[c2][1]
print_stderr('... The intersection between %s and %s cannot be found in the hic file.'
% (c1_name, c2_name))
return join_chunk
region_indices = [0, chr_bins[c1], 0, chr_bins[c2]]
myFilePos = pair_footer_info[chr_key]
Expand Down Expand Up @@ -900,9 +902,9 @@ def hic2cool_convert(infile, outfile, resolution=0, show_warnings=False, silent=
# and c2-c1 reciprocally
if chr_key in covered_chr_pairs:
continue
tmp_chunk = parse_hic(req, buf, outfile, chr_key,
unit, binsize, pair_footer_info,
chr_offset_map, chr_bins, show_warnings)
tmp_chunk = parse_hic(req, buf, outfile, chr_key, unit, binsize,
pair_footer_info, chr_offset_map, chr_bins,
used_chrs, show_warnings)
total_chunk = np.concatenate((total_chunk, tmp_chunk), axis=0)
del tmp_chunk
covered_chr_pairs.append(chr_key)
Expand Down

0 comments on commit a6c83b6

Please sign in to comment.