Straw input, HiC-EMT excise and understanding .hic file

305 views
Skip to first unread message

Yiling Zhang

unread,
May 10, 2022, 5:30:47 AM5/10/22
to 3D Genomics
Hello everyone,

Thanks for these amazing tools and we all appreciate your lab's contributions to 3D genomic field.

I've got a few questions here. It would help me a lot if you could answer it.

1. Straw input
I notice the function was like,
straw <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize>

If I use different chromosomes in <chr1> and <chr2>, does it extract a matrix of interchromosomal interactions instead of intrachromosomal contact map from both <chr1> and <chr2>?

2. HiC-EMT excise 
My code was like: 
java -Xmx15g -jar hic_emt.jar excise -r 5000 -c 1,2,3 --cleanup GM12878.hic GM_emt
But it seems like `-c` parameter can't work. 
```
Reading file: GM12878.hic HiC file version: 7 Exception in thread "main" java.lang.NullPointerException at javastraw.reader.basics.ChromosomeHandler.inferGenomeId(ChromosomeHandler.java:287) at javastraw.reader.basics.ChromosomeHandler.<init>(ChromosomeHandler.java:53) at javastraw.reader.basics.ChromosomeHandler.<init>(ChromosomeHandler.java:47) at javastraw.tools.HiCFileTools.stringToChromosomes(HiCFileTools.java:191) at emt.clt.tools.Excise.run(Excise.java:58) at emt.Tools.main(Tools.java:75)
```

3. .hic file
Can awk directly edit .hic file? like edit the header and change the path to chrom.size file? Or is there any functions can work?

Looking forward to hearing from you.

Best regards,
Yiling




Muhammad Shamim

unread,
May 10, 2022, 6:43:50 AM5/10/22
to 3D Genomics
1. Yes, using different chr1 and chr2 makes it an interchromosomal region.
Also, chr1 should be <= chr2, so that you're always getting data from the upper triangular matrix.

2. We will look into this - thanks for the bug report!

3. This would not work and could actually corrupt the file. 
Is it causing some downstream issues with other tools?

Scott

unread,
Mar 4, 2023, 5:44:28 PM3/4/23
to 3D Genomics
Thank you so much for developing HiC-EMT; I can see it being very useful to the community.

I replicated the exception that Yiling posted above using the latest version (1.10.2) and was wondering if we ever found a fix. I'm also finding a different, but possibly related exception without the '-c' parameter:

////////////////////////////////////////////////////////////////////////
java -Xmx5g -jar ~/software/hic-emt/hic_emt.jar excise --subsample 480638166 WT-MEGA-inter_30.hic tmp/ WT-MEGA-inter_30
Aiming to retain ~480638166/508056633
Ratio: 0.9460326561665026
..........
..........
........
Using 1 CPU thread(s) for primary task
Using 1 CPU thread(s) for secondary task
Exception in thread "main" java.lang.NoSuchFieldError: useIteratorDontPutAllInRAM
at hic.HiCGlobals.setMatrixZoomDataRAMUsage(HiCGlobals.java:75)
at hic.tools.clt.old.PreProcessing.readArguments(PreProcessing.java:154)
at hic.tools.HiCTools.main(HiCTools.java:82)
at emt.main.FileBuildingMethod.buildNewHiCFile(FileBuildingMethod.java:52)
at emt.main.FileBuildingMethod.tryToBuild(FileBuildingMethod.java:58)
at emt.clt.tools.Excise.run(Excise.java:71)
at emt.Tools.main(Tools.java:75)
////////////////////////////////////////////////////////////////////////

I would really appreciate your help and look forward to hearing from you.

Best regards,
Scott

移加CLS

unread,
Jul 18, 2023, 4:44:04 AM7/18/23
to 3D Genomics
what if I want to extract all the contact matrices, from chromosome 1 to chromosome 22, instead of specifying particular a pair of interchromosomal or intrachromosomal matrices using hic-straw, is it possible to do that? and how to do that?
thanks

Best,
Dittman

sa50...@gmail.com 在 2022年5月10日 星期二下午6:43:50 [UTC+8] 的信中寫道:

David Katz

unread,
Jul 18, 2023, 7:52:14 PM7/18/23
to 3D Genomics
I would also be interested to know if this is possible. As far as I know, it is not. I have been extracting interchromosomal contacts one at a time as follows:

matrix_object = hic.getMatrixZoomData(chromosome1, chromosome1, "observed", "NONE", "BP", resolution)

ch_1_ch_1 = matrix_object.getRecordsAsMatrix(startingbp1, endingbp1, startingbp1, endingbp1)

matrix_object = hic.getMatrixZoomData(chromosome1, chromosome2, "observed", "NONE", "BP", resolution)

ch_1_ch_2 = matrix_object.getRecordsAsMatrix(startingbp1, endingbp1, startingbp2, endingbp2)

matrix_object = hic.getMatrixZoomData(chromosome2, chromosome1, "observed", "NONE", "BP", resolution)

ch_2_ch_1 = matrix_object.getRecordsAsMatrix(startingbp2, endingbp2, startingbp1, endingbp1)

matrix_object = hic.getMatrixZoomData(chromosome2, chromosome2, "observed", "NONE", "BP", resolution)

ch_2_ch_2 = matrix_object.getRecordsAsMatrix(startingbp2, endingbp2, startingbp2, endingbp2)


# Combine the matrices

upper_left = ch_1_ch_1

upper_right = ch_1_ch_2

lower_left = ch_2_ch_1

lower_right = ch_2_ch_2


# Get the dimensions of the submatrices

rows_ul, cols_ul = upper_left.shape

rows_ur, cols_ur = upper_right.shape

rows_ll, cols_ll = lower_left.shape

rows_lr, cols_lr = lower_right.shape


# Create an empty matrix to hold the combined result

combined_matrix = np.zeros((rows_ul + rows_ll, cols_ul + cols_ur))


# Place the submatrices into the combined matrix

combined_matrix[:rows_ul, :cols_ul] = upper_left

combined_matrix[:rows_ur, cols_ul:] = upper_right

combined_matrix[rows_ul:, :cols_ll] = np.transpose(upper_right)

combined_matrix[rows_ul:, cols_ll:] = lower_right


Reply all
Reply to author
Forward
0 new messages