Skip to content

Commit ec41c3f

Browse files
committed
v2.7.8 + remove religation events
1 parent dad4dc7 commit ec41c3f

File tree

5 files changed

+62
-14
lines changed

5 files changed

+62
-14
lines changed

NEWS

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
***********************************
2-
CHANGES IN VERSION 2.7.7
2+
CHANGES IN VERSION 2.7.8
33

44
NEW FEATURES
55

66
o Religation are not discarding and considered as invalid pairs. Religation are defined as FR read pairs involving contiguous restriction fragments
77

8+
SIGNIFICANT USER-VISIBLE CHANGES
9+
10+
o Clean hicpro2juicebox.sh utils
11+
12+
***********************************
13+
CHANGES IN VERSION 2.7.7
14+
15+
NEW FEATURES
16+
817
o New utility : sparseToDense.py - Convert a sparse symmetric matrix file in dense format for further analysis
918

1019
o Pull request from J. Brayet for installation process
1120

1221
SIGNIFICANT USER-VISIBLE CHANGES
1322

14-
o Update of the hicpro2juicebox.sh utils. -g option now requires the chromosome size files from HiC-Pro. This version now works for any organism.
23+
o Update of the hicpro2juicebox.sh utils. -g option now requires the chromosome size files from HiC-Pro. This version now works for any organism
1524

1625
o Update of the manual
1726

1827
o Check python module version during installation
1928

20-
o Pull request NV - udpate iced version. Note that this version of iced rescales automatically the normalized matrix such that the total number of counts is identical to the original matrix.
29+
o Pull request NV - udpate iced version. Note that this version of iced rescales automatically the normalized matrix such that the total number of counts is identical to the original matrix
2130

22-
o Add -c option in hicpro2juicebox.sh utils to write the "chr" prefix before the chromosome name. The use of "chr" depends on the reference genome of juicebox.
31+
o Add -c option in hicpro2juicebox.sh utils to write the "chr" prefix before the chromosome name. The use of "chr" depends on the reference genome of juicebox
2332

2433
***********************************
2534
CHANGES IN VERSION 2.7.6

bin/HiC-Pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## Public License, either Version 2, June 1991 or Version 3, June 2007.
99

1010
SOFT="HiC-Pro"
11-
VERSION="2.7.7"
11+
VERSION="2.7.8"
1212

1313
function usage {
1414
echo -e "usage : $SOFT -i INPUT -o OUTPUT -c CONFIG [-s ANALYSIS_STEP] [-p] [-h] [-v]"

bin/utils/hicpro2juicebox.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ else
132132
fi
133133

134134
## Clean
135-
/bin/rm -f ${TEMP}/$$_resfrag.juicebox ${TEMP}/$$_allValidPairs.pre_juicebox_sorted
135+
#/bin/rm -f ${TEMP}/$$_resfrag.juicebox ${TEMP}/$$_allValidPairs.pre_juicebox_sorted
136136

137137
echo "done !"

scripts/mapped_2hic_fragments.py

+46-7
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,40 @@ def get_overlapping_restriction_fragment(resFrag, chrom, read):
247247
return None
248248

249249

250+
def are_contiguous_fragments(frag1, frag2, chr1, chr2):
251+
'''
252+
Compare fragment positions to check if they are contiguous
253+
'''
254+
ret = False
255+
if chr1 == chr2:
256+
if int(frag1.start) < int(frag2.start):
257+
d = int(frag2.start) - int(frag1.end)
258+
else:
259+
d = int(frag1.start) - int(frag2.end)
260+
261+
if d == 0:
262+
ret = True
263+
264+
return ret
265+
266+
def is_religation(read1, read2, frag1, frag2):
267+
"""
268+
Reads are expected to map adjacent fragments
269+
Check the orientation of reads -><-
270+
271+
"""
272+
ret=False
273+
if are_contiguous_fragments(frag1, frag2, read1.tid, read2.tid):
274+
if get_read_strand(r1) == "+" and get_read_strand(r2) == "-":
275+
ret=True
276+
return ret
277+
278+
250279
def is_self_circle(read1, read2):
251280
"""
252281
Both reads are expected to be on the same restriction fragments
253-
254282
Check the orientation of reads <-->
283+
255284
read1 : [AlignedRead]
256285
read2 : [AlignedRead]
257286
"""
@@ -284,7 +313,6 @@ def is_dangling_end(read1, read2):
284313
def get_valid_orientation(read1, read2):
285314
"""
286315
Both reads are expected to be on the different restriction fragments
287-
288316
Check the orientation of reads ->-> / <-<- / -><- / <-->
289317
290318
read1 : [AlignedRead]
@@ -318,6 +346,7 @@ def get_PE_fragment_size(read1, read2, resFrag1, resFrag2, interactionType):
318346
interactionType : Type of interaction from get_interaction_type() [str]
319347
320348
"""
349+
321350
fragmentsize = None
322351

323352
# Get oriented reads
@@ -330,11 +359,11 @@ def get_PE_fragment_size(read1, read2, resFrag1, resFrag2, interactionType):
330359
rfrag1 = resFrag1
331360
rfrag2 = resFrag2
332361

333-
## In this case used the read 3' end !
362+
## In this case use the read 3' end !
334363
r1pos = get_read_start(r1)
335364
r2pos = get_read_start(r2)
336365

337-
if interactionType == "DE":
366+
if interactionType == "DE" or interactionType == "RE":
338367
fragmentsize = r2pos - r1pos
339368
elif interactionType == "SC":
340369
fragmentsize = (r1pos - rfrag1.start) + (rfrag2.end - r2pos)
@@ -363,6 +392,7 @@ def get_interaction_type(read1, read1_chrom, resfrag1, read2,
363392
- Interaction
364393
- Self circle
365394
- Dangling end
395+
- Religation
366396
- Unknown
367397
368398
##
@@ -375,6 +405,7 @@ def get_interaction_type(read1, read1_chrom, resfrag1, read2,
375405
verbose = verbose mode [logical]
376406
377407
"""
408+
378409
# If returned InteractionType=None -> Same restriction fragment
379410
# and same strand = Dump
380411
interactionType = None
@@ -388,6 +419,8 @@ def get_interaction_type(read1, read1_chrom, resfrag1, read2,
388419
# Dangling_end -> <-
389420
elif is_dangling_end(read1, read2):
390421
interactionType = "DE"
422+
elif is_religation(read1, read2, resfrag1, resfrag2):
423+
interactionType = "RE"
391424
else:
392425
interactionType = "VI"
393426
elif r1.is_unmapped or r2.is_unmapped:
@@ -468,6 +501,7 @@ def get_read_tag(read, tag):
468501
# Initialize variables
469502
reads_counter = 0
470503
de_counter = 0
504+
re_counter = 0
471505
sc_counter = 0
472506
valid_counter = 0
473507
valid_counter_FF = 0
@@ -497,6 +531,7 @@ def get_read_tag(read, tag):
497531

498532
if allOutput:
499533
handle_de = open(outputDir + '/' + baseReadsFile + '.DEPairs', 'w')
534+
handle_re = open(outputDir + '/' + baseReadsFile + '.REPairs', 'w')
500535
handle_sc = open(outputDir + '/' + baseReadsFile + '.SCPairs', 'w')
501536
handle_dump = open(outputDir + '/' + baseReadsFile + '.DumpPairs', 'w')
502537
handle_single = open(outputDir + '/' + baseReadsFile + '.SinglePairs', 'w')
@@ -545,9 +580,7 @@ def get_read_tag(read, tag):
545580
r2_resfrag = None
546581
r2_chrom = None
547582

548-
549583
if r1_resfrag is not None or r2_resfrag is not None:
550-
551584
interactionType = get_interaction_type(r1, r1_chrom, r1_resfrag, r2, r2_chrom, r2_resfrag, verbose)
552585
dist = get_PE_fragment_size(r1, r2, r1_resfrag, r2_resfrag, interactionType)
553586
cdist = get_cis_dist(r1, r2)
@@ -608,6 +641,10 @@ def get_read_tag(read, tag):
608641
de_counter += 1
609642
cur_handler = handle_de if allOutput else None
610643

644+
elif interactionType == "RE":
645+
re_counter += 1
646+
cur_handler = handle_re if allOutput else None
647+
611648
elif interactionType == "SC":
612649
sc_counter += 1
613650
cur_handler = handle_sc if allOutput else None
@@ -692,13 +729,13 @@ def get_read_tag(read, tag):
692729
or2_fragname + "\t" +
693730
str(or1.mapping_quality) + "\t" +
694731
str(or2.mapping_quality) + "\n")
732+
695733
## Keep initial order
696734
if samOut:
697735
r1.tags = r1.tags + [('CT', str(interactionType))]
698736
r2.tags = r2.tags + [('CT', str(interactionType))]
699737
handle_sam.write(r1)
700738
handle_sam.write(r2)
701-
702739

703740
if (reads_counter % 100000 == 0 and verbose):
704741
print "##", reads_counter
@@ -707,6 +744,7 @@ def get_read_tag(read, tag):
707744
handle_valid.close()
708745
if allOutput:
709746
handle_de.close()
747+
handle_re.close()
710748
handle_sc.close()
711749
handle_dump.close()
712750
handle_single.close()
@@ -724,6 +762,7 @@ def get_read_tag(read, tag):
724762
handle_stat.write(
725763
"Valid_interaction_pairs_FR\t" + str(valid_counter_FR) + "\n")
726764
handle_stat.write("Dangling_end_pairs\t" + str(de_counter) + "\n")
765+
handle_stat.write("Religation_pairs\t" + str(re_counter) + "\n")
727766
handle_stat.write("Self_Cycle_pairs\t" + str(sc_counter) + "\n")
728767
handle_stat.write("Single-end_pairs\t" + str(single_counter) + "\n")
729768
handle_stat.write("Dumped_pairs\t" + str(dump_counter) + "\n")

scripts/plot_hic_fragment.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (la > 0){
2525
getHiCMat <- function(x){
2626
require(RColorBrewer)
2727

28-
invalid.lab <- intersect(names(x), c("Self_Cycle_pairs", "Dangling_end_pairs", "Single-end_pairs", "Dumped_pairs"))
28+
invalid.lab <- intersect(names(x), c("Self_Cycle_pairs", "Dangling_end_pairs", "Religation_pairs", "Single-end_pairs", "Dumped_pairs"))
2929
valid.lab <- intersect(names(x), c("Valid_interaction_pairs_FF", "Valid_interaction_pairs_RR", "Valid_interaction_pairs_RF", "Valid_interaction_pairs_FR"))
3030
x <- x[c("Valid_interaction_pairs", valid.lab, invalid.lab)]
3131

0 commit comments

Comments
 (0)