ay-lab / dcHiC

dcHiC: Differential compartment analysis for Hi-C datasets
MIT License
62 stars 10 forks source link

Identify differential compartment bins from a user-defined PC1 table of five time points #95

Closed Jiangyuan-Liu closed 7 months ago

Jiangyuan-Liu commented 8 months ago

Hi,

I already have a PC1 data frame of five-time points (T1-T5) at 100kb resolution in a TSV file. Each time point has two biological replicates (R1, R2). The genome assembly is hg38. I generated these PC1s per arm. I would like to identify those differential compartment bins across these five time points. And I also want to use time-series analysis to cluster the compartmentalization score patterns of these differential bins by generating the plots using TCseq package. Could you send me an example code to achieve them?

Thanks a lot, Jiangyuan

chrom start end T1_R1_PC1 T1_R2_PC1 T2_R1_PC1 T2_R2_PC1 T3_R1_PC1 T3_R2_PC1 T4_R1_PC1 T4_R2_PC1 T5_R1_PC1 T5_R2_PC1 chr1 100,000 200,000

ay-lab commented 8 months ago

Hi,

Can you try to run this step first? https://github.com/ay-lab/dcHiC/tree/master/utility#using-existing-pc-values-with-dchic

Using getcHiCinputfromExistingPCs.r, you can reformat their existing pc values such that they can use dcHiC. The input must be a five-column text file with the following fields:

<pc bedGraph path>  <pc type>   <replicate name>    <sample name>

In your case, it should look like the following

/path/to/T1_R1_PC1.bedGraph  intra  T1_R1_PC1  T1_R1_PC1
/path/to/T1_R2_PC1.bedGraph  intra  T1_R2_PC1  T1_R2_PC1
....

Once you run this code, you can run the dcHiC --pcatype analyze option on the output results. For that, you will need an input.txt file that will look similar to the following -

T1_R1_PC1_<HiC_Resolution>_matrix.txt  <HiC_Resolution>.bed    T1_R1_PC1  T1_PC1
T1_R2_PC1_<HiC_Resolution>_matrix.txt  <HiC_Resolution>.bed    T1_R2_PC1  T1_PC1
T2_R1_PC1_<HiC_Resolution>_matrix.txt  <HiC_Resolution>.bed    T2_R1_PC1  T2_PC1
T2_R2_PC1_<HiC_Resolution>_matrix.txt  <HiC_Resolution>.bed    T2_R2_PC1  T2_PC1
.....

You don't have to create any of the _matrix.txt; it just serves as a dummy name. However, you must create the .bed file at the specific resolution you want to perform the compartment analysis. The bed file should look like the following -

<chrome> <start> <end> <index>

Once you have these files, you can run the "analyze" step to get the differential compartments.

Let me know if you face any issues, I will gladly help you.