### Install HiCExplorer from source Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Installs HiCExplorer from its downloaded source code using the setup.py script. The --prefix option can be used to specify a custom installation directory, particularly useful when root permissions are unavailable. ```bash $ python setup.py install --prefix /User/Tools/hicexplorer ``` -------------------------------- ### Install HiCExplorer from GitHub using Pip with custom prefix Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Installs HiCExplorer directly from its GitHub repository using pip, specifying a custom installation prefix. This method is useful for developers or users who need to install to a non-default location, but requires careful management of dependencies. ```bash $ pip install --install-option="--prefix=/MyPath/Tools/hicexplorer" git+https://github.com/deeptools/HiCExplorer.git ``` -------------------------------- ### Prepare Tool Inputs using bioblend Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Demonstrates how to prepare input parameters for a Galaxy tool using bioblend's `inputs` and `dataset` classes. This is a preparatory step before running a tool. ```python from bioblend.galaxy.tools.inputs import inputs, dataset # prepare bowtie input my_input = inputs().set("inputName",'value').set("input",dataset(dataset_ids[0])) ``` -------------------------------- ### Clone HiCExplorer source code Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Downloads the HiCExplorer source code from its GitHub repository. This is the first step for manual installation or development, allowing access to the latest code or specific releases. ```bash $ git clone https://github.com/deeptools/HiCExplorer.git ``` -------------------------------- ### Install older HiCExplorer versions using Pip Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Installs older versions of HiCExplorer (prior to v3.0) using the pip package manager. This method may require manual installation of additional system packages and is not recommended for newer versions due to dependency complexities. ```bash :: $ pip install hicexplorer ``` -------------------------------- ### Transform Hi-C Matrix to All Intermediate Formats Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Transforms a Hi-C matrix into all intermediate formats used in the PCA analysis for A/B compartment identification. This is useful if you need to visualize or analyze these intermediate matrices separately. The output is saved as an HDF5 file. ```bash # Transform Hi-C matrix to all intermediate formats $ hicTransform -m hic_corrected.h5 --outFileName all.h5 --method all ``` -------------------------------- ### Create a multi-resolution .mcool file Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This example demonstrates how to create a multi-resolution cooler file (.mcool) from a single cooler file (.cool). The tool automatically generates an mcool file containing all available resolutions from the input. Alternatively, multiple input matrices with different resolutions can be provided to create an mcool file. ```bash hicConvertFormat -m matrix.cool --inputFormat cool --outputFormat mcool ``` -------------------------------- ### Run Tool in Galaxy using bioblend Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Executes a specific tool in Galaxy with predefined inputs and a target history. It uses the tool's ID and the prepared input parameters. The job details are returned upon successful initiation. ```python # run mapping job_run = gi.tools.run_tool(history_id, latest_version_id, tool_inputs=my_input) ``` -------------------------------- ### Install HiCExplorer using Conda Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Installs HiCExplorer and its dependencies using the conda package manager with specified bioconda and conda-forge channels. This is the recommended installation method for ensuring all Python 3.6+ requirements are met. ```bash $ conda install hicexplorer -c bioconda -c conda-forge ``` -------------------------------- ### Download Dataset from Galaxy Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Downloads a dataset from Galaxy to a local file path. It requires the dataset's ID and the destination directory. The function creates the download directory if it doesn't exist and saves the file. ```python import os download_path = 'download_galaxy' os.mkdir(download_path) gi.datasets.download_dataset(dataset_ids[0], file_path=download_path) ``` -------------------------------- ### Connect to Galaxy Instance using bioblend Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Establishes a connection to a Galaxy instance using the bioblend library. Requires a Galaxy URL and an API key. API access is restricted to registered users; unregistered users can access the web interface. ```python from bioblend.galaxy import GalaxyInstance # API access is only possible for registered users. # Unregistered users can use the webinterface of https://hicexplorer.usegalaxy.eu API_KEY = "" gi = GalaxyInstance(url='https://hicexplorer.usegalaxy.eu', key=API_KEY) ``` -------------------------------- ### Pull HiCExplorer Docker image Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Pulls the HiCExplorer Galaxy instance as a Docker container. This provides a virtualized environment for using HiCExplorer within the Galaxy framework, simplifying setup and dependency management. ```bash $ sudo docker pull quay.io/bgruening/galaxy-hicexplorer ``` -------------------------------- ### Build Hi-C Matrix with hicBuildMatrix Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Constructs a Hi-C contact matrix from mapped read pairs using the `hicBuildMatrix` tool. Key parameters include the input SAM files, bin size, restriction enzyme recognition sequence, and output file path. It also generates QC reports for library quality assessment. ```bash # build matrix from independently mated read pairs # the restriction sequence GATC is recognized by the DpnII restriction enzyme $ hicBuildMatrix --samFiles mate_R1.bam mate_R2.bam \ --binSize 10000 \ --restrictionSequence GATC \ --danglingSequence GATC \ --restrictionCutFile cut_sites.bed \ --threads 4 \ --inputBufferSize 100000 \ --outBam hic.bam \ -o hic_matrix.h5 \ --QCfolder ./hicQC ``` -------------------------------- ### Plot Hi-C Matrix and Compartments with hicPlotMatrix Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst The `hicPlotMatrix` command visualizes Hi-C matrices and A/B compartments. It requires a Hi-C matrix file (e.g., `pearson_all.h5`) and outputs a PNG image. Optional arguments include `--perChr` for chromosome-specific plotting and `--bigwig` to generate a BigWig file. ```bash hicPlotMatrix -m pearson_all.h5 --outFileName pca1.png --perChr --bigwig pca1.bw ``` -------------------------------- ### Upload Dataset from URL to Galaxy Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Uploads a dataset to a specified Galaxy history from a given URL. It allows setting a custom file name and file type. The uploaded dataset's information is returned. ```python # Upload a dataset from an URL upload = gi.tools.put_url('https://zenodo.org/record/1183661/files/HiC_S2_1p_10min_lowU_R1.fastq.gz', history_id, file_name='R1.fastq', file_type='fastqsanger.gz') ``` -------------------------------- ### Example Usage of hicDetectLoops Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicDetectLoops.rst Demonstrates how to run the hicDetectLoops tool with essential parameters. This command detects loops from a .cool file, outputs results to a bedgraph file, and sets parameters for maximum loop distance, window size, peak width, and p-value thresholds. ```bash $ hicDetectLoops -m matrix.cool -o loops.bedgraph --maxLoopDistance 2000000 --windowSize 10 --peakWidth 6 --pValuePreselection 0.05 --pValue 0.05 ``` -------------------------------- ### Get Specific Tool Version in Galaxy Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Finds a specific version of a tool (e.g., Bowtie2) available in the Galaxy instance. It iterates through all available versions of the tool and identifies the one matching the desired version number. ```python # get the correct bowtie version all_versions = gi.tools.get_tools(name='Bowtie2') latest_version = None latest_version_id = None latest_version_number = '2.3.4.3+galaxy0' for tool in all_versions: if tool['version'] == latest_version_number: latest_version = tool latest_version_id = latest_version['id'] ``` -------------------------------- ### Convert .hic to .cool format using hic2cool Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This example demonstrates converting a Hi-C interaction matrix file (.hic) to the cooler format (.cool) with a specified resolution. It utilizes the hic2cool library, and requires the resolution to be present in the source .hic file. If no resolution is specified, a multi-resolution .mcool file is generated. ```bash hicConvertFormat -m matrix.hic --inputFormat hic --outputFormat cool -o matrix.cool --resolutions 10000 ``` -------------------------------- ### Compute A/B Compartments using PCA Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Computes the A/B compartments of a Hi-C matrix by performing Principal Component Analysis (PCA). This involves transforming the matrix, calculating correlation and covariance matrices, and then deriving eigenvectors. The results are output as BigWig files. ```bash # Compute A/B compartments using PCA and output as BigWig $ hicPCA -m hic_corrected.h5 --outFileName pca1.bw pca2.bw --format bigwig ``` -------------------------------- ### Create a History in Galaxy Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Creates a new history within the connected Galaxy instance. A history is used to organize datasets and analysis steps. The function returns a dictionary containing the new history's ID. ```python # Create a history history_id = gi.histories.create_history('Hi-C example NAR 2020')['id'] ``` -------------------------------- ### Map Hi-C Reads Individually with BWA Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Maps individual Hi-C read mates to a reference genome using BWA. It emphasizes using local mapping and specific parameters to penalize gaps, which is crucial for handling chimeric reads and improving mapping efficiency. The output is a BAM file for each read mate. ```bash # map the reads, each mate individually using # for example bwa # # bwa mem mapping options: # -A INT score for a sequence match, which scales options -TdBOELU unless overridden [1] # -B INT penalty for a mismatch [4] # -O INT[,INT] gap open penalties for deletions and insertions [6,6] # -E INT[,INT] gap extension penalty; a gap of size k cost '{-O} + {-E}*k' [1,1] # this is set very high to avoid gaps # at restriction sites. Setting the gap extension penalty high, produces better results as # the sequences left and right of a restriction site are mapped independently. # -L INT[,INT] penalty for 5'- and 3'-end clipping [5,5] # this is set to no penalty. $ bwa mem -A1 -B4 -E50 -L0 index_path \ mate_R1.fastq.gz 2>>mate_R1.log | samtools view -Shb - > mate_R1.bam $ bwa mem -A1 -B4 -E50 -L0 index_path \ mate_R2.fastq.gz 2>>mate_R2.log | samtools view -Shb - > mate_R2.bam ``` -------------------------------- ### Convert HiC-Pro format to .cool format Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This example shows how to convert HiC-Pro formatted data to the cooler format (.cool). The HiC-Pro format requires an additional bed file, which must be provided using the `--bedFileHicpro` argument. The conversion process uses the hicConvertFormat tool. ```bash hicConvertFormat -m matrix.hicpro --bedFileHicpro hicpro.bed --inputFormat hicpro --outputFormat cool -o matrix.cool ``` -------------------------------- ### Convert Homer format to .cool format Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This example demonstrates converting an interaction matrix from the Homer text file format to the cooler format (.cool). Homer format stores matrices as dense text files, which can be space-intensive for large datasets. The conversion is facilitated by the hicConvertFormat tool. ```bash hicConvertFormat -m matrix.homer --inputFormat homer --outputFormat cool -o matrix.cool ``` -------------------------------- ### Aggregate Hi-C Contacts using hicAggregateContacts (Bash) Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicAggregateContacts.rst This example demonstrates how to use the `hicAggregateContacts` command-line tool to generate an aggregated Hi-C matrix. It takes a Hi-C matrix file and a BED file containing regions of interest, specifying output file name, value range for plotting, number of bins for sub-matrices, chromosomes, operation type, transformation, and mode. The input regions are centered, and the range should be adjusted to capture contacts larger than TAD size. ```bash $ hicAggregateContacts --matrix Dmel.h5 --BED ChIP-seq-peaks.bed \ --outFileName Dmel_aggregate_Contacts --vMin 0.8 --vMax 2.2 \ --range 300000:1000000 --numberOfBins 30 --chromosomes X \ --operationType mean --transform obs/exp --mode intra-chr ``` -------------------------------- ### Align Hi-C Reads with Bowtie2 Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/mES-HiC_analysis.rst Aligns paired-end FASTQ files to a specified Bowtie2 index and converts the output to BAM format using samtools. Requires Bowtie2 and samtools to be installed. Input FASTQ files and Bowtie2 index path are parameters. ```bash bowtie2 -x bowtie2/mm10_index --threads 8 -U ../original_data/SRR1956528_1.fastq.gz --reorder | samtools view -Shb - > SRR1956528_1.bam bowtie2 -x bowtie2/mm10_index --threads 8 -U ../original_data/SRR1956528_2.fastq.gz --reorder | samtools view -Shb - > SRR1956528_2.bam bowtie2 -x bowtie2/mm10_index --threads 8 -U ../original_data/SRR1956529_1.fastq.gz --reorder | samtools view -Shb - > SRR1956529_1.bam bowtie2 -x bowtie2/mm10_index --threads 8 -U ../original_data/SRR1956529_2.fastq.gz --reorder | samtools view -Shb - > SRR1956529_2.bam ``` -------------------------------- ### Convert .cool to .cool format with correction name Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This usage example shows how to convert a cooler format file (.cool) to another cooler file, applying specific correction factors. The `correction_name` parameter specifies which correction factor (e.g., KR) to use, and the resulting matrix will store these values in the 'weight' column. ```bash hicConvertFormat -m matrix.cool --inputFormat cool --outputFormat cool -o matrix.cool --correction_name KR ``` -------------------------------- ### Align Hi-C Reads with BWA Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/mES-HiC_analysis.rst Aligns paired-end FASTQ files to a specified BWA index and converts the output to BAM format using samtools. Requires BWA and samtools to be installed. Input FASTQ files and BWA index path are parameters. ```bash bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956527_1.fastq.gz | samtools view -Shb - > SRR1956527_1.bam bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956527_2.fastq.gz | samtools view -Shb - > SRR1956527_2.bam bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956528_1.fastq.gz | samtools view -Shb - > SRR1956528_1.bam bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956528_2.fastq.gz | samtools view -Shb - > SRR1956528_2.bam bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956529_1.fastq.gz | samtools view -Shb - > SRR1956529_1.bam bwa mem -A 1 -B 4 -E 50 -L 0 -t 8 bwa/mm10_index original_data/SRR1956529_2.fastq.gz | samtools view -Shb - > SRR1956529_2.bam ``` -------------------------------- ### Correlate Hi-C Matrices with hicCorrelate (Bash) Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicCorrelate.rst This example demonstrates how to use the hicCorrelate command-line tool to calculate the Pearson correlation between multiple Hi-C matrices. It specifies input files, correlation method, logarithmic transformation, sample labels, genomic range, output file names for heatmap and scatter plot, and the output plot format. The tool is useful for quality control and identifying sample relationships. ```bash $ hicCorrelate -m Dmel_wt_1.h5 Dmel_wt_2.h5 Dmel_kd_1.h5 Dmel_kd_2.h5 \ --method=pearson --log1p \ --labels Dmel_wt_1 Dmel_wt_2 Dmel_kd_1 Dmel_kd_2 \ --range 5000:200000 \ --outFileNameHeatmap Dmel_heatmap --outFileNameScatter Dmel_scatterplot \ --plotFileFormat png ``` -------------------------------- ### Generate Diagnostic Plot for Hi-C Matrix Correction Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Generates a diagnostic plot to help determine appropriate thresholds for correcting Hi-C matrices. This plot visualizes the distribution of counts per bin, aiding in the identification of outliers. The output is a PNG image file. ```bash # Generate diagnostic plot for matrix correction $ hicCorrectMatrix diagnostic_plot -m hic_matrix.h5 -o hic_corrected.png ``` -------------------------------- ### Create Reference Point File for Hi-C Analysis Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/capture-Hi-C.rst Creates a tab-separated file defining reference points for Hi-C analysis. Each line specifies chromosome, start position, end position, and an identifier. This file is crucial for targeted analysis of specific genomic regions. ```bash chr1 4487435 4487435 Sox17 ``` -------------------------------- ### Build Hi-C Matrix with hicBuildMatrix Source: https://github.com/deeptools/hicexplorer/wiki/Home Constructs a Hi-C matrix from aligned read pairs (BAM files) and a restriction site BED file. Allows specification of minimum and maximum distances between restriction sites and outputs a Hi-C matrix in NPZ format. Requires HiCExplorer. ```shell $ hicBuildMatrix -s R1.bam R2.bam --outBam R12.bam \ --restrictionSequence AAGCTT \ --minDistance 400 \ --maxDistance 800 \ --restrictionCutFile hindIII.bed \ -o hic.npz > hic.log ``` -------------------------------- ### Download and extract HiCExplorer release tarball Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/installation.rst Downloads a specific release version of HiCExplorer as a tarball and extracts the source code. This is an alternative to cloning the repository when a specific stable version is desired. ```bash $ wget https://github.com/deeptools/HiCExplorer/archive/1.5.12.tar.gz $ tar -xzvf ``` -------------------------------- ### Map Hi-C Reads with Bowtie2 Source: https://github.com/deeptools/hicexplorer/wiki/Home Maps Hi-C fragment pairs individually using bowtie2 with local alignment and reordering options. Outputs aligned reads to BAM format using samtools. Requires bowtie2 and samtools. ```shell $ bowtie2 --local --reorder -x genome_index -U R1.fastq.gz 2>> R1.log | samtools view -Shb - > R1.bam $ bowtie2 --local --reorder -x genome_index -U R2.fastq.gz 2>> R2.log | samtools view -Shb - > R2.bam ``` -------------------------------- ### Build Multicooler Hi-C Matrix with Multiple Resolutions (Bash) Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicBuildMatrix.rst This command demonstrates how to build a multicooler Hi-C matrix using hicBuildMatrix. It takes forward and reverse BAM files as input and specifies multiple bin sizes for different resolutions. The output file is set to 'multi_resolution.cool', and a QC folder is defined. This functionality is useful for creating matrices compatible with visualization tools like HiGlass. ```bash hicBuildMatrix -s forward.bam reverse.bam -o multi_resolution.cool \ --binSize 10000 20000 50000 100000 --QCfolder QC ``` -------------------------------- ### Download Raw FASTQ Files for Hi-C Analysis Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/mES-HiC_analysis.rst Downloads raw FASTQ files from the EBI archive for Hi-C analysis. These files are essential input for subsequent alignment steps. Ensure sufficient disk space for storage in the 'original_data' directory. ```bash mkdir original_data wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/007/SRR1956527/SRR1956527_1.fastq.gz -O original_data/SRR1956527_1.fastq.gz wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/007/SRR1956527/SRR1956527_2.fastq.gz -O original_data/SRR1956527_2.fastq.gz wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/008/SRR1956528/SRR1956528_1.fastq.gz -O original_data/SRR1956528_1.fastq.gz wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/008/SRR1956528/SRR1956528_2.fastq.gz -O original_data/SRR1956528_2.fastq.gz wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/009/SRR1956529/SRR1956529_1.fastq.gz -O original_data/SRR1956529_1.fastq.gz wget ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR195/009/SRR1956529/SRR1956529_2.fastq.gz -O original_data/SRR1956529_2.fastq.gz ``` -------------------------------- ### Retrieve Dataset IDs by Datatype in Galaxy Source: https://github.com/deeptools/hicexplorer/blob/master/examples/hicexplorer.usegalaxy.eu API access.ipynb Retrieves the IDs of datasets within a specific history that match a given datatype. This involves fetching all items in the history and filtering them based on their 'extension' property. ```python # get the uploaded dataset ids # wait until the data has been uploaded dataset_ids = [] all_items = gi.histories.show_history(history_id, contents=False)['state_ids']['ok'] datatype = 'fastqsanger.gz' # get the files with the correct data type for items in all_items: items_data = gi.datasets.show_dataset(items) if items_data['extension'] == datatype: dataset_ids.append(items) ``` -------------------------------- ### BED File Format for Regions Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicAdjustMatrix.rst Defines the format for specifying regions in a BED file. Each line represents a region with chromosome name, start position, and end position. This format is used by hicAdjustMatrix for masking or removing regions. ```plaintext chr1 10 30 chr1 50 300 ``` -------------------------------- ### Convert HiCExplorer Matrix to Bioconductor GInteractions Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/HiCExport.rst This snippet demonstrates how to use the `hicConvertFormat` tool to convert a HiCExplorer H5 matrix into a GInteractions TSV file, which can be imported into R for further analysis. It requires the HiCExplorer tool to be installed and accessible. ```bash ## Assuming HiCExplorer is installed in ~/programs hicConvertFormat --matrix ~/programs/HiCExplorer/test/test_data/Li_et_al_2015.h5 \ --inputFormat h5 -o GInteration_example --outputFormat GInteractions ``` -------------------------------- ### Compare Hi-C Matrices using Log2Ratio Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicCompareMatrices.rst This command compares two Hi-C matrices, calculating the log2ratio between them. It requires input matrices in .h5 format and specifies the operation and output file. The matrices should ideally be pre-corrected and have merged bins for accurate comparison. ```bash hicCompareMatrices -m \ M1BP_KD_merge_m50_corrected.h5 \ GST_merge_rf_m50_corrected.h5 \ --operation log2ratio -o m1bp_over_gst_log2_m50.h5 ``` -------------------------------- ### Mapping Reads with Bowtie2 and Samtools Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/capture-Hi-C.rst This snippet demonstrates how to map raw sequencing reads (FASTQ files) against a reference genome (mm9) using bowtie2 and then convert the output to BAM format using samtools. It is crucial for preparing data for downstream analysis. ```bash bowtie2 -x mm9_index --threads 8 -U SRR3950565_1.fastq.gz --reorder | samtools view -Shb - > SRR3950565_1.bam bowtie2 -x mm9_index --threads 8 -U SRR3950565_2.fastq.gz --reorder | samtools view -Shb - > SRR3950565_2.bam bowtie2 -x mm9_index --threads 8 -U SRR3950566_1.fastq.gz --reorder | samtools view -Shb - > SRR3950566_1.bam bowtie2 -x mm9_index --threads 8 -U SRR3950566_2.fastq.gz --reorder | samtools view -Shb - > SRR3950566_2.bam bowtie2 -x mm9_index --threads 8 -U SRR3950559_1.fastq.gz --reorder | samtools view -Shb - > SRR3950559_1.bam bowtie2 -x mm9_index --threads 8 -U SRR3950559_2.fastq.gz --reorder | samtools view -Shb - > SRR3950559_2.bam bowtie2 -x mm9_index --threads 8 -U SRR3950560_1.fastq.gz --reorder | samtools view -Shb - > SRR3950560_1.bam bowtie2 -x mm9_index --threads 8 -U SRR3950560_2.fastq.gz --reorder | samtools view -Shb - > SRR3950560_2.bam ``` -------------------------------- ### Visualize Corrected Hi-C Matrix in Log Scale Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Plots a corrected Hi-C matrix, displaying counts in a log-transformed scale for better visualization of data with large count variations. This command allows specifying a genomic region and saves the plot as a PNG file. ```bash # Visualize corrected Hi-C matrix with log scale $ hicPlotMatrix -m hic_corrected.h5 -o hic_plot.png --region 1:20000000-80000000 --log1p ``` -------------------------------- ### hicFindTADs Quick Parameter Testing Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicFindTADs.rst This bash command demonstrates how to quickly test different threshold comparisons for TAD calling by utilizing a pre-computed z-score matrix. By providing the path to the z-score matrix via `--TAD_sep_score_prefix`, the tool bypasses the computationally intensive z-score calculation, significantly speeding up the parameter testing process. Parameters like `--minDepth`, `--maxDepth`, and `--step` are ignored in this mode. ```bash $ hicFindTADs -m myHiCmatrix.h5 \ --outPrefix myHiCmatrix_min10000_max40000_step1500_thres0.01_delta0.01_fdr \ --TAD_sep_score_prefix myHiCmatrix_min10000_max40000_step1500_thres0.05_delta0.01_fdr --thresholdComparisons 0.01 \ --delta 0.01 \ --correctForMultipleTesting fdr \ -p 64 ``` -------------------------------- ### Display hicPlotMatrix Help Information Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/list-of-tools.rst Retrieves and displays all available command-line options and their descriptions for the hicPlotMatrix tool. This is useful for understanding the full range of parameters and customization options for plotting Hi-C data. ```bash $ hicPlotMatrix --help ``` -------------------------------- ### Perform Quality Control on Hi-C Data with chicQualityControl Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/capture-Hi-C.rst Performs quality control on Hi-C matrices based on sparsity of reference points. Requires input matrices, a reference point file, a sparsity threshold, and the number of threads. It outputs plots and files detailing accepted/rejected reference points and their sparsity levels. ```bash chicQualityControl -m FL-E13-5.cool MB-E10-5.cool -rp reference_points.bed --sparsity 0.025 --threads 20 ``` -------------------------------- ### Build Hi-C Matrix with hicBuildMatrix Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/mES-HiC_analysis.rst Constructs a Hi-C matrix from aligned BAM files. Requires aligned BAM files, bin size, restriction site information, and output file paths. It generates a Hi-C matrix file and a quality report. ```bash mkdir hicMatrix hicBuildMatrix --samFiles SRR1956527_1.bam SRR1956527_2.bam --binSize 10000 --restrictionSequence GATC --danglingSequence GATC --restrictionCutFile cut_sites.bed --outBam SRR1956527_ref.bam --outFileName hicMatrix/SRR1956527_10kb.h5 --QCfolder hicMatrix/SRR1956527_10kb_QC --threads 8 --inputBufferSize 400000 hicBuildMatrix --samFiles SRR1956528_1.bam SRR1956528_2.bam --binSize 10000 --restrictionSequence GATC --danglingSequence GATC --restrictionCutFile cut_sites.bed --outBam SRR1956528_ref.bam --outFileName hicMatrix/SRR1956528_10kb.h5 --QCfolder hicMatrix/SRR1956528_10kb_QC --threads 8 --inputBufferSize 400000 hicBuildMatrix --samFiles SRR1956529_1.bam SRR1956529_2.bam --binSize 10000 --restrictionSequence GATC --danglingSequence GATC --restrictionCutFile cut_sites.bed --outBam SRR1956529_ref.bam --outFileName hicMatrix/SRR1956529_10kb.h5 --QCfolder hicMatrix/SRR1956529_10kb_QC --threads 8 --inputBufferSize 400000 ``` -------------------------------- ### Call TADs from Corrected Hi-C Matrix Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Identifies Topologically Associating Domains (TADs) from a corrected Hi-C matrix. This process involves calculating a TAD-separation score and identifying boundaries. The output includes several files, including BED files for boundary and domain locations, and a BEDgraph file for visualization. ```bash # Call TADs from a corrected Hi-C matrix $ hicFindTADs -m hic_corrected.h5 --outPrefix hic_corrected --numberOfProcessors 16 ``` -------------------------------- ### Visualize Hi-C Matrix Comparison Source: https://context7.com/deeptools/hicexplorer/llms.txt This command visualizes the comparison between Hi-C matrices, such as the log2 ratio, by generating a heatmap. It requires a comparison matrix file and specifies the region and color map for visualization. ```python # Visualize comparison hicPlotMatrix \ --matrix log2ratio.h5 \ --outFileName comparison_heatmap.png \ --region chr1:5000000-10000000 \ --colorMap RdBu_r \ --vMin -2 \ --vMax 2 ``` -------------------------------- ### Convert Multiple Cool Matrices to Multi-Resolution MCOOL Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/tools/hicConvertFormat.rst This command converts multiple individual Hi-C matrices in COOL format into a single multi-resolution MCOOL file. It takes a list of input COOL files and specifies the desired output MCOOL file name. The resolutions are automatically inferred from the input files if not explicitly provided with the '--resolutions' option. ```bash $ hicConvertFormat -m matrix10kb.cool matrix20kb.cool matrix30kb.cool \ --inputFormat cool --outputFormat mcool -o multi_matrix.mcool ``` -------------------------------- ### Analyze Intra-TAD vs Inter-TAD Interactions (Python) Source: https://context7.com/deeptools/hicexplorer/llms.txt Quantifies TAD insulation by comparing the frequency of interactions within TADs versus between TADs. This tool requires a Hi-C matrix and a BED file of TAD domains. It can output statistics and generate plots visualizing the ratio of intra-TAD to inter-TAD interactions, indicating TAD boundary strength. The tool supports parallel processing using the `--threads` option and can compare multiple conditions by providing multiple matrices and output files. ```python # Calculate intra-TAD vs inter-TAD interaction ratios hicInterIntraTAD \ --matrix corrected_matrix.h5 \ --tadDomains TADs_domains.bed \ --outFileName tad_statistics.txt \ --outFileNameRatioPlot ratio_plot.png \ --threads 4 # Compare TAD insulation between conditions hicInterIntraTAD \ --matrix control.h5 treatment.h5 \ --tadDomains domains.bed \ --outFileName control_stats.txt treatment_stats.txt \ --labels Control Treatment # Output: Statistics showing TAD boundary strength # Higher intra/inter ratio indicates stronger TAD insulation ``` -------------------------------- ### Correct Hi-C Matrix with Filtering Thresholds Source: https://github.com/deeptools/hicexplorer/blob/master/docs/content/example_usage.rst Corrects a Hi-C matrix by applying specified filter thresholds to remove outliers and noise. The function takes the input matrix, lower and upper thresholds, and an output file name. It's recommended to use values between -2 and -1 for the lower threshold and around 5 for the upper threshold. ```bash # Correct Hi-C matrix with specified thresholds $ hicCorrectMatrix correct -m hic_matrix.h5 --filterThreshold -1.5 5 -o hic_corrected.h5 ```