Skip to content

Commit

Permalink
Merge pull request #259 from deeptools/fixenrichedContacts
Browse files Browse the repository at this point in the history
Fix enriched contacts
  • Loading branch information
joachimwolff committed Jun 14, 2018
2 parents 97d4c8c + 7ea937b commit ca69b7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions hicexplorer/HiCMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,9 @@ def save_lieberman(self, fileName):
fileh.close()

def save_GInteractions(self, fileName):
"""
Saves the matrix using bioconductor's GInteraction format. `bin_pos1 , bin_pos2, number of interactions`
"""
self.restoreMaskedBins()
log.debug(self.matrix.shape)
mat_coo = triu(self.matrix, k=0, format='csr').tocoo()
Expand Down
9 changes: 6 additions & 3 deletions hicexplorer/hicFindEnrichedContacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def parse_arguments(args=None):

parserRequired = parser.add_argument_group('Required arguments')

parserRequired.add_argument('--matrix', '-m',
help='Input matrix.',
required=True)
parserRequired.add_argument('--outFileName', '-o',
help='File name to save the resulting matrix.',
type=hicexplorer.parserCommon.writableFile,
Expand All @@ -50,7 +53,7 @@ def parse_arguments(args=None):
action='store_true')

parserOpt.add_argument(
'--depth',
'--maxDepth',
help='Depth (in base pairs) up to which the computations will be carried out. A depth of 10.0000 bp '
'means that any computations involving bins that are over 10kbp apart are not considered.',
type=int,
Expand Down Expand Up @@ -812,8 +815,8 @@ def main(args=None):
hic_ma.diagflat()

if args.method == 'obs/exp':
hic_ma.convert_to_obs_exp_matrix(maxdepth=args.depth, perchr=args.perchr)
hic_ma.convert_to_obs_exp_matrix(maxdepth=args.maxDepth, perchr=args.perchr)
else:
hic_ma.convert_to_zscore_matrix(maxdepth=args.depth, perchr=args.perchr)
hic_ma.convert_to_zscore_matrix(maxdepth=args.maxDepth, perchr=args.perchr)

hic_ma.save(args.outFileName)
1 change: 1 addition & 0 deletions hicexplorer/hicFindTADs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ def compute_spectra_matrix(self, perchr=True):
pool = multiprocessing.Pool(self.num_processors)
log.info("Using {} processors\n".format(self.num_processors))
res = pool.map_async(func, TASKS).get(9999999)
pool.close()
else:
res = map(func, TASKS)

Expand Down

0 comments on commit ca69b7a

Please sign in to comment.