summaryrefslogtreecommitdiff
path: root/python-hint-package.spec
blob: b1e7f32749660d37b61a70118844a8360431c819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
%global _empty_manifest_terminate_build 0
Name:		python-HiNT-Package
Version:	2.2.8
Release:	1
Summary:	HiNT -- HiC for copy number vairations and translocations detection
License:	MIT License
URL:		https://github.com/suwangbio/HiNT_py3
Source0:	https://mirrors.aliyun.com/pypi/web/packages/ff/a1/f1d40fad4546763d4df8b02aea3d07454d55a865c418c8163b1b124cbb6b/HiNT-Package-2.2.8.tar.gz
BuildArch:	noarch

Requires:	python3-h5py
Requires:	python3-numpy
Requires:	python3-cooler
Requires:	python3-pypairix
Requires:	python3-pairtools
Requires:	python3-scipy
Requires:	python3-pandas
Requires:	python3-scikit-learn
Requires:	python3-multiprocess
Requires:	python3-argparse
Requires:	python3-pytabix

%description
# HiNT 
## A computational method for detecting copy number variations and translocations from Hi-C data

## Summary
**HiNT** (**Hi**-C for copy **N**umber variation and **T**ranslocation detection), a computational method to detect CNVs and Translocations from Hi-C data. HiNT has three main components: **HiNT-PRE**, **HiNT-CNV**, and **HiNT-TL**. HiNT-PRE preprocesses Hi-C data and computes the contact matrix, which stores contact frequencies between any two genomic loci; both HiNT-CNV and HiNT-TL starts with HI-C contact matrix, predicts copy number segments, and inter-chromosomal translocations, respectively 

#### Overview of HiNT workflow: 
<img src="https://github.com/suwangbio/HiNT/blob/master/images/HiNT_workflow.png" width="800">

## Installation

### Dependencies
R and R packages

1. [R >= 3.4](https://www.r-project.org/)
2. [mgcv](https://cran.r-project.org/web/packages/mgcv/index.html), [strucchange](https://cran.r-project.org/web/packages/strucchange/index.html), [doParallel](https://www.rdocumentation.org/packages/parallel/versions/3.4.1), [Cairo](https://cran.r-project.org/web/packages/Cairo/index.html), [foreach](https://cran.r-project.org/web/packages/optparse/index.html)

Python and Python packages

1. [python >= 3.5](https://www.python.org/)
2. [pyparix >= 0.3.0](https://github.com/4dn-dcic/pairix#pypairix), [cooler >= 0.7.4](https://github.com/mirnylab/cooler), [pairtools >= 0.2.2](https://github.com/mirnylab/pairtools), [numpy](https://www.scipy.org/install.html), [scipy](https://www.scipy.org/install.html), [pandas](https://pandas.pydata.org/), [sklearn](https://scikit-learn.org/stable/install.html), [multiprocessing](https://pypi.org/project/multiprocess/)

Java and related tools (Optional: required when want to process Hi-C data with juicer tools)

1. [Java (version >= 1.7)](https://www.java.com/en/download/)
2. [Juicer tools (1.8.9 is recommended)](https://github.com/aidenlab/juicer/wiki/Download) 

Perl

1. [Perl (version >= 5)](https://www.perl.org/)


Other dependencies

1. [samtools](http://www.htslib.org/doc/) (1.3.1+)
2. [BIC-seq2](http://www.math.pku.edu.cn/teachers/xirb/downloads/software/BICseq2/BICseq2/BICseq2-seg_v0.7.3.tar.gz) (0.7.3) ! This is optional: if you don't want to run HiNT-CNV, you don't need this package. [Download BICseq2, unzip it, and give the path of BICseq2-seg_v0.7.3 (/path/to/BICseq2-seg_v0.7.3)].
3. [bwa](https://sourceforge.net/projects/bio-bwa/files/) (0.7.16+) ! This is optional: required only when your input is fastq
4. [tabix](https://sourceforge.net/projects/samtools/files/tabix/) (0.2.6)

### Install HiNT

* Method1: Install using conda (highly recommended)

	``` $ conda install -c su hint```

	or

	``` $ conda install hint```

* Method2: Install from PyPI using pip.

	``` $ pip install HiNT-Packages```

* Method3: Install manually 
  1. Install HiNT dependencies
  2. Download HiNT ```git clone https://github.com/parklab/HiNT.git```
  3. Go to HiNT directory, install it by ```$ python setup.py install ```

  *** Type ```$ hint``` to test if HiNT successfully installed

* Method 4: Run HiNT in a Docker container (highly recommended)

	``` $ docker pull suwangbio/hint```

	``` $ docker run suwangbio/hint hint```

	See details of the usage on HiNT page at [docker hub](https://hub.docker.com/r/suwangbio/hint) 

### Download reference files used in HiNT [HERE](https://www.dropbox.com/sh/2ufsyu4wvrboxxp/AABk5-_Fwy7jdM_t0vIsgYf4a?dl=0)

1. Download HiNT references [HERE](https://www.dropbox.com/sh/qas48d7409t2syz/AACk5G2ngZ0vylLXsLFZXif_a?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
2. Download HiNT background matrices [HERE](https://www.dropbox.com/sh/fyxx9u5g5vn57ez/AAAx-DtByKaU6HvTYyEUvCzRa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
3. Download BWA index files [HERE](https://www.dropbox.com/sh/l004df4108s6d3c/AAB6qtS95mBK_MdDZYlo2V-pa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```

## Quick Start

* Download the test datasets from [HERE](https://www.dropbox.com/sh/z1rceh8ddnsdtj7/AAC0VuDu48eh_RtzKHipztkLa?dl=0)

### HiNT-PRE
HiNT pre: Preprocessing Hi-C data. HiNT pre does alignment, contact matrix creation and normalization in one command line.

```$ hint pre -d /path/to/hic_1.fastq.gz,/path/to/hic_2.fastq.gz -i /path/to/bwaIndex/hg19/hg19.fa --refdir /path/to/refData/hg19 --informat fastq --outformat cooler -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --coolerpath /path/to/cooler```

```$ hint pre -d /path/to/test.bam --refdir /path/to/refData/hg19 --informat bam --outformat juicer -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --juicerpath /path/to/juicer_tools.1.8.9_jcuda.0.8.jar```

use ```$ which samtools ``` ```$ which pairtools ``` ```$ which cooler ``` to get the absolute path of these tools, and ```/path/to/juicer_tools.1.8.9_jcuda.0.8.jar``` should be the path where you store this file

see details and more options

```$ hint pre -h ```

### HiNT-CNV
HiNT cnv: prediction of copy number information, as well as segmentation from Hi-C.

```$ hint cnv -m contactMatrix.cool -f cooler --refdir /path/to/refDir/hg19 -r 50 -g hg19 -n test -o /path/to/outputDir --bicseq /path/to/BICseq2-seg_v0.7.3 -e MboI```

```$ hint cnv -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/50000 -f cooler --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII --doiter```

```/path/to/BICseq2-seg_v0.7.3``` should be the path where you store this package

see details and more options

```$ hint cnv -h ```

### HiNT-TL
HiNT tl: interchromosomal translocations and breakpoints detection from
Hi-C inter-chromosomal interaction matrices.

```$ hint tl -m /path/to/data_1Mb.cool,/path/to/data_100kb.cool --chimeric /path/to/test_chimeric.sorted.pairsam.gz --refdir /path/to/refDir/hg19 --backdir /path/to/backgroundMatrices/hg19 --ppath /path/to/pairix -f cooler -g hg19 -n test -o /path/to/outputDir```

```$ hint tl -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/1000000,/path/to/4DNFIS6HAUPP.mcool::/resolutions/100000 -f cooler --refdir /path/to/refDir/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12```

```$ hint tl -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refData/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12 -o HiNTtransl_juicerOUTPUT```

use ```$ which pairix ``` to get the absolute path of pairix

see details and more options

```$ hint tl -h ```

## Output of HiNT
### HiNT-PRE output
In the HiNT-PRE output directory, you will find

1. ```jobname.bam``` aligned lossless file in bam format
2. ```jobname_merged_valid.pairs.gz``` reads pairs in pair format
3. ```jobname_chimeric.sorted.pairsam.gz``` ambiguous chimeric read pairs used for breakpoint detection in [pairsam](https://github.com/mirnylab/pairtools) format
4. ```jobname_valid.sorted.deduped.pairsam.gz``` valid read pairs used for Hi-C contact matrix creation in [pairsam](https://github.com/mirnylab/pairtools) format
5. ```jobname.mcool``` Hi-C contact matrix in [cool](https://github.com/mirnylab/cooler) format
6. ```jobname.hic``` Hi-C contact matrix in [hic](https://github.com/aidenlab/juicer) format

### HiNT-CNV output
In the HiNT-CNV output directory, you will find

1. ```jobname_GAMPoisson.pdf``` the GAM regression result
2. ```segmentation/jobname_bicsq_allchroms.txt``` CNV segments with log2 copy ratio and p-values in txt file
3. ```segmentation/jobname_resolution_CNV_segments.png``` figure to visualize CNV segments
4. ```segmentation/jobname_bicseq_allchroms.l2r.pdf``` figure to visualize log2 copy ration in each bin (bin size = resolution you set)
5. ```segmentation/other_files``` intermediate files used to run BIC-seq
6. ```jonname_dataForRegression/*``` data used for regression as well as residuals after removing Hi-C biases

### HiNT-TL output
In the HiNT-TL output directory, you will find

1. ```jobname_Translocation_IntegratedBP.txt``` the final integrated translocation breakpoint
2. ```jobname_chrompairs_rankProduct.txt``` rank product predicted potential translocated chromosome pairs
3. ```otherFolders``` intermediate files used to identify the translocation breakpoints




%package -n python3-HiNT-Package
Summary:	HiNT -- HiC for copy number vairations and translocations detection
Provides:	python-HiNT-Package
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-HiNT-Package
# HiNT 
## A computational method for detecting copy number variations and translocations from Hi-C data

## Summary
**HiNT** (**Hi**-C for copy **N**umber variation and **T**ranslocation detection), a computational method to detect CNVs and Translocations from Hi-C data. HiNT has three main components: **HiNT-PRE**, **HiNT-CNV**, and **HiNT-TL**. HiNT-PRE preprocesses Hi-C data and computes the contact matrix, which stores contact frequencies between any two genomic loci; both HiNT-CNV and HiNT-TL starts with HI-C contact matrix, predicts copy number segments, and inter-chromosomal translocations, respectively 

#### Overview of HiNT workflow: 
<img src="https://github.com/suwangbio/HiNT/blob/master/images/HiNT_workflow.png" width="800">

## Installation

### Dependencies
R and R packages

1. [R >= 3.4](https://www.r-project.org/)
2. [mgcv](https://cran.r-project.org/web/packages/mgcv/index.html), [strucchange](https://cran.r-project.org/web/packages/strucchange/index.html), [doParallel](https://www.rdocumentation.org/packages/parallel/versions/3.4.1), [Cairo](https://cran.r-project.org/web/packages/Cairo/index.html), [foreach](https://cran.r-project.org/web/packages/optparse/index.html)

Python and Python packages

1. [python >= 3.5](https://www.python.org/)
2. [pyparix >= 0.3.0](https://github.com/4dn-dcic/pairix#pypairix), [cooler >= 0.7.4](https://github.com/mirnylab/cooler), [pairtools >= 0.2.2](https://github.com/mirnylab/pairtools), [numpy](https://www.scipy.org/install.html), [scipy](https://www.scipy.org/install.html), [pandas](https://pandas.pydata.org/), [sklearn](https://scikit-learn.org/stable/install.html), [multiprocessing](https://pypi.org/project/multiprocess/)

Java and related tools (Optional: required when want to process Hi-C data with juicer tools)

1. [Java (version >= 1.7)](https://www.java.com/en/download/)
2. [Juicer tools (1.8.9 is recommended)](https://github.com/aidenlab/juicer/wiki/Download) 

Perl

1. [Perl (version >= 5)](https://www.perl.org/)


Other dependencies

1. [samtools](http://www.htslib.org/doc/) (1.3.1+)
2. [BIC-seq2](http://www.math.pku.edu.cn/teachers/xirb/downloads/software/BICseq2/BICseq2/BICseq2-seg_v0.7.3.tar.gz) (0.7.3) ! This is optional: if you don't want to run HiNT-CNV, you don't need this package. [Download BICseq2, unzip it, and give the path of BICseq2-seg_v0.7.3 (/path/to/BICseq2-seg_v0.7.3)].
3. [bwa](https://sourceforge.net/projects/bio-bwa/files/) (0.7.16+) ! This is optional: required only when your input is fastq
4. [tabix](https://sourceforge.net/projects/samtools/files/tabix/) (0.2.6)

### Install HiNT

* Method1: Install using conda (highly recommended)

	``` $ conda install -c su hint```

	or

	``` $ conda install hint```

* Method2: Install from PyPI using pip.

	``` $ pip install HiNT-Packages```

* Method3: Install manually 
  1. Install HiNT dependencies
  2. Download HiNT ```git clone https://github.com/parklab/HiNT.git```
  3. Go to HiNT directory, install it by ```$ python setup.py install ```

  *** Type ```$ hint``` to test if HiNT successfully installed

* Method 4: Run HiNT in a Docker container (highly recommended)

	``` $ docker pull suwangbio/hint```

	``` $ docker run suwangbio/hint hint```

	See details of the usage on HiNT page at [docker hub](https://hub.docker.com/r/suwangbio/hint) 

### Download reference files used in HiNT [HERE](https://www.dropbox.com/sh/2ufsyu4wvrboxxp/AABk5-_Fwy7jdM_t0vIsgYf4a?dl=0)

1. Download HiNT references [HERE](https://www.dropbox.com/sh/qas48d7409t2syz/AACk5G2ngZ0vylLXsLFZXif_a?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
2. Download HiNT background matrices [HERE](https://www.dropbox.com/sh/fyxx9u5g5vn57ez/AAAx-DtByKaU6HvTYyEUvCzRa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
3. Download BWA index files [HERE](https://www.dropbox.com/sh/l004df4108s6d3c/AAB6qtS95mBK_MdDZYlo2V-pa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```

## Quick Start

* Download the test datasets from [HERE](https://www.dropbox.com/sh/z1rceh8ddnsdtj7/AAC0VuDu48eh_RtzKHipztkLa?dl=0)

### HiNT-PRE
HiNT pre: Preprocessing Hi-C data. HiNT pre does alignment, contact matrix creation and normalization in one command line.

```$ hint pre -d /path/to/hic_1.fastq.gz,/path/to/hic_2.fastq.gz -i /path/to/bwaIndex/hg19/hg19.fa --refdir /path/to/refData/hg19 --informat fastq --outformat cooler -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --coolerpath /path/to/cooler```

```$ hint pre -d /path/to/test.bam --refdir /path/to/refData/hg19 --informat bam --outformat juicer -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --juicerpath /path/to/juicer_tools.1.8.9_jcuda.0.8.jar```

use ```$ which samtools ``` ```$ which pairtools ``` ```$ which cooler ``` to get the absolute path of these tools, and ```/path/to/juicer_tools.1.8.9_jcuda.0.8.jar``` should be the path where you store this file

see details and more options

```$ hint pre -h ```

### HiNT-CNV
HiNT cnv: prediction of copy number information, as well as segmentation from Hi-C.

```$ hint cnv -m contactMatrix.cool -f cooler --refdir /path/to/refDir/hg19 -r 50 -g hg19 -n test -o /path/to/outputDir --bicseq /path/to/BICseq2-seg_v0.7.3 -e MboI```

```$ hint cnv -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/50000 -f cooler --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII --doiter```

```/path/to/BICseq2-seg_v0.7.3``` should be the path where you store this package

see details and more options

```$ hint cnv -h ```

### HiNT-TL
HiNT tl: interchromosomal translocations and breakpoints detection from
Hi-C inter-chromosomal interaction matrices.

```$ hint tl -m /path/to/data_1Mb.cool,/path/to/data_100kb.cool --chimeric /path/to/test_chimeric.sorted.pairsam.gz --refdir /path/to/refDir/hg19 --backdir /path/to/backgroundMatrices/hg19 --ppath /path/to/pairix -f cooler -g hg19 -n test -o /path/to/outputDir```

```$ hint tl -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/1000000,/path/to/4DNFIS6HAUPP.mcool::/resolutions/100000 -f cooler --refdir /path/to/refDir/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12```

```$ hint tl -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refData/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12 -o HiNTtransl_juicerOUTPUT```

use ```$ which pairix ``` to get the absolute path of pairix

see details and more options

```$ hint tl -h ```

## Output of HiNT
### HiNT-PRE output
In the HiNT-PRE output directory, you will find

1. ```jobname.bam``` aligned lossless file in bam format
2. ```jobname_merged_valid.pairs.gz``` reads pairs in pair format
3. ```jobname_chimeric.sorted.pairsam.gz``` ambiguous chimeric read pairs used for breakpoint detection in [pairsam](https://github.com/mirnylab/pairtools) format
4. ```jobname_valid.sorted.deduped.pairsam.gz``` valid read pairs used for Hi-C contact matrix creation in [pairsam](https://github.com/mirnylab/pairtools) format
5. ```jobname.mcool``` Hi-C contact matrix in [cool](https://github.com/mirnylab/cooler) format
6. ```jobname.hic``` Hi-C contact matrix in [hic](https://github.com/aidenlab/juicer) format

### HiNT-CNV output
In the HiNT-CNV output directory, you will find

1. ```jobname_GAMPoisson.pdf``` the GAM regression result
2. ```segmentation/jobname_bicsq_allchroms.txt``` CNV segments with log2 copy ratio and p-values in txt file
3. ```segmentation/jobname_resolution_CNV_segments.png``` figure to visualize CNV segments
4. ```segmentation/jobname_bicseq_allchroms.l2r.pdf``` figure to visualize log2 copy ration in each bin (bin size = resolution you set)
5. ```segmentation/other_files``` intermediate files used to run BIC-seq
6. ```jonname_dataForRegression/*``` data used for regression as well as residuals after removing Hi-C biases

### HiNT-TL output
In the HiNT-TL output directory, you will find

1. ```jobname_Translocation_IntegratedBP.txt``` the final integrated translocation breakpoint
2. ```jobname_chrompairs_rankProduct.txt``` rank product predicted potential translocated chromosome pairs
3. ```otherFolders``` intermediate files used to identify the translocation breakpoints




%package help
Summary:	Development documents and examples for HiNT-Package
Provides:	python3-HiNT-Package-doc
%description help
# HiNT 
## A computational method for detecting copy number variations and translocations from Hi-C data

## Summary
**HiNT** (**Hi**-C for copy **N**umber variation and **T**ranslocation detection), a computational method to detect CNVs and Translocations from Hi-C data. HiNT has three main components: **HiNT-PRE**, **HiNT-CNV**, and **HiNT-TL**. HiNT-PRE preprocesses Hi-C data and computes the contact matrix, which stores contact frequencies between any two genomic loci; both HiNT-CNV and HiNT-TL starts with HI-C contact matrix, predicts copy number segments, and inter-chromosomal translocations, respectively 

#### Overview of HiNT workflow: 
<img src="https://github.com/suwangbio/HiNT/blob/master/images/HiNT_workflow.png" width="800">

## Installation

### Dependencies
R and R packages

1. [R >= 3.4](https://www.r-project.org/)
2. [mgcv](https://cran.r-project.org/web/packages/mgcv/index.html), [strucchange](https://cran.r-project.org/web/packages/strucchange/index.html), [doParallel](https://www.rdocumentation.org/packages/parallel/versions/3.4.1), [Cairo](https://cran.r-project.org/web/packages/Cairo/index.html), [foreach](https://cran.r-project.org/web/packages/optparse/index.html)

Python and Python packages

1. [python >= 3.5](https://www.python.org/)
2. [pyparix >= 0.3.0](https://github.com/4dn-dcic/pairix#pypairix), [cooler >= 0.7.4](https://github.com/mirnylab/cooler), [pairtools >= 0.2.2](https://github.com/mirnylab/pairtools), [numpy](https://www.scipy.org/install.html), [scipy](https://www.scipy.org/install.html), [pandas](https://pandas.pydata.org/), [sklearn](https://scikit-learn.org/stable/install.html), [multiprocessing](https://pypi.org/project/multiprocess/)

Java and related tools (Optional: required when want to process Hi-C data with juicer tools)

1. [Java (version >= 1.7)](https://www.java.com/en/download/)
2. [Juicer tools (1.8.9 is recommended)](https://github.com/aidenlab/juicer/wiki/Download) 

Perl

1. [Perl (version >= 5)](https://www.perl.org/)


Other dependencies

1. [samtools](http://www.htslib.org/doc/) (1.3.1+)
2. [BIC-seq2](http://www.math.pku.edu.cn/teachers/xirb/downloads/software/BICseq2/BICseq2/BICseq2-seg_v0.7.3.tar.gz) (0.7.3) ! This is optional: if you don't want to run HiNT-CNV, you don't need this package. [Download BICseq2, unzip it, and give the path of BICseq2-seg_v0.7.3 (/path/to/BICseq2-seg_v0.7.3)].
3. [bwa](https://sourceforge.net/projects/bio-bwa/files/) (0.7.16+) ! This is optional: required only when your input is fastq
4. [tabix](https://sourceforge.net/projects/samtools/files/tabix/) (0.2.6)

### Install HiNT

* Method1: Install using conda (highly recommended)

	``` $ conda install -c su hint```

	or

	``` $ conda install hint```

* Method2: Install from PyPI using pip.

	``` $ pip install HiNT-Packages```

* Method3: Install manually 
  1. Install HiNT dependencies
  2. Download HiNT ```git clone https://github.com/parklab/HiNT.git```
  3. Go to HiNT directory, install it by ```$ python setup.py install ```

  *** Type ```$ hint``` to test if HiNT successfully installed

* Method 4: Run HiNT in a Docker container (highly recommended)

	``` $ docker pull suwangbio/hint```

	``` $ docker run suwangbio/hint hint```

	See details of the usage on HiNT page at [docker hub](https://hub.docker.com/r/suwangbio/hint) 

### Download reference files used in HiNT [HERE](https://www.dropbox.com/sh/2ufsyu4wvrboxxp/AABk5-_Fwy7jdM_t0vIsgYf4a?dl=0)

1. Download HiNT references [HERE](https://www.dropbox.com/sh/qas48d7409t2syz/AACk5G2ngZ0vylLXsLFZXif_a?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
2. Download HiNT background matrices [HERE](https://www.dropbox.com/sh/fyxx9u5g5vn57ez/AAAx-DtByKaU6HvTYyEUvCzRa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```
3. Download BWA index files [HERE](https://www.dropbox.com/sh/l004df4108s6d3c/AAB6qtS95mBK_MdDZYlo2V-pa?dl=0). Only hg19, hg38 and mm10 are available currently. Unzip it ```$ unzip hg19.zip ```

## Quick Start

* Download the test datasets from [HERE](https://www.dropbox.com/sh/z1rceh8ddnsdtj7/AAC0VuDu48eh_RtzKHipztkLa?dl=0)

### HiNT-PRE
HiNT pre: Preprocessing Hi-C data. HiNT pre does alignment, contact matrix creation and normalization in one command line.

```$ hint pre -d /path/to/hic_1.fastq.gz,/path/to/hic_2.fastq.gz -i /path/to/bwaIndex/hg19/hg19.fa --refdir /path/to/refData/hg19 --informat fastq --outformat cooler -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --coolerpath /path/to/cooler```

```$ hint pre -d /path/to/test.bam --refdir /path/to/refData/hg19 --informat bam --outformat juicer -g hg19 -n test -o /path/to/outputdir --pairtoolspath /path/to/pairtools --samtoolspath /path/to/samtools --juicerpath /path/to/juicer_tools.1.8.9_jcuda.0.8.jar```

use ```$ which samtools ``` ```$ which pairtools ``` ```$ which cooler ``` to get the absolute path of these tools, and ```/path/to/juicer_tools.1.8.9_jcuda.0.8.jar``` should be the path where you store this file

see details and more options

```$ hint pre -h ```

### HiNT-CNV
HiNT cnv: prediction of copy number information, as well as segmentation from Hi-C.

```$ hint cnv -m contactMatrix.cool -f cooler --refdir /path/to/refDir/hg19 -r 50 -g hg19 -n test -o /path/to/outputDir --bicseq /path/to/BICseq2-seg_v0.7.3 -e MboI```

```$ hint cnv -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/50000 -f cooler --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII```

```$ hint cnv -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refDir/hg38 -r 50 -g hg38 -n HepG2 --bicseq /path/to/BICseq2-seg_v0.7.3 -e DpnII --doiter```

```/path/to/BICseq2-seg_v0.7.3``` should be the path where you store this package

see details and more options

```$ hint cnv -h ```

### HiNT-TL
HiNT tl: interchromosomal translocations and breakpoints detection from
Hi-C inter-chromosomal interaction matrices.

```$ hint tl -m /path/to/data_1Mb.cool,/path/to/data_100kb.cool --chimeric /path/to/test_chimeric.sorted.pairsam.gz --refdir /path/to/refDir/hg19 --backdir /path/to/backgroundMatrices/hg19 --ppath /path/to/pairix -f cooler -g hg19 -n test -o /path/to/outputDir```

```$ hint tl -m /path/to/4DNFIS6HAUPP.mcool::/resolutions/1000000,/path/to/4DNFIS6HAUPP.mcool::/resolutions/100000 -f cooler --refdir /path/to/refDir/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12```

```$ hint tl -m /path/to/4DNFICSTCJQZ.hic -f juicer --refdir /path/to/refData/hg38 --backdir /path/to/backgroundMatrices/hg38 -g hg38 -n 4DNFICSTCJQZ -c 0.05 --ppath /path/to/pairix -p 12 -o HiNTtransl_juicerOUTPUT```

use ```$ which pairix ``` to get the absolute path of pairix

see details and more options

```$ hint tl -h ```

## Output of HiNT
### HiNT-PRE output
In the HiNT-PRE output directory, you will find

1. ```jobname.bam``` aligned lossless file in bam format
2. ```jobname_merged_valid.pairs.gz``` reads pairs in pair format
3. ```jobname_chimeric.sorted.pairsam.gz``` ambiguous chimeric read pairs used for breakpoint detection in [pairsam](https://github.com/mirnylab/pairtools) format
4. ```jobname_valid.sorted.deduped.pairsam.gz``` valid read pairs used for Hi-C contact matrix creation in [pairsam](https://github.com/mirnylab/pairtools) format
5. ```jobname.mcool``` Hi-C contact matrix in [cool](https://github.com/mirnylab/cooler) format
6. ```jobname.hic``` Hi-C contact matrix in [hic](https://github.com/aidenlab/juicer) format

### HiNT-CNV output
In the HiNT-CNV output directory, you will find

1. ```jobname_GAMPoisson.pdf``` the GAM regression result
2. ```segmentation/jobname_bicsq_allchroms.txt``` CNV segments with log2 copy ratio and p-values in txt file
3. ```segmentation/jobname_resolution_CNV_segments.png``` figure to visualize CNV segments
4. ```segmentation/jobname_bicseq_allchroms.l2r.pdf``` figure to visualize log2 copy ration in each bin (bin size = resolution you set)
5. ```segmentation/other_files``` intermediate files used to run BIC-seq
6. ```jonname_dataForRegression/*``` data used for regression as well as residuals after removing Hi-C biases

### HiNT-TL output
In the HiNT-TL output directory, you will find

1. ```jobname_Translocation_IntegratedBP.txt``` the final integrated translocation breakpoint
2. ```jobname_chrompairs_rankProduct.txt``` rank product predicted potential translocated chromosome pairs
3. ```otherFolders``` intermediate files used to identify the translocation breakpoints




%prep
%autosetup -n HiNT-Package-2.2.8

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-HiNT-Package -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 2.2.8-1
- Package Spec generated