├── .gitignore ├── .travis.yml ├── LICENSE ├── MANIFEST.in ├── README.rst ├── docs ├── Makefile ├── about_ccmap_file.rst ├── about_gcmap_file.rst ├── about_h5_file.rst ├── apidoc │ ├── ccmap.rst │ ├── ccmapHelpers.rst │ ├── cmstats.rst │ ├── config.rst │ ├── corrMatrix.rst │ ├── gcmap.rst │ ├── genomicsDataHandler │ │ ├── EncodeDatasetsConverter.rst │ │ ├── bedhandler.rst │ │ ├── bigwighandler.rst │ │ ├── hdf5handler.rst │ │ ├── index.rst │ │ ├── tempnumpyarrayfiles.rst │ │ ├── textHandler.rst │ │ └── wighandler.rst │ ├── importer.rst │ ├── index.rst │ ├── normalizer.rst │ ├── statDist.rst │ ├── summary.rst │ └── util.rst ├── cmapNormalization.rst ├── commands │ ├── bc2cmap.rst │ ├── bed2h5.rst │ ├── bigWig2h5.rst │ ├── cmapImporter.rst │ ├── cmapNormalizer.rst │ ├── config.rst │ ├── coo2cmap.rst │ ├── encode2h5.rst │ ├── h5Converter.rst │ ├── hic2gcmap.rst │ ├── homer2cmap.rst │ ├── normIC.rst │ ├── normKR.rst │ ├── normMCFS.rst │ ├── normVC.rst │ ├── pairCoo2cmap.rst │ └── wig2h5.rst ├── conf.py ├── dLcmaps.rst ├── dlDatasetLinks.txt ├── downloadCCMapLinks.txt ├── faq.rst ├── file_formats.rst ├── images │ ├── axis.png │ ├── browser.png │ ├── browser_indexed.png │ ├── color-bar-dialog.png │ ├── colormap_dialog.png │ ├── dataset_selector.png │ ├── genome_track_options.png │ ├── h5Converter.png │ ├── importer.png │ ├── marker_options.png │ ├── normalizer.png │ ├── pageSize_dialog.png │ └── view-point.png ├── index.rst ├── install.rst ├── make.bat ├── mapBrowser.rst ├── modules_examples │ ├── access_ccmap_data.ipynb │ ├── access_gcmap_data.ipynb │ ├── compare_IC_norm.ipynb │ ├── compare_KR_norm.ipynb │ ├── export_ccmap.ipynb │ ├── import_ccmap.ipynb │ ├── index.rst │ ├── masked_array_ccmap.ipynb │ └── normalize_ccmap.ipynb ├── requirements.txt └── usage.rst ├── gcMapExplorer ├── __init__.py ├── _version.py ├── clui │ ├── __init__.py │ ├── bc2cmap.py │ ├── bed2h5.py │ ├── bigwig2h5.py │ ├── cmap2coo.py │ ├── config.py │ ├── coo2cmap.py │ ├── corrBWcmaps.py │ ├── encode2h5.py │ ├── hic2gcmap.py │ ├── homer2cmap.py │ ├── normIC.py │ ├── normKR.py │ ├── normMCFS.py │ ├── normVC.py │ ├── pairCoo2cmap.py │ └── wig2h5.py ├── config.py ├── gui │ ├── UIs │ │ ├── aboutBrowser.ui │ │ ├── correlationMaps.ui │ │ ├── dialogAxisProps.ui │ │ ├── dialogCustomPageSize.ui │ │ ├── gcmapSelectorForBrowser.ui │ │ ├── genomicDataSelector.ui │ │ ├── importer.ui │ │ ├── mainWindow.ui │ │ ├── mainWindow_old.ui │ │ ├── normalizer.ui │ │ ├── other1DFormatFileConversion.ui │ │ ├── textFileSelector.ui │ │ └── userColorMapDialog.ui │ ├── __init__.py │ ├── browser.py │ ├── browserHelpers.py │ ├── guiHelpers.py │ ├── h5Converter.py │ ├── icons │ │ ├── cmaps │ │ │ ├── afmhot.ico │ │ │ ├── afmhot_r.ico │ │ │ ├── autumn.ico │ │ │ ├── autumn_r.ico │ │ │ ├── blue_green.ico │ │ │ ├── blue_purple.ico │ │ │ ├── blues.ico │ │ │ ├── bone.ico │ │ │ ├── bone_r.ico │ │ │ ├── cool.ico │ │ │ ├── cool_r.ico │ │ │ ├── copper.ico │ │ │ ├── copper_r.ico │ │ │ ├── gist_heat.ico │ │ │ ├── gist_heat_r.ico │ │ │ ├── gray.ico │ │ │ ├── gray_r.ico │ │ │ ├── green_blue.ico │ │ │ ├── greens.ico │ │ │ ├── greys.ico │ │ │ ├── hot.ico │ │ │ ├── hot_r.ico │ │ │ ├── oranges.ico │ │ │ ├── oranges_red.ico │ │ │ ├── pink.ico │ │ │ ├── pink_r.ico │ │ │ ├── purple_blue.ico │ │ │ ├── purple_blue_green.ico │ │ │ ├── purple_red.ico │ │ │ ├── purples.ico │ │ │ ├── red_purples.ico │ │ │ ├── reds.ico │ │ │ ├── spring.ico │ │ │ ├── spring_r.ico │ │ │ ├── summer.ico │ │ │ ├── summer_r.ico │ │ │ ├── winter.ico │ │ │ ├── winter_r.ico │ │ │ ├── yellow_green.ico │ │ │ ├── yellow_green_blue.ico │ │ │ ├── yellow_orange_brown.ico │ │ │ └── yellow_orange_red.ico │ │ ├── downArrow.ico │ │ ├── downArrow.png │ │ ├── fitPlotsTight.png │ │ ├── gotoPlay.png │ │ ├── hspaceDecrement.png │ │ ├── hspaceIncrement.png │ │ ├── leftArrow.ico │ │ ├── leftArrow.png │ │ ├── leftDownArrow.ico │ │ ├── leftDownArrow.png │ │ ├── leftUpArrow.ico │ │ ├── leftUpArrow.png │ │ ├── resetArrow.ico │ │ ├── resetArrow.png │ │ ├── rightArrow.ico │ │ ├── rightArrow.png │ │ ├── rightDownArrow.ico │ │ ├── rightDownArrow.png │ │ ├── rightUpArrow.ico │ │ ├── rightUpArrow.png │ │ ├── upArrow.ico │ │ ├── upArrow.png │ │ ├── vspaceDecrement.png │ │ ├── vspaceIncrement.png │ │ ├── zoomIn.ico │ │ ├── zoomIn.png │ │ ├── zoomOut.ico │ │ └── zoomOut.png │ ├── importer_ui.py │ ├── normalizer_ui.py │ └── qtStyle.qss ├── lib │ ├── TadFinder.pyx │ ├── __init__.py │ ├── _corrMatrixCore.pyx │ ├── ccmap.py │ ├── ccmapHelpers.pyx │ ├── cmstats.py │ ├── compartments.py │ ├── corrMatrix.py │ ├── corrMatrixCoreSRC.c │ ├── corrMatrixCoreSRC.h │ ├── gcmap.py │ ├── genomicsDataHandler.py │ ├── hic2gcmap.py │ ├── hicparser.py │ ├── importer.py │ ├── normalizeCore.pyx │ ├── normalizeKnightRuiz.pyx │ ├── normalizer.py │ ├── statDist.py │ └── util.py └── main.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .localhistory 3 | .idea/ 4 | .vscode/ 5 | 6 | # Ignore test folder 7 | test/ 8 | 9 | 10 | # Byte-compiled / optimized / DLL files 11 | __pycache__/ 12 | *.py[cod] 13 | *$py.class 14 | 15 | 16 | # C extensions 17 | *.so 18 | *.c 19 | !*SRC.c 20 | 21 | # Distribution / packaging 22 | .Python 23 | env/ 24 | build/ 25 | develop-eggs/ 26 | dist/ 27 | downloads/ 28 | eggs/ 29 | wheels/ 30 | wheelhouse/ 31 | .eggs/ 32 | lib64/ 33 | parts/ 34 | sdist/ 35 | var/ 36 | *.egg-info/ 37 | .installed.cfg 38 | *.egg 39 | 40 | # PyInstaller 41 | # Usually these files are written by a python script from a template 42 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 43 | *.manifest 44 | *.spec 45 | 46 | # Installer logs 47 | pip-log.txt 48 | pip-delete-this-directory.txt 49 | 50 | # Unit test / coverage reports 51 | htmlcov/ 52 | .tox/ 53 | .coverage 54 | .coverage.* 55 | .cache 56 | nosetests.xml 57 | coverage.xml 58 | *,cover 59 | .hypothesis/ 60 | 61 | # Translations 62 | *.mo 63 | *.pot 64 | 65 | # Django stuff: 66 | *.log 67 | local_settings.py 68 | 69 | # Flask stuff: 70 | instance/ 71 | .webassets-cache 72 | 73 | # Scrapy stuff: 74 | .scrapy 75 | 76 | # Sphinx documentation 77 | docs/_build/ 78 | docs/_templates/ 79 | docs/_static/ 80 | 81 | # PyBuilder 82 | target/ 83 | 84 | # IPython Notebook 85 | .ipynb_checkpoints 86 | 87 | # pyenv 88 | .python-version 89 | 90 | # celery beat schedule file 91 | celerybeat-schedule 92 | 93 | # dotenv 94 | .env 95 | 96 | # virtualenv 97 | venv/ 98 | ENV/ 99 | 100 | # Spyder project settings 101 | .spyderproject 102 | 103 | # Rope project settings 104 | .ropeproject 105 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # After changing this file, check it on: 2 | # http://lint.travis-ci.org/ 3 | language: python 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | python: 10 | - 3.4 11 | - 3.5 12 | - 3.6 13 | 14 | matrix: 15 | exclude: 16 | - os: osx 17 | python: 3.4 18 | - os: osx 19 | python: 3.5 20 | - os: osx 21 | python: 3.6 22 | include: 23 | - os: osx 24 | python: 3.4 25 | language: generic 26 | env: TOXENV=py34 27 | osx_image: xcode10.1 28 | - os: osx 29 | python: 3.5 30 | language: generic 31 | env: TOXENV=py35 32 | osx_image: xcode10.1 33 | - os: osx 34 | python: 3.6 35 | language: generic 36 | env: TOXENV=py36 37 | osx_image: xcode10.1 38 | - os: osx 39 | python: 3.4 40 | language: generic 41 | env: TOXENV=py34 42 | osx_image: xcode9.2 43 | - os: osx 44 | python: 3.5 45 | language: generic 46 | env: TOXENV=py35 47 | osx_image: xcode9.2 48 | - os: osx 49 | python: 3.6 50 | language: generic 51 | env: TOXENV=py36 52 | osx_image: xcode9.2 53 | - os: osx 54 | python: 3.4 55 | language: generic 56 | env: TOXENV=py34 57 | osx_image: xcode8 58 | - os: osx 59 | python: 3.5 60 | language: generic 61 | env: TOXENV=py35 62 | osx_image: xcode8 63 | - os: osx 64 | python: 3.6 65 | language: generic 66 | env: TOXENV=py36 67 | osx_image: xcode8 68 | allow_failures: 69 | - os: osx 70 | 71 | env: 72 | global: 73 | # $PYPIPASSWORD 74 | - secure: "sZ/m1r7iKmxPAvbfTe50edLWSQwkCLs7VKR/wttcdIcWJS5Oj90gq9zoga/SKw3o44wamvvTZglvi1iDyUrPL14Rq2OkZlwBYfMmtS9usK7c5Z6NAyvxBniSvZlltIr3UBuryLn0xDN7VJkiCRMYOZJvL+TZ2+ixDjIddkNfw6O/pE1RVWKBgkRU5MmRuWsEBO85hCimBcRnZ/5cLCxTA3sxPITuFv4YnB+FkCRS5oASHIaOucyrXH4ndCtuCDrDTKGRlcM0e5+wnNYnjqC5/WkS07C1HsQNdt30fRKzdaJVpd0DuYSHyzDu0mkl3/zaVwytWqiwoD1G6LtSH4ey+O+WFmpvkY8Xj+3XuHfidDQ6GN1Fk43QKzF7c7u1o/pZr7eR2P/ltVb+x2ol7Ag51Ecx2qC8okhc/OT05P5PoQJhEt1aTjuw2NTd2Wv0Zr6+aobQT08r4Ij4UoxCkvaUi1n4LoPsyz6sIS4xDYOAKhKGrQ9TeO2po6CRmdBEc9vqqO86q9u2uiWRl8cYD40qmnRsu0Nuzwi9RzXXUfoDqgkGmKkaEJycPnKueLHaHxInNVJoqbEnCEdYMZG9PmiqPk0wstSRC1a1covmUNao1JGx6elqhDeNS04Et6keUe4YDlsbMUyQF1QTftzuO5kqgAJQXNsCINTw6UBhytzUeVs=" 75 | 76 | before_install: 77 | - | 78 | if [[ $TRAVIS_OS_NAME != 'osx' ]]; then 79 | sudo apt-get -y install python3 python3-setuptools 80 | 81 | echo "No need to install PyQt5. It is required during execution only" 82 | 83 | # Builds, directory for temporay installation 84 | mkdir -p builds 85 | chmod a+rw builds 86 | 87 | # Install patchelf 88 | pushd builds 89 | git clone https://github.com/NixOS/patchelf 90 | #curl -L -o patchelf-0.9.tar.gz https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.gz 91 | #tar -zxvf patchelf-0.9.tar.gz 92 | pushd patchelf 93 | ./bootstrap.sh 94 | ./configure && make && sudo make install 95 | popd 96 | popd 97 | 98 | else 99 | brew update 100 | brew cask uninstall oclint 101 | brew install gcc@5 --without-multilib 102 | brew outdated pyenv || brew upgrade pyenv 103 | eval "$(pyenv init -)" 104 | 105 | case "${TOXENV}" in 106 | py34) 107 | PYVER=3.4 108 | # Install the latest release of the specified Python version using pyenv. 109 | PYVER="$(pyenv install --list | grep -E "^\\s*$PYVER" | sort -n -t. -k3 | tail -n1)" 110 | pyenv install $PYVER 111 | pyenv global $PYVER 112 | echo "Selected Python $PYVER" 113 | python --version 114 | ;; 115 | py35) 116 | PYVER=3.5 117 | # Install the latest release of the specified Python version using pyenv. 118 | PYVER="$(pyenv install --list | grep -E "^\\s*$PYVER" | sort -n -t. -k3 | tail -n1)" 119 | pyenv install $PYVER 120 | pyenv global $PYVER 121 | echo "Selected Python $PYVER" 122 | python --version 123 | ;; 124 | py36) 125 | PYVER=3.6 126 | # Install the latest release of the specified Python version using pyenv. 127 | PYVER="$(pyenv install --list | grep -E "^\\s*$PYVER" | sort -n -t. -k3 | tail -n1)" 128 | pyenv install $PYVER 129 | pyenv global $PYVER 130 | echo "Selected Python $PYVER" 131 | python --version 132 | ;; 133 | esac 134 | 135 | fi 136 | 137 | install: 138 | - | 139 | pip install --upgrade pip 140 | pip install --upgrade wheel 141 | pip install Cython --install-option="--no-cython-compile" 142 | pip install uninstall numpy 143 | pip install install numpy 144 | pip install --upgrade scipy 145 | pip install --upgrade matplotlib 146 | pip install --upgrade h5py 147 | pip install --upgrade sklearn 148 | pip install psutil 149 | 150 | if [[ $TRAVIS_OS_NAME != 'osx' ]]; then 151 | pip install auditwheel 152 | else 153 | pip install --upgrade coverage coveralls flake8 pep8 154 | export CC=gcc-5 155 | export CXX=g++-5 156 | fi 157 | 158 | # Install gcMapExplorer 159 | pip install -ve . 160 | 161 | script: 162 | - python -c 'import gcMapExplorer' 163 | - python -c 'import gcMapExplorer.lib as gmlib' 164 | 165 | after_success: 166 | # Specify account details for PyPI 167 | - | 168 | echo "[distutils]" > ~/.pypirc 169 | echo "index-servers =" >> ~/.pypirc 170 | echo " pypi" >> ~/.pypirc 171 | echo "[pypi]" >> ~/.pypirc 172 | echo " username: rjdkmr" >> ~/.pypirc 173 | echo " password: $PYPIPASSWORD" >> ~/.pypirc 174 | 175 | # For OS X and tags only, build a Python source distribution and "binary 176 | # wheel" and upload these to PyPI. Note that the source upload will only 177 | # succeed the first time and will be skipped by twine in subsiquent attempts. 178 | - | 179 | pip install --upgrade twine 180 | export TWINE_USERNAME=rjdkmr 181 | export TWINE_PASSWORD=$PYPIPASSWORD 182 | if [[ $TRAVIS_OS_NAME != 'osx' ]]; then 183 | pip wheel --no-deps --no-cache-dir -w wheels . 184 | auditwheel show wheels/*.whl 185 | auditwheel repair wheels/*.whl 186 | twine upload -u rjdkmr -p $PYPIPASSWORD --skip-existing wheelhouse/* 187 | python setup.py sdist 188 | else 189 | python setup.py sdist bdist_wheel 190 | fi 191 | twine upload -u rjdkmr -p $PYPIPASSWORD --skip-existing dist/* 192 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include gcMapExplorer/gui/UIs/*.ui 2 | include gcMapExplorer/gui/icons/cmaps/*.ico 3 | include gcMapExplorer/gui/icons/*.* 4 | 5 | include gcMapExplorer/lib/*.pyx 6 | 7 | exclude gcMapExplorer/lib/_*.c 8 | include gcMapExplorer/lib/*SRC.c 9 | include gcMapExplorer/lib/*SRC.h 10 | 11 | recursive-exclude test *.* 12 | global-exclude *.localhistory 13 | -------------------------------------------------------------------------------- /docs/about_ccmap_file.rst: -------------------------------------------------------------------------------- 1 | .. |numpy memmap| raw:: html 2 | 3 | numpy memmap 4 | 5 | 6 | .. |numpy array| raw:: html 7 | 8 | numpy array 9 | 10 | 11 | .. |numpy array concept| raw:: html 12 | 13 | here 14 | 15 | .. |indexing and slicing| raw:: html 16 | 17 | indexing and slicing 18 | 19 | .. |numpy routines| raw:: html 20 | 21 | numpy 22 | 23 | .. |scipy routines| raw:: html 24 | 25 | scipy 26 | 27 | 28 | 29 | ``*.ccmap`` and ``*.npbin`` files 30 | --------------------------------- 31 | 32 | This package implements the Chromosome Contact Map (ccmap) data in a specific format, which contains two inter-related files, 33 | * ``*.ccmap``: It is a text file and contains meta-data for the Chromosome Contact Map. 34 | * ``*.npbin`` or ``*.npbin.gz``: This file contains the Chromosome Contact Map data, which is a memory mapped 2D matrix. 35 | 36 | 37 | In contrast to ``gcmap`` file, the ``*.ccmap`` and ``*.npbin`` paired files contain only one contact map. To perform mathematical 38 | operations directly using ``gcmap`` is slow 39 | (`see here `_), 40 | therefore, gcMapExplorer uses ``*.ccmap`` and ``*.npbin`` paired files during mathematical calculations. 41 | 42 | 43 | Why two files? 44 | ============== 45 | Contact map is a two-dimensional matrix. Size of matrix can be very huge for large chromosome at high resolutions. 46 | Memory required to handle such huge matrices could be very large and sometimes beyond the available hardware. 47 | Therefore, we used a matrix mapped to the file ``*.npbin`` (compressed ``*.npbin.gz``), which is stored in external disk. 48 | For each Contact map, we also need to store some properties like its title/name, size, minimum and maximum values, columns/rows with missing data, and 49 | path to memory mapped matrix file. These properties are stored in ``*.ccmap`` file. 50 | 51 | Advantages of memory mapped matrix file 52 | ======================================= 53 | * It is a binary indexed file and any particular region of the matrix can be rapidly accessed. 54 | * This file is generated using |numpy memmap|, and therefore, it can be used as |numpy array|. See also |numpy array concept| for more about numpy array. 55 | * Because, it can be used as a numpy array, |indexing and slicing| operations can be performed to access the data. 56 | * All mathematical operations available in |numpy routines| and |scipy routines| modules can be directly performed. 57 | 58 | 59 | Contents of ``*.ccmap`` file 60 | ============================= 61 | 62 | ``*.ccmap`` is a text file and its content is shown as example: 63 | 64 | :: 65 | 66 | { 67 | "title":null, 68 | "path2matrix":"chr22_100kb_normKR.npbin", 69 | "xlabel":null, 70 | "minvalue":"7.207987891888479e-06", 71 | "bLog":false, 72 | "state":"saved", 73 | "maxvalue":"0.28213343024253845", 74 | "binsize":100000, 75 | "shape":[ 76 | "513", 77 | "513" 78 | ], 79 | "matrix":null, 80 | "yticks":[ 81 | "0", 82 | "51300000" 83 | ], 84 | "bNoData":"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 85 | "xticks":[ 86 | "0", 87 | "51300000" 88 | ], 89 | "ylabel":null, 90 | "dtype":"float32" 91 | } 92 | 93 | 94 | Following properties are included in Contact Map metadata file: 95 | * ``title``: Title of the data. Used to display in browser. 96 | * ``path2matrix``: Path to ``*.npbin`` or ``*.npbin.gz`` file 97 | * ``bLog``: Whether values in matrix is Logarithm values 98 | * ``maxvalue``: Maximum value 99 | * ``minvalue``: Minimum value 100 | * ``binsize``: Resolution of data. 101 | * ``shape``: Shape of matrix along X and Y axis 102 | * ``xticks``: Upper and lower limits of X-axis 103 | * ``yticks``: Upper and lower limits of Y-axis 104 | * ``xlabel``: Label for x-axis 105 | * ``ylabel``: Label for y-axis 106 | * ``matrix``: See :attr:`gcMapExplorer.lib.CCMAP.matrix` 107 | * ``state``: See :attr:`gcMapExplorer.lib.CCMAP.state` 108 | * ``dtype``: Data type for memory mapped matrix file. e.g. float, float32, float64 etc. 109 | * ``bNoData``: Whether data is missing for entire row/column 110 | -------------------------------------------------------------------------------- /docs/about_h5_file.rst: -------------------------------------------------------------------------------- 1 | .. |hdf5| raw:: html 2 | 3 | HDF5 4 | 5 | .. |lzf| raw:: html 6 | 7 | LZF 8 | 9 | 10 | Genomic track HDF5 (.h5) file 11 | ============================= 12 | To enable rapid visualization of genomic track datasets along with contact map, 13 | we used |hdf5| format file to store these datasets at various resolutions. HDF5 14 | is a binary indexed file and therefore, entire datasets or a portion of dataset 15 | can be accessed rapidly. 16 | 17 | HDF5 library is available for C, C++, R, Java and Python programming language, 18 | and therefore these files can be directly read through these languages. 19 | 20 | 21 | Downsampling or Coarsening of datasets 22 | -------------------------------------- 23 | Genomic contact map can be of different resolutions, and therefore, resolution 24 | of corresponding genomic track datasets should match during the visualization/analysis. 25 | Therefore, genomic dataset need to be downsampled or coarsened. However, 26 | there are several possible methods for downsampling that can be suitable for 27 | different purposes. Therefore, we have implemented six different methods as 28 | follows, 29 | 30 | * Arithmetic mean 31 | * Geometric mean 32 | * Harmonic mean 33 | * Median 34 | * Maximum 35 | * Minimum 36 | 37 | When a file is opened in the ``browser``, user receives a prompt for selection of 38 | downsampling method, and subsequently, the selected data is loaded into the 39 | ``browser``. 40 | 41 | Structure of genomic track (.h5) file 42 | ------------------------------------- 43 | 44 | Format: ``///<1D Numpy Array>`` 45 | 46 | :: 47 | 48 | HDF5 ──────────────────────────> title 49 | ├──────── chr1 50 | │ ├───── 1kb 51 | │ │ ├──────── amean ( Arithmetic mean) (type: 1D Array) 52 | │ │ ├──────── median ( Median value ) (type: 1D Array) 53 | │ │ ├──────── hmean ( Harmonic mean ) (type: 1D Array) 54 | │ │ ├──────── gmean ( Geometric mean ) (type: 1D Array) 55 | │ │ ├──────── min ( Minimum value ) (type: 1D Array) 56 | │ │ └──────── max ( Maximum value ) (type: 1D Array) 57 | │ │ 58 | │ ├──── 5kb 59 | │ │ ├──────── amean ( Arithmetic mean) (type: 1D Array) 60 | │ │ ├──────── median ( Median value ) (type: 1D Array) 61 | │ │ ├──────── hmean ( Harmonic mean ) (type: 1D Array) 62 | │ │ ├──────── gmean ( Geometric mean ) (type: 1D Array) 63 | │ │ ├──────── min ( Minimum value ) (type: 1D Array) 64 | │ │ └──────── max ( Maximum value ) (type: 1D Array) 65 | │ │ 66 | │ └──── ... 67 | │ 68 | ├──────── chr2 69 | │ ├───── 1kb 70 | │ │ ├──────── amean ( Arithmetic mean) (type: 1D Array) 71 | │ │ ├──────── median ( Median value ) (type: 1D Array) 72 | │ │ ├──────── hmean ( Harmonic mean ) (type: 1D Array) 73 | │ │ ├──────── gmean ( Geometric mean ) (type: 1D Array) 74 | │ │ ├──────── min ( Minimum value ) (type: 1D Array) 75 | │ │ └──────── max ( Maximum value ) (type: 1D Array) 76 | │ └──── .. 77 | : 78 | : 79 | : 80 | └───── ... 81 | 82 | 83 | 84 | Compression 85 | ----------- 86 | In h5 file, dataset is stored as an 1D array. Presently, two compression methods 87 | are allowed in the h5 file: 88 | 89 | * |lzf| 90 | * GZIP 91 | 92 | By default, |lzf| is used to compress arrays. This method is very fast, and allow 93 | the reading. 94 | 95 | .. Warning:: 96 | |lzf| method is only available through **Python h5py** module, and 97 | therefore, this file cannot be read by another programming language through 98 | standard library. 99 | 100 | For portability, use GZIP compression method, which is available in standard 101 | HDF5 library. 102 | 103 | 104 | Convert bigWig/wig/bed to genomic track h5 file 105 | ----------------------------------------------- 106 | To convert bigWig/wig/bed files to genomic track files a GUI application and 107 | several commands are available. 108 | 109 | .. toctree:: 110 | h5Converter : A GUI application to convert bigWig/wig/bed 111 | bigwig2h5 : convert bigWig to h5 112 | wig2h5 : convert wig to h5 113 | bed2h5 : convert bed to h5 114 | encode2H5 : download and convert ENCODE datasets to h5 115 | 116 | 117 | Convert using ``gcMapExplorer`` Python modules: 118 | * bigWig file: :class:`gcMapExplorer.lib.genomicsDataHandler.BigWigHandler` 119 | * wig file: :class:`gcMapExplorer.lib.genomicsDataHandler.WigHandler` 120 | * bed file: :class:`gcMapExplorer.lib.genomicsDataHandler.BEDHandler` 121 | * ENCODE datasets : :class:`gcMapExplorer.lib.genomicsDataHandler.EncodeDatasetsConverter` 122 | -------------------------------------------------------------------------------- /docs/apidoc/ccmap.rst: -------------------------------------------------------------------------------- 1 | .. |json link| raw:: html 2 | 3 | json module 4 | 5 | .. |numpy memmap| raw:: html 6 | 7 | Numpy memmap 8 | 9 | 10 | ccmap module 11 | ============ 12 | 13 | .. currentmodule:: gcMapExplorer.lib 14 | 15 | .. autosummary:: 16 | ccmap.CCMAP.copy 17 | ccmap.CCMAP.get_ticks 18 | ccmap.CCMAP.make_readable 19 | ccmap.CCMAP.make_unreadable 20 | ccmap.CCMAP.make_writable 21 | ccmap.CCMAP.make_editable 22 | ccmap.jsonify 23 | ccmap.dejsonify 24 | ccmap.save_ccmap 25 | ccmap.load_ccmap 26 | ccmap.export_cmap 27 | ccmap.checkCCMapObjectOrFile 28 | ccmap.downSampleCCMap 29 | ccmap.getOutputShapeFor2DMapDownsampling 30 | ccmap.downSample2DMap 31 | 32 | 33 | ccmap.CCMAP class 34 | ----------------- 35 | 36 | .. autoclass:: gcMapExplorer.lib.ccmap.CCMAP 37 | :members: make_writable, make_editable, make_readable, make_unreadable, get_ticks, copy 38 | 39 | 40 | 41 | ccmap module 42 | ------------ 43 | 44 | .. automodule:: gcMapExplorer.lib.ccmap 45 | :members: jsonify, dejsonify, save_ccmap, load_ccmap, export_cmap, checkCCMapObjectOrFile, downSampleCCMap, getOutputShapeFor2DMapDownsampling, downSample2DMap 46 | -------------------------------------------------------------------------------- /docs/apidoc/ccmapHelpers.rst: -------------------------------------------------------------------------------- 1 | .. |numpy memmap| raw:: html 2 | 3 | Numpy memmap 4 | 5 | 6 | 7 | 8 | ccmapHelpers module 9 | =================== 10 | 11 | .. currentmodule:: gcMapExplorer.lib 12 | 13 | .. autosummary:: 14 | ccmapHelpers.MemoryMappedArray 15 | ccmapHelpers.MemoryMappedArray.copy 16 | ccmapHelpers.MemoryMappedArray.copy_from 17 | ccmapHelpers.MemoryMappedArray.copy_to 18 | ccmapHelpers.get_nonzeros_index 19 | ccmapHelpers.remove_zeros 20 | 21 | 22 | gcMapExplorer.ccmapHelpers 23 | --------------------------- 24 | 25 | .. automodule:: gcMapExplorer.lib.ccmapHelpers 26 | :members: get_nonzeros_index, remove_zeros 27 | 28 | 29 | MemoryMappedArray class 30 | ----------------------- 31 | 32 | .. autoclass:: gcMapExplorer.lib.ccmapHelpers.MemoryMappedArray 33 | :members: copy, copy_from, copy_to 34 | 35 | 36 | KnightRuizNorm class 37 | ==================== 38 | 39 | .. autoclass:: gcMapExplorer.lib.normalizeKnightRuiz.KnightRuizNorm 40 | :members: run 41 | -------------------------------------------------------------------------------- /docs/apidoc/cmstats.rst: -------------------------------------------------------------------------------- 1 | 2 | cmstats module 3 | ============== 4 | 5 | .. currentmodule:: gcMapExplorer.lib 6 | 7 | .. autosummary:: 8 | cmstats.correlateCMaps 9 | cmstats.correlateGCMaps 10 | cmstats.getAvgContactByDistance 11 | 12 | .. automodule:: gcMapExplorer.lib.cmstats 13 | :members: correlateCMaps, correlateGCMaps, getAvgContactByDistance 14 | -------------------------------------------------------------------------------- /docs/apidoc/config.rst: -------------------------------------------------------------------------------- 1 | 2 | config module 3 | ============= 4 | 5 | It contains functions that handle configuration of gcMapExplorer. gcMapExplorer 6 | uses some default settings and options. This can be read and changed through 7 | these modules. 8 | 9 | Configuration file structure 10 | ---------------------------- 11 | 12 | :: 13 | 14 | Configuration 15 | ├─────────── Dirs 16 | │ └──────── WorkingDirectory 17 | │ 18 | └─────────── Programs 19 | ├──────── bigWigInfo 20 | └──────── bigWigToWig 21 | 22 | 23 | Examples 24 | -------- 25 | 26 | .. code-block:: python3 27 | 28 | import gcMapExplorer 29 | 30 | gcMapExplorer.config.cleanScratch() # Clean default scratch directory 31 | 32 | # Change scratch directory 33 | gcMapExplorer.config.updateConfig('Dirs', 'WorkingDirectory', 'Path/to/new/scratch/directory') 34 | 35 | # Set path to bigWigInfo program 36 | gcMapExplorer.config.updateConfig('Programs', 'bigWigInfo', 'Path/to/bigWigInfo') 37 | 38 | # Set path to bigWigToWig program 39 | gcMapExplorer.config.updateConfig('Programs', 'bigWigToWig', 'Path/to/bigWigToWig') 40 | 41 | # Print current configuration file content 42 | gcMapExplorer.config.printConfig() 43 | 44 | # Get configuration 45 | config = gcMapExplorer.config.getConfig() 46 | 47 | # Get scratch directory 48 | print(config['Dirs']['WorkingDirectory']) 49 | 50 | 51 | Summary 52 | ------- 53 | .. currentmodule:: gcMapExplorer.config 54 | 55 | .. autosummary:: 56 | updateConfig 57 | getConfig 58 | printConfig 59 | cleanScratch 60 | 61 | .. automodule:: gcMapExplorer.config 62 | :members: updateConfig, getConfig, printConfig, cleanScratch 63 | -------------------------------------------------------------------------------- /docs/apidoc/corrMatrix.rst: -------------------------------------------------------------------------------- 1 | 2 | corrMatrix module 3 | ================= 4 | 5 | .. currentmodule:: gcMapExplorer.lib 6 | 7 | .. autosummary:: 8 | corrMatrix.calculateCorrMatrix 9 | corrMatrix.calculateCovMatrix 10 | corrMatrix.calculateCorrelation 11 | corrMatrix.calculateCovariance 12 | corrMatrix.calculateCorrMatrixForCCMap 13 | corrMatrix.calculateCorrMatrixForGCMaps 14 | 15 | .. automodule:: gcMapExplorer.lib.corrMatrix 16 | :members: calculateCorrMatrix, calculateCovMatrix, calculateCorrelation, calculateCovariance, calculateCorrMatrixForCCMap, calculateCorrMatrixForGCMaps 17 | -------------------------------------------------------------------------------- /docs/apidoc/gcmap.rst: -------------------------------------------------------------------------------- 1 | 2 | .. currentmodule:: gcMapExplorer.lib 3 | 4 | gcmap module 5 | ============ 6 | 7 | .. autosummary:: 8 | gcmap.GCMAP 9 | gcmap.GCMAP.checkMapExist 10 | gcmap.GCMAP.changeMap 11 | gcmap.GCMAP.changeResolution 12 | gcmap.GCMAP.toFinerResolution 13 | gcmap.GCMAP.toCoarserResolution 14 | gcmap.GCMAP.loadSmallestMap 15 | gcmap.GCMAP.genMapNameList 16 | gcmap.GCMAP.performDownSampling 17 | gcmap.GCMAP.downsampleMapToResolution 18 | gcmap.GCMAP.downsampleAllMapToResolution 19 | gcmap.loadGCMapAsCCMap 20 | gcmap.addCCMap2GCMap 21 | gcmap.changeGCMapCompression 22 | 23 | 24 | GCMAP class 25 | ----------- 26 | 27 | 28 | .. autoclass:: gcMapExplorer.lib.gcmap.GCMAP 29 | :members: 30 | 31 | 32 | 33 | gcMapExplorer.gcmap 34 | ------------------- 35 | 36 | .. automodule:: gcMapExplorer.lib.gcmap 37 | :members: loadGCMapAsCCMap, addCCMap2GCMap, changeGCMapCompression 38 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/EncodeDatasetsConverter.rst: -------------------------------------------------------------------------------- 1 | ``class EncodeDatasetsConverter`` 2 | --------------------------------- 3 | 4 | 5 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 6 | 7 | .. autosummary:: 8 | EncodeDatasetsConverter 9 | EncodeDatasetsConverter.saveAsH5 10 | 11 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.EncodeDatasetsConverter 12 | :members: 13 | :private-members: 14 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/bedhandler.rst: -------------------------------------------------------------------------------- 1 | 2 | ``class BEDHandler`` 3 | --------------------- 4 | 5 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 6 | 7 | .. autosummary:: 8 | BEDHandler 9 | BEDHandler.parseBed 10 | BEDHandler.setChromosome 11 | BEDHandler.saveAsH5 12 | 13 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.BEDHandler 14 | :members: 15 | :private-members: 16 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/bigwighandler.rst: -------------------------------------------------------------------------------- 1 | 2 | ``class BigWigHandler`` 3 | ----------------------- 4 | 5 | 6 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 7 | 8 | .. autosummary:: 9 | BigWigHandler 10 | BigWigHandler.getBigWigInfo 11 | BigWigHandler.bigWigtoWig 12 | BigWigHandler.saveAsH5 13 | 14 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.BigWigHandler 15 | :members: 16 | :private-members: 17 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/hdf5handler.rst: -------------------------------------------------------------------------------- 1 | 2 | ``class HDF5Handler`` 3 | --------------------- 4 | 5 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 6 | 7 | .. autosummary:: 8 | HDF5Handler 9 | HDF5Handler.setTitle 10 | HDF5Handler.getChromList 11 | HDF5Handler.getResolutionList 12 | HDF5Handler.getDataNameList 13 | HDF5Handler.hasChromosome 14 | HDF5Handler.hasResolution 15 | HDF5Handler.hasDataName 16 | HDF5Handler.buildDataTree 17 | HDF5Handler.addDataByArray 18 | 19 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.HDF5Handler 20 | :members: 21 | :private-members: 22 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/index.rst: -------------------------------------------------------------------------------- 1 | genomicsDataHandler module 2 | ========================== 3 | 4 | This module is developed to visualize and analyze Genomics data with respect 5 | to Hi-C maps. This module contains method to convert bigWig and Wig file to 6 | hdf5 file. 7 | 8 | The hdf5 file gives us flexibility to access the data for given range of 9 | location of a specific chromosome at particular resolution. 10 | 11 | 12 | List of class 13 | ------------- 14 | 15 | .. toctree:: 16 | :maxdepth: 2 17 | 18 | HDF5Handler 19 | BigWigHandler 20 | WigHandler 21 | BEDHandler 22 | EncodeDatasetsConverter 23 | TextFileHandler 24 | TempNumpyArrayFiles 25 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/tempnumpyarrayfiles.rst: -------------------------------------------------------------------------------- 1 | 2 | ``class TempNumpyArrayFiles`` 3 | ----------------------------- 4 | 5 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 6 | 7 | .. autosummary:: 8 | TempNumpyArrayFiles 9 | TempNumpyArrayFiles.updateArraysByBigWig 10 | TempNumpyArrayFiles.updateArraysByChromSize 11 | TempNumpyArrayFiles.addChromSizeInfo 12 | TempNumpyArrayFiles.generateAllTempNumpyFiles 13 | TempNumpyArrayFiles.generateTempNumpyFile 14 | TempNumpyArrayFiles.fillAllArraysWithZeros 15 | 16 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.TempNumpyArrayFiles 17 | :members: 18 | :private-members: 19 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/textHandler.rst: -------------------------------------------------------------------------------- 1 | ``class TextFileHandler`` 2 | ------------------------- 3 | 4 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 5 | 6 | .. autosummary:: 7 | TextFileHandler 8 | TextFileHandler.readData 9 | 10 | 11 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.TextFileHandler 12 | :members: 13 | :private-members: 14 | -------------------------------------------------------------------------------- /docs/apidoc/genomicsDataHandler/wighandler.rst: -------------------------------------------------------------------------------- 1 | ``class WigHandler`` 2 | -------------------- 3 | 4 | .. currentmodule:: gcMapExplorer.lib.genomicsDataHandler 5 | 6 | .. autosummary:: 7 | WigHandler 8 | WigHandler.parseWig 9 | WigHandler.setChromosome 10 | WigHandler.saveAsH5 11 | WigHandler.getRawWigDataAsDictionary 12 | 13 | 14 | .. autoclass:: gcMapExplorer.lib.genomicsDataHandler.WigHandler 15 | :members: 16 | :private-members: 17 | -------------------------------------------------------------------------------- /docs/apidoc/importer.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | importer module 4 | =============== 5 | 6 | .. currentmodule:: gcMapExplorer.lib 7 | 8 | .. autosummary:: 9 | importer.CooMatrixHandler 10 | importer.CooMatrixHandler.save_ccmaps 11 | importer.CooMatrixHandler.save_gcmap 12 | importer.CooMatrixHandler.setLabels 13 | importer.CooMatrixHandler.setOutputFileList 14 | importer.PairCooMatrixHandler 15 | importer.PairCooMatrixHandler.setGCMapOptions 16 | importer.PairCooMatrixHandler.runConversion 17 | importer.HomerInputHandler 18 | importer.HomerInputHandler.save_ccmaps 19 | importer.HomerInputHandler.save_gcmap 20 | importer.BinsNContactFilesHandler 21 | importer.BinsNContactFilesHandler.save_ccmaps 22 | importer.BinsNContactFilesHandler.save_gcmap 23 | importer.gen_map_from_locations_value 24 | 25 | 26 | 27 | CooMatrixHandler class 28 | ---------------------- 29 | .. autoclass:: gcMapExplorer.lib.importer.CooMatrixHandler 30 | :members: save_ccmaps, save_gcmap, setLabels, setOutputFileList 31 | 32 | PairCooMatrixHandler class 33 | -------------------------- 34 | .. autoclass:: gcMapExplorer.lib.importer.PairCooMatrixHandler 35 | :members: setGCMapOptions, runConversion 36 | 37 | HomerInputHandler class 38 | ----------------------- 39 | .. autoclass:: gcMapExplorer.lib.importer.HomerInputHandler 40 | :members: save_ccmaps, save_gcmap 41 | 42 | BinsNContactFilesHandler class 43 | ------------------------------ 44 | .. autoclass:: gcMapExplorer.lib.importer.BinsNContactFilesHandler 45 | :members: save_ccmaps, save_gcmap 46 | 47 | Other functions of importer module 48 | ---------------------------------- 49 | .. automodule:: gcMapExplorer.lib.importer 50 | :members: gen_map_from_locations_value 51 | -------------------------------------------------------------------------------- /docs/apidoc/index.rst: -------------------------------------------------------------------------------- 1 | Documentation of Python Modules 2 | ------------------------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | ccmap module 8 | ccmapHelpers module 9 | util module 10 | gcmap module 11 | importer module 12 | normalizer module 13 | cmstats module 14 | statDist module 15 | corrMatrix module 16 | genomicsDataHandler module 17 | config module 18 | -------------------------------------------------------------------------------- /docs/apidoc/normalizer.rst: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | normalizer module 5 | ================= 6 | 7 | .. currentmodule:: gcMapExplorer.lib 8 | 9 | .. autosummary:: 10 | normalizer.NormalizeKnightRuizOriginal 11 | normalizer.normalizeCCMapByKR 12 | normalizer.normalizeGCMapByKR 13 | normalizer.normalizeCCMapByIC 14 | normalizer.normalizeGCMapByIC 15 | normalizer.normalizeCCMapByMCFS 16 | normalizer.normalizeGCMapByMCFS 17 | normalizer.normalizeCCMapByVCNorm 18 | normalizer.normalizeGCMapByVCNorm 19 | 20 | 21 | .. automodule:: gcMapExplorer.lib.normalizer 22 | :members: 23 | -------------------------------------------------------------------------------- /docs/apidoc/statDist.rst: -------------------------------------------------------------------------------- 1 | 2 | .. |markov chain link| raw:: html 3 | 4 | Markov-chain example 5 | 6 | 7 | statDist module 8 | =============== 9 | 10 | This module contains functions and methods for calculating stationary 11 | distribution by assuming markov-chain. 12 | 13 | This module contains functions to calculate probability transition matrix and 14 | subsequently to calculate stationary distribution. 15 | 16 | Example 17 | ------- 18 | Below is a simple example to calculate stationary distribution. 19 | It consists of three major steps: 20 | 21 | * Calculate median-subtracted normalized matrix 22 | * Calculate probability transition matrix 23 | * Calculate stationary distribution 24 | 25 | 26 | .. code-block:: python 27 | 28 | # median-subtracted normalized matrix, stype should be 'o-e', Other arguments can be changed. 29 | gmlib.normalizer.normalizeGCMapByMCFS('input_raw.gcmap', 'mcfs_O-E.gcmap', stats='median', stype='o-e') 30 | 31 | # Probability transition matrix, calculate matrix at '40kb' resolution. 32 | gmlib.statDist.transitionProbabilityMatrixForGCMap('mcfs_O-E.gcmap', 'prob_mat.gcmap', '40kb') 33 | 34 | # Stationary distribution at '40kb' resolution 35 | gmlib.statDist.statDistrByEigenDecompForGCMap('out_prob_mat.gcmap', 'stat_dist.h5', '40kb') 36 | 37 | 38 | 39 | Summary 40 | ------- 41 | 42 | .. currentmodule:: gcMapExplorer.lib 43 | 44 | .. autosummary:: 45 | statDist.calculateTransitionProbabilityMatrix 46 | statDist.transitionProbabilityMatrixForCCMap 47 | statDist.transitionProbabilityMatrixForGCMap 48 | statDist.statDistrByEigenDecompForCCMap 49 | statDist.statDistrByEigenDecompForGCMap 50 | statDist.stationaryDistributionByEigenDecomp 51 | 52 | 53 | Documentation 54 | ------------- 55 | 56 | .. automodule:: gcMapExplorer.lib.statDist 57 | :members: 58 | -------------------------------------------------------------------------------- /docs/apidoc/summary.rst: -------------------------------------------------------------------------------- 1 | .. |json link| raw:: html 2 | 3 | json module 4 | 5 | 6 | 7 | .. |markov chain link| raw:: html 8 | 9 | Markov-chain example 10 | 11 | 12 | 13 | 14 | Summary of Python Modules 15 | ------------------------- 16 | 17 | .. currentmodule:: gcMapExplorer.config 18 | 19 | config module 20 | ~~~~~~~~~~~~~ 21 | .. autosummary:: 22 | updateConfig 23 | getConfig 24 | printConfig 25 | cleanScratch 26 | 27 | .. currentmodule:: gcMapExplorer.lib 28 | 29 | ccmap module 30 | ~~~~~~~~~~~~ 31 | .. autosummary:: 32 | ccmap.CCMAP.copy 33 | ccmap.CCMAP.get_ticks 34 | ccmap.CCMAP.make_readable 35 | ccmap.CCMAP.make_unreadable 36 | ccmap.CCMAP.make_writable 37 | ccmap.CCMAP.make_editable 38 | ccmap.jsonify 39 | ccmap.dejsonify 40 | ccmap.save_ccmap 41 | ccmap.load_ccmap 42 | ccmap.export_cmap 43 | ccmap.checkCCMapObjectOrFile 44 | ccmap.downSampleCCMap 45 | ccmap.getOutputShapeFor2DMapDownsampling 46 | ccmap.downSample2DMap 47 | 48 | 49 | ccmapHelpers module 50 | ~~~~~~~~~~~~~~~~~~~~ 51 | .. autosummary:: 52 | ccmapHelpers.MemoryMappedArray 53 | ccmapHelpers.MemoryMappedArray.copy 54 | ccmapHelpers.MemoryMappedArray.copy_from 55 | ccmapHelpers.MemoryMappedArray.copy_to 56 | ccmapHelpers.get_nonzeros_index 57 | ccmapHelpers.remove_zeros 58 | 59 | 60 | util module 61 | ~~~~~~~~~~~ 62 | .. autosummary:: 63 | util.resolutionToBinsize 64 | util.binsizeToResolution 65 | util.sorted_nicely 66 | util.locate_significant_digit_after_decimal 67 | util.kth_diag_indices 68 | util.detectOutliers1D 69 | util.getRandomName 70 | util.MapNotFoundError 71 | util.ResolutionNotFoundError 72 | 73 | 74 | gcmap module 75 | ~~~~~~~~~~~~ 76 | .. autosummary:: 77 | gcmap.GCMAP 78 | gcmap.GCMAP.checkMapExist 79 | gcmap.GCMAP.changeMap 80 | gcmap.GCMAP.changeResolution 81 | gcmap.GCMAP.toFinerResolution 82 | gcmap.GCMAP.toCoarserResolution 83 | gcmap.GCMAP.loadSmallestMap 84 | gcmap.GCMAP.genMapNameList 85 | gcmap.GCMAP.performDownSampling 86 | gcmap.GCMAP.downsampleMapToResolution 87 | gcmap.GCMAP.downsampleAllMapToResolution 88 | gcmap.loadGCMapAsCCMap 89 | gcmap.addCCMap2GCMap 90 | gcmap.changeGCMapCompression 91 | 92 | 93 | importer module 94 | ~~~~~~~~~~~~~~~ 95 | .. autosummary:: 96 | importer.CooMatrixHandler 97 | importer.CooMatrixHandler.save_ccmaps 98 | importer.CooMatrixHandler.save_gcmap 99 | importer.CooMatrixHandler.setLabels 100 | importer.CooMatrixHandler.setOutputFileList 101 | importer.PairCooMatrixHandler 102 | importer.PairCooMatrixHandler.setGCMapOptions 103 | importer.PairCooMatrixHandler.runConversion 104 | importer.HomerInputHandler 105 | importer.HomerInputHandler.save_ccmaps 106 | importer.HomerInputHandler.save_gcmap 107 | importer.BinsNContactFilesHandler 108 | importer.BinsNContactFilesHandler.save_ccmaps 109 | importer.BinsNContactFilesHandler.save_gcmap 110 | importer.gen_map_from_locations_value 111 | 112 | 113 | normalizer module 114 | ~~~~~~~~~~~~~~~~~ 115 | .. autosummary:: 116 | normalizer.NormalizeKnightRuizOriginal 117 | normalizer.normalizeCCMapByKR 118 | normalizer.normalizeGCMapByKR 119 | normalizer.normalizeCCMapByIC 120 | normalizer.normalizeGCMapByIC 121 | normalizer.normalizeCCMapByMCFS 122 | normalizer.normalizeGCMapByMCFS 123 | normalizer.normalizeCCMapByVCNorm 124 | normalizer.normalizeGCMapByVCNorm 125 | 126 | 127 | cmstats module 128 | ~~~~~~~~~~~~~~~~~ 129 | .. autosummary:: 130 | cmstats.correlateCMaps 131 | cmstats.correlateGCMaps 132 | cmstats.getAvgContactByDistance 133 | 134 | 135 | corrMatrix module 136 | ~~~~~~~~~~~~~~~~~ 137 | .. autosummary:: 138 | corrMatrix.calculateCorrMatrix 139 | corrMatrix.calculateCovMatrix 140 | corrMatrix.calculateCorrelation 141 | corrMatrix.calculateCovariance 142 | corrMatrix.calculateCorrMatrixForCCMap 143 | corrMatrix.calculateCorrMatrixForGCMaps 144 | 145 | 146 | statDist module 147 | ~~~~~~~~~~~~~~~ 148 | .. autosummary:: 149 | statDist.calculateTransitionProbabilityMatrix 150 | statDist.transitionProbabilityMatrixForCCMap 151 | statDist.transitionProbabilityMatrixForGCMap 152 | statDist.statDistrByEigenDecompForCCMap 153 | statDist.statDistrByEigenDecompForGCMap 154 | statDist.stationaryDistributionByEigenDecomp 155 | 156 | 157 | genomicsDataHandler module 158 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 | 160 | .. autosummary:: 161 | genomicsDataHandler.HDF5Handler 162 | genomicsDataHandler.HDF5Handler.setTitle 163 | genomicsDataHandler.HDF5Handler.getChromList 164 | genomicsDataHandler.HDF5Handler.getResolutionList 165 | genomicsDataHandler.HDF5Handler.getDataNameList 166 | genomicsDataHandler.HDF5Handler.buildDataTree 167 | genomicsDataHandler.BigWigHandler 168 | genomicsDataHandler.BigWigHandler.getBigWigInfo 169 | genomicsDataHandler.BigWigHandler.bigWigtoWig 170 | genomicsDataHandler.BigWigHandler.saveAsH5 171 | genomicsDataHandler.WigHandler 172 | genomicsDataHandler.WigHandler.parseWig 173 | genomicsDataHandler.WigHandler.setChromosome 174 | genomicsDataHandler.WigHandler.saveAsH5 175 | genomicsDataHandler.WigHandler.getRawWigDataAsDictionary 176 | genomicsDataHandler.BEDHandler 177 | genomicsDataHandler.BEDHandler.parseBed 178 | genomicsDataHandler.BEDHandler.setChromosome 179 | genomicsDataHandler.BEDHandler.saveAsH5 180 | genomicsDataHandler.EncodeDatasetsConverter 181 | genomicsDataHandler.EncodeDatasetsConverter.saveAsH5 182 | genomicsDataHandler.TextFileHandler 183 | genomicsDataHandler.TextFileHandler.readData 184 | genomicsDataHandler.TempNumpyArrayFiles 185 | genomicsDataHandler.TempNumpyArrayFiles.updateArraysByBigWig 186 | genomicsDataHandler.TempNumpyArrayFiles.updateArraysByChromSize 187 | genomicsDataHandler.TempNumpyArrayFiles.addChromSizeInfo 188 | genomicsDataHandler.TempNumpyArrayFiles.generateAllTempNumpyFiles 189 | genomicsDataHandler.TempNumpyArrayFiles.generateTempNumpyFile 190 | genomicsDataHandler.TempNumpyArrayFiles.fillAllArraysWithZeros 191 | -------------------------------------------------------------------------------- /docs/apidoc/util.rst: -------------------------------------------------------------------------------- 1 | util module 2 | =========== 3 | 4 | This module contains some small and useful utility functions and classes. 5 | 6 | .. currentmodule:: gcMapExplorer.lib 7 | 8 | 9 | .. autosummary:: 10 | util.resolutionToBinsize 11 | util.binsizeToResolution 12 | util.sorted_nicely 13 | util.locate_significant_digit_after_decimal 14 | util.kth_diag_indices 15 | util.detectOutliers1D 16 | util.getRandomName 17 | util.MapNotFoundError 18 | util.ResolutionNotFoundError 19 | 20 | 21 | Exception classes 22 | ----------------- 23 | 24 | .. autoclass:: gcMapExplorer.lib.util.MapNotFoundError 25 | :members: 26 | 27 | 28 | .. autoclass:: gcMapExplorer.lib.util.ResolutionNotFoundError 29 | :members: 30 | 31 | 32 | Small utility functions 33 | ----------------------- 34 | 35 | .. automodule:: gcMapExplorer.lib.util 36 | :members: 37 | -------------------------------------------------------------------------------- /docs/cmapNormalization.rst: -------------------------------------------------------------------------------- 1 | Normalization of Hi-C maps 2 | -------------------------- 3 | 4 | To normalize the Hi-C maps, several methods are implemented. 5 | 6 | * **Iterative Correction** (IC) [1]_ 7 | This method normalize the raw contact map by removing biases from 8 | experimental procedure. This is an method of matrix balancing, however, in the 9 | normalized, sum of rows and columns are **not** equal to one. 10 | * **Knight-Ruiz Matrix Balancing** (KR) [2]_ 11 | The Knight-Ruiz (KR) matrix balancing is a fast algorithm to normalize a 12 | symmetric matrix. A doubly stochastic matrix is obtained after this 13 | normalization. In this matrix, sum of rows and columns are equal to one. 14 | * **Vanilla-Coverage** (VC) [3]_ 15 | This method was first used for inter-chromosomal map. Later it was used for 16 | intra-chromosomal map by `Rao et al., 2014 `_. 17 | This is a simple method where at first each element is divided by sum of 18 | respective row and subsequently divided by sum of respective column. 19 | * **Median Contact Frequency Scaling** (MCFS) 20 | This method can be used to normalize contact map using Median contact values 21 | for particular distance between two locations/coordinates. At first, Median 22 | distance contact frequency for each distance is calculated. Subsequently, 23 | the observed contact frequency is divided by median contact frequency obtained 24 | for distance between the two locations. 25 | 26 | **To perform these normalizations, following tools are implemented:** 27 | 28 | .. toctree:: 29 | cmapNormalizer : A GUI application for normalization 30 | normKR : Normalization by Knight-Ruiz matrix balancing 31 | normVC : Normalization by Vanilla-Coverage 32 | normIC : Normalization by Iterative Correction 33 | normMCFS : Scale maps using Median/Mean Contact Frequency 34 | 35 | 36 | References 37 | ~~~~~~~~~~ 38 | 39 | .. [1] Imakaev *et al*. Iterative correction of Hi-C data reveals hallmarks of 40 | chromosome organization. `Nature Methods 9, 999–1003 (2012). `_ 41 | 42 | .. [2] Knight P and D. Ruiz. A fast algorithm for matrix balancing. 43 | `IMA J Numer Anal (2013) 33 (3): 1029-1047. `_ 44 | 45 | .. [3] Lieberman-Aiden *et al*. Comprehensive mapping of long-range interactions reveals 46 | folding principles of the human genome. 47 | `Science (2009) 326 : 289-293. `_ 48 | -------------------------------------------------------------------------------- /docs/commands/bc2cmap.rst: -------------------------------------------------------------------------------- 1 | bc2cmap -Bin-Contact files pair to ccmap or gcmap 2 | ------------------------------------------------- 3 | 4 | In this format, two separate files are available. One file contains bins 5 | information and other contains contact frequency. 6 | 7 | These types of files are present in following GEO data: 8 | * http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE61471 9 | * http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE34453 10 | 11 | This format contains a pair of file: 12 | BIN file: 13 | :: 14 | 15 | cbin chr from.coord to.coord count 16 | 1 2L 0 160000 747 17 | 2 2L 160000 320000 893 18 | 3 2L 320000 480000 1056 19 | 4 2L 480000 640000 1060 20 | 5 2L 640000 800000 978 21 | 6 2L 800000 960000 926 22 | . 23 | . 24 | . 25 | 26 | 27 | 28 | CONTACT file in list format: 29 | :: 30 | 31 | cbin1 cbin2 expected_count observed_count 32 | 1 1 40.245201 21339 33 | 1 2 83.747499 5661 34 | 1 3 92.12501 1546 35 | 1 4 93.401273 864 36 | 1 5 87.265472 442 37 | . 38 | . 39 | . 40 | 41 | 42 | 43 | Both BIN and CONTACT files are **necessary** for the conversion. 44 | 45 | 46 | Usage: 47 | .. code-block:: bash 48 | 49 | usage: gcMapExplorer bc2cmap [-h] [-ib nm_none_160000.bins] 50 | [-ic nm_none_160000.n_contact] [-ccm RawObserved] 51 | [-od OUTDIR] [-gcm inOut.gcmap] [-cmeth lzf] 52 | [-dmeth sum] 53 | [-wd /home/rajendra/deskForWork/scratch] 54 | 55 | 56 | 57 | **Optional arguments:** 58 | 59 | .. code-block:: bash 60 | 61 | -h, --help show this hel 62 | p message and exit 63 | -ib nm_none_160000.bins, --input-bin nm_none_160000.bins 64 | Input BIN file as shown above. 65 | 66 | -ic nm_none_160000.n_contact, --input-contact nm_none_160000.n_contact 67 | Input CONTACT file as shown above. 68 | 69 | -ccm RawObserved, --ccmap RawObserved 70 | Use this to convert all contact maps to ccmaps file. Provide suffix of 71 | ccmap file names with this option and it will enable the conversion. 72 | 73 | Output ccmap file name is generated automatically as follows; 74 | __.ccmap 75 | 76 | Note that -od/--out-dir option is also required because all ccmaps will be 77 | saved in this directory. 78 | 79 | -od OUTDIR, --out-dir OUTDIR 80 | Directory where all ccmap files will be saved. 81 | -gcm inOut.gcmap, --gcmap inOut.gcmap 82 | Provide gcmap file to convert all contact maps into one gcmap file. 83 | File name should contain full path because -od/--out-dir is not considered 84 | for thi conversion. 85 | 86 | -cmeth lzf, --compression-method lzf 87 | Data compression method for gcmap file. 88 | -dmeth sum, --downsample-method sum 89 | Downsampling method to coarsen the resolution in gcmap file. The option is 90 | intended to use with -gcm/--gcmap option. Three accepted methods are 91 | sum : sum of values, 92 | mean : Average of values and 93 | max : Maximum of values. 94 | 95 | This option generates all coarser maps where resolutions will be coarsened by 96 | a factor of two, consecutively. e.g.: In case of 10 kb input resolution, 97 | downsampled maps of "20kb", "40kb", "80kb", "160kb", "320kb" etc. will be 98 | generated until, map size is less than 500. 99 | 100 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 101 | Directory where temporary files will be stored. 102 | 103 | 104 | -------------------------------------------------------------------------------- /docs/commands/bed2h5.rst: -------------------------------------------------------------------------------- 1 | bed2h5 2 | ~~~~~~ 3 | 4 | **Description:** 5 | 6 | .. code-block:: bash 7 | 8 | Import a bed file to HDF5 format h5 file 9 | ============================================ 10 | 11 | bed file can be converted into gcMapExplorer compatible HDF5 file using 12 | this tool. This HDF5 file can be loaded into gcMapExplorer browser for 13 | interactive visualization. 14 | 15 | This tool does not require any external program. 16 | 17 | Resolutions 18 | =========== 19 | By default, original data are downsampled to following resolutions: '1kb', 20 | '2kb', '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb', 21 | '200kb', '320kb', '500kb', '640kb', and '1mb'. 22 | 23 | The data are downsampled at this stage only to speed up the visualization 24 | process as downsampling might slow down the interactive visualization. 25 | 26 | Downsampling/Coarsening method 27 | ============================== 28 | Presently, six methods are implemented: 29 | 1) min -> Minimum value 30 | 2) max -> Maximum value 31 | 3) amean -> Arithmetic mean or average 32 | 4) hmean -> Harmonic mean 33 | 5) gmean -> Geometric mean 34 | 6) median -> Median 35 | 36 | All these methods are used by default. 37 | See below help for "-dm/--downsample-method" option to change the methods. 38 | 39 | To keep original 1 base resolution data 40 | ======================================= 41 | By default, the output h5 file does not contain original 1-base resolution 42 | data to reduce the file size. To keep the original data in h5 file, used 43 | -ko/--keep-original flag. 44 | 45 | 46 | **Usage:** 47 | 48 | .. code-block:: bash 49 | 50 | usage: gcMapExplorer bed2h5 [-h] [-i input.bed] [-t "Genomic Dataset"] 51 | [-dtc 7] [-r "List of Resolutions"] 52 | [-dm "List of downsampling method"] 53 | [-icn CHROMNAME] [-cmeth lzf] [-o out.h5] [-ow] 54 | [-ko] [-idf index.json] 55 | [-wd /home/rajendra/deskForWork/scratch] 56 | 57 | 58 | **Optional arguments:** 59 | 60 | .. code-block:: bash 61 | 62 | -h, --help show this help message and exit 63 | -i input.bed, --input input.bed 64 | Input wig file. 65 | 66 | -t "Genomic Dataset", --title "Genomic Dataset" 67 | Title of the dataset. 68 | -dtc 7, --data-column 7 69 | The column number, which is considered as data column. Column number 70 | could vary and depends on BED format. For example: 71 | 1) ENCODE broadPeak format (BED 6+3): 7th column 72 | 2) ENCODE gappedPeak format (BED 12+3): 13th column 73 | 3) ENCODE narrowPeak format (BED 6+4): 7th column 74 | 4) ENCODE RNA elements format (BED 6+3): 7th column 75 | 76 | -r "List of Resolutions", --resolutions "List of Resolutions" 77 | Additional input resolutions other than these resolutions: 1kb', '2kb', 78 | '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb','200kb', 79 | '320kb', '500kb', '640kb', and '1mb'. 80 | 81 | Resolutions should be provided in comma separated values. For Example: 82 | -r "25kb, 50kb, 75kb" 83 | 84 | -dm "List of downsampling method", --downsample-method "List of downsampling method" 85 | Methods to coarse or downsample the data for converting from 1-base 86 | to coarser resolutions. If this option is not provided, all six methods (see 87 | above) will be considered. User may use only subset of these methods. 88 | For example: -dm "max, amean" can be used for downsampling by only these 89 | two methods. 90 | 91 | -icn CHROMNAME, --input-chromosome CHROMNAME 92 | Input Chromosome Name. 93 | If this is provided, only this chromosome data is extracted and stored in h5 94 | file. 95 | 96 | -cmeth lzf, --compression-method lzf 97 | Data compression method in h5 file. 98 | -o out.h5, --out out.h5 99 | Output h5 file. 100 | 101 | If file is already present, it will replace the data. Therefore, be careful 102 | if a file with same name is present. 103 | 104 | -ow, --overwrite If a output file is already present, overwrite the datasets in the output 105 | file. 106 | 107 | -ko, --keep-original To copy original 1-base resolution data in h5 file. This will increase the 108 | file size significantly. 109 | 110 | -idf index.json, --index-file index.json 111 | Index file in json format. 112 | A file in json format containing indices (position in bed file) and sizes of 113 | chromosomes. If this file is not present and given as input, a new file will be 114 | generated. If this file is present, indices and sizes will be taken from this 115 | file. If index and size of input chromosome is not present in json file, these 116 | will be determined from bed file and stored in same json file. This file could 117 | be very helpful in case when same bed file has to be read many times because 118 | step to determine index and size of chromosome is skipped. 119 | 120 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 121 | Directory where temporary files will be stored. 122 | -------------------------------------------------------------------------------- /docs/commands/bigWig2h5.rst: -------------------------------------------------------------------------------- 1 | 2 | bigwig2h5 3 | ~~~~~~~~~ 4 | 5 | **Description:** 6 | 7 | .. code-block:: bash 8 | 9 | Import a bigWig file to HDF5 format h5 file 10 | ============================================ 11 | 12 | bigWig file can be converted into gcMapExplorer compatible HDF5 file using 13 | this tool. This HDF5 file can be loaded into gcMapExplorer browser for 14 | interactive visualization. 15 | 16 | Requirements 17 | ============ 18 | 1) bigWigToWig : It converts binary bigWig file to ascii Wig file. 19 | 2) bigWigInfo : It fetches the information about chromosomes from bigWig file. 20 | 21 | Both tools can be downloaded from http://hgdownload.cse.ucsc.edu/admin/exe/ 22 | for linux and Mac platform. However, these tools are not yet available for 23 | Windows OS. 24 | 25 | Path to these tools can be set using gcMapExplorer configure utility or can be 26 | given with the command. 27 | 28 | Resolutions 29 | =========== 30 | By default, original data are downsampled to following resolutions: '1kb', 31 | '2kb', '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb', 32 | '200kb', '320kb', '500kb', '640kb', and '1mb'. 33 | 34 | The data are downsampled at this stage only to speed up the visualization 35 | process as downsampling might slow down the interactive visualization. 36 | 37 | Downsampling/Coarsening method 38 | ============================== 39 | Presently, six methods are implemented: 40 | 1) min -> Minimum value 41 | 2) max -> Maximum value 42 | 3) amean -> Arithmetic mean or average 43 | 4) hmean -> Harmonic mean 44 | 5) gmean -> Geometric mean 45 | 6) median -> Median 46 | 47 | All these methods are used by default. 48 | See below help for "-dm/--downsample-method" option to change the methods. 49 | 50 | To keep original 1 base resolution data 51 | ======================================= 52 | By default, the output h5 file does not contain original 1-base resolution 53 | data to reduce the file size. To keep the original data in h5 file, used 54 | -ko/--keep-original flag. 55 | 56 | 57 | **Usage:** 58 | 59 | .. code-block:: bash 60 | 61 | usage: gcMapExplorer bigwig2h5 [-h] [-i input.bigWig] [-t "Genomic Dataset"] 62 | [-b2w bigWigToWig] [-binfo bigWigInfo] 63 | [-r "List of Resolutions"] [-icn CHROMNAME] 64 | [-dm "List of downsampling method"] 65 | [-cmeth lzf] [-o out.h5] [-ow] [-ko] 66 | [-wd /home/rajendra/deskForWork/scratch] 67 | 68 | 69 | 70 | **Optional arguments:** 71 | 72 | .. code-block:: bash 73 | 74 | -h, --help show this help message and exit 75 | -i input.bigWig, --input input.bigWig 76 | Input bigWig file. 77 | 78 | -t "Genomic Dataset", --title "Genomic Dataset" 79 | Title of the dataset. 80 | -b2w bigWigToWig, --bigWigToWig bigWigToWig 81 | Path to bigWigToWig tool. 82 | 83 | This is not necessary when bigWigToWig path is already set using gcMapExplorer 84 | configure utility. 85 | 86 | It can be downloaded from http://hgdownload.cse.ucsc.edu/admin/exe/ 87 | for linux and Mac platform. 88 | 89 | -binfo bigWigInfo, --bigWigInfo bigWigInfo 90 | Path to bigWigInfo tool. 91 | 92 | This is not necessary when bigWigInfo path is already set using gcMapExplorer 93 | configure utility. 94 | 95 | It can be downloaded from http://hgdownload.cse.ucsc.edu/admin/exe/ 96 | for linux and Mac platform. 97 | 98 | -r "List of Resolutions", --resolutions "List of Resolutions" 99 | Additional input resolutions other than these resolutions: 1kb', '2kb', 100 | '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb','200kb', 101 | '320kb', '500kb', '640kb', and '1mb'. 102 | 103 | Resolutions should be provided in comma separated values. For Example: 104 | -r "25kb, 50kb, 75kb" 105 | 106 | -icn CHROMNAME, --input-chromosome CHROMNAME 107 | Input Chromosome Name. 108 | If this is provided, only this chromosome data is extracted and stored in h5 109 | file. 110 | 111 | -dm "List of downsampling method", --downsample-method "List of downsampling method" 112 | Methods to coarse or downsample the data for converting from 1-base 113 | to coarser resolutions. If this option is not provided, all six methods (see 114 | above) will be considered. User may use only subset of these methods. 115 | For example: -dm "max, amean" can be used for downsampling by only these 116 | two methods. 117 | 118 | -cmeth lzf, --compression-method lzf 119 | Data compression method in h5 file. 120 | -o out.h5, --out out.h5 121 | Output h5 file. 122 | 123 | If file is already present, it will replace the data. Therefore, be careful 124 | if a file with same name is present. 125 | 126 | -ow, --overwrite If a output file is already present, overwrite the datasets in the output 127 | file. 128 | 129 | -ko, --keep-original To copy original 1-base resolution data in h5 file. This will increase the 130 | file size significantly. 131 | 132 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 133 | Directory where temporary files will be stored. 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /docs/commands/cmapImporter.rst: -------------------------------------------------------------------------------- 1 | cmapImporter - An application to import ccmap or gcmap 2 | ------------------------------------------------------ 3 | 4 | It is an application for converting external Hi-C format into 5 | either gcmap or ccmap format. 6 | 7 | It can be launched by following command: 8 | :: 9 | 10 | gcMapExplorer cmapImporter 11 | 12 | 13 | .. figure:: ../images/importer.png 14 | :scale: 80% 15 | :alt: Screen snapshot of Importer Interface 16 | 17 | cmapImporter Interface 18 | 19 | 20 | This interface contains in-built help (**Click on** ``??`` **button**) 21 | to understand the functionality of interfaces. 22 | -------------------------------------------------------------------------------- /docs/commands/cmapNormalizer.rst: -------------------------------------------------------------------------------- 1 | cmapNormalizer - An application for Hi-C map normalization 2 | ---------------------------------------------------------- 3 | 4 | Presently this application contains all the three normalization methods. It can 5 | be launch by following command: 6 | 7 | :: 8 | 9 | gcMapExplorer cmapNormalizer 10 | 11 | 12 | .. figure:: ../images/normalizer.png 13 | :scale: 80% 14 | :alt: Screen snapshot of normalizer interface 15 | 16 | Contact map normalization Interface 17 | 18 | 19 | This interface contains in-built help (**Click on** ``??`` **button**) 20 | to understand the functionality of interfaces. 21 | -------------------------------------------------------------------------------- /docs/commands/config.rst: -------------------------------------------------------------------------------- 1 | config 2 | ====== 3 | 4 | **Description:** 5 | To print configuration file and clean scratch directory 6 | 7 | This can be used to print configuration file and its content. 8 | 9 | **Usage:** 10 | 11 | .. code-block:: bash 12 | 13 | gcMapExplorer config [-h] [-cs] [-pc] 14 | 15 | 16 | 17 | ``-cs,--clean-scratch`` 18 | ----------------------- 19 | Clean scratch directory 20 | gcMapexplorer try to remove all temporary files present in scracth 21 | directory. However, due to crash and errors, sometimes these files cannot be removed. 22 | Therefore, by this simple command, all temporary files from the scracth directory 23 | is removed. 24 | 25 | .. note:: Temporary files could be huge and therefore it is advised to run this command periodically. 26 | .. note:: Do not use this command when any of the gcMapExplorer tools or module are in execution process. 27 | 28 | ``-pc,--print-config`` 29 | ---------------------- 30 | Print configuration file. It will print location configuration file and its content. 31 | -------------------------------------------------------------------------------- /docs/commands/coo2cmap.rst: -------------------------------------------------------------------------------- 1 | coo2cmap - convert COO sparse matrix format to ccmap or gcmap 2 | ------------------------------------------------------------- 3 | 4 | As shown below in example, in this format, first and second column is location 5 | on chromosome and third column is the respective value: 6 | 7 | :: 8 | 9 | 20000000 20000000 2692.0 10 | 20000000 20100000 885.0 11 | 20100000 20100000 6493.0 12 | 20000000 20200000 15.0 13 | 20100000 20200000 52.0 14 | 20200000 20200000 2.0 15 | 20000000 20300000 18.0 16 | 20100000 20300000 40.0 17 | 18 | **NOTE** that, above location is real value. However, with ``-idx/--index`` 19 | option, these two same column will be considered as index value. index should 20 | always start from zero for absolute beginning of chromosome.e.g. for 10kb, 21 | 0-10000 should have index of zero, 10000-20000 have index of one. If this 22 | is file format,resolution should be provided with ``-r/--resolution`` option. 23 | 24 | Usage: 25 | .. code-block:: bash 26 | 27 | usage: gcMapExplorer coo2cmap [-h] [-i input.txt] [-ic input.tar.gz] 28 | [-mt intra] [-r 10kb] [-idx] 29 | [-ccm 10kb_RawObserved] [-od OUTDIR] 30 | [-gcm inOut.gcmap] [-cmeth lzf] [-dmeth sum] 31 | [-wd /home/rajendra/deskForWork/scratch] 32 | 33 | 34 | **Optional arguments:** 35 | 36 | .. code-block:: bash 37 | 38 | -h, --help show this help message and exit 39 | -i input.txt, --input input.txt 40 | Meta input file containing input contact map files list with respective 41 | xlabel and ylabel. xlabel should be always provided. In case of intra- 42 | chromosomal map, only xlabel is sufficient because both x and y axis are of 43 | same chromosome. However for inter-chromosomal map, both xlabel and ylabel 44 | should be provided. Example format: 45 | 46 | 100kb_resolution_intrachromosomal/chr1/MAPQGE30/chr1_100kb.RAWobserved chr1 47 | 100kb_resolution_intrachromosomal/chr5/MAPQGE30/chr5_100kb.RAWobserved chr5 48 | 100kb_resolution_intrachromosomal/chr15/MAPQGE30/chr15_100kb.RAWobserved chr15 49 | 100kb_resolution_intrachromosomal/chr20/MAPQGE30/chr20_100kb.RAWobserved chr20 50 | 100kb_resolution_intrachromosomal/chr21/MAPQGE30/chr21_100kb.RAWobserved chr21 51 | 100kb_resolution_intrachromosomal/chr22/MAPQGE30/chr22_100kb.RAWobserved chr22 52 | 53 | -ic input.tar.gz, --input-compressed input.tar.gz 54 | Input compressed archive file containing all the listed contact maps. 55 | Presently, only "tar.gz" and "zip" compressed files are supported. 56 | 57 | If -i/--input is not provided, all files from compressed file will be tried for 58 | processing. 59 | 60 | -mt intra, --mapType intra 61 | Type of listed contact maps: "intra" or "inter" chromosomal map. 62 | 63 | -r 10kb, --resolution 10kb 64 | Resolution of all maps. It is an optional argument. Note that, if this 65 | option is not provided, resolution will be automatically determined from the 66 | contact map file. However, in case of -idx/--index option, resolution 67 | should be provided as resolution cannot be determined from input contact map 68 | file. 69 | 70 | -idx, --index It determines whether contact map files have real coordinate of chromosome 71 | or index number. If this option is enabled, -r/--resolution option should be 72 | provided. 73 | 74 | -ccm 10kb_RawObserved, --ccmap 10kb_RawObserved 75 | Use this to convert all contact maps to ccmap format files. Provide suffix 76 | of ccmap file names with this option and it will enable the conversion. 77 | 78 | Output ccmap file name is generated automatically as follows; 79 | if xlabel is not equal to ylabel: __.ccmap 80 | else: _.ccmap 81 | 82 | Note that -od/--out-dir option is also required because all ccmaps will be 83 | saved in this directory. 84 | 85 | -od OUTDIR, --out-dir OUTDIR 86 | Directory where all ccmap files will be saved. 87 | -gcm inOut.gcmap, --gcmap inOut.gcmap 88 | Provide gcmap file to convert all contact maps into one gcmap file. 89 | File name should contain full path because -od/--out-dir is not considered 90 | for this conversion. 91 | 92 | -cmeth lzf, --compression-method lzf 93 | Data compression method in gcmap file. 94 | -dmeth sum, --downsample-method sum 95 | Downsampling method to coarsen the resolution in gcmap file. The option is 96 | intended to use with -gcm/--gcmap option. Three accepted methods are 97 | sum : sum of values, 98 | mean : Average of values and 99 | max : Maximum of values. 100 | 101 | This option generates all coarser maps where resolutions will be coarsened by 102 | a factor of two, consecutively. e.g.: In case of 10 kb input resolution, 103 | downsampled maps of "20kb", "40kb", "80kb", "160kb", "320kb" etc. will be 104 | generated until, map size is less than 500. 105 | 106 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 107 | Directory where temporary files will be stored. 108 | 109 | -------------------------------------------------------------------------------- /docs/commands/h5Converter.rst: -------------------------------------------------------------------------------- 1 | h5Converter 2 | ~~~~~~~~~~~ 3 | This is a GUI application, which can be used to convert bigWig/wig/bed file into 4 | ``gcMapExplorer browser`` compatible h5 file. To open this interface, use 5 | following command: 6 | 7 | :: 8 | 9 | gcMapExplorer h5Converter 10 | 11 | 12 | .. figure:: ../images/h5Converter.png 13 | :scale: 90% 14 | :alt: Screen snapshot of genomic track dataset converter 15 | 16 | h5Converter Interface 17 | 18 | 19 | This interface contains in-built help (**Click on** ``??`` **button**) 20 | to understand the functionality of interfaces. 21 | 22 | -------------------------------------------------------------------------------- /docs/commands/hic2gcmap.rst: -------------------------------------------------------------------------------- 1 | hic2gcmap - convert hic file to gcmap 2 | ------------------------------------- 3 | 4 | Hic files as described in [1]_ can be converted to gcmap. 5 | 6 | Usage: 7 | .. code-block:: bash 8 | 9 | usage: gcMapExplorer hic2gcmap [-h] [-c A B | -l] [--compression C] [-r R] 10 | [-n N] [--downsampling D] 11 | input [output] 12 | 13 | Arguments: 14 | .. code-block:: bash 15 | 16 | positional arguments: 17 | input hic input file 18 | output output file or directory 19 | 20 | optional arguments: 21 | -h, --help show this help message and exit 22 | -c A B, --chromosomes A B 23 | a pair of chromosomes A B 24 | -l, --list list all available chromosomes 25 | --compression C compression type, choose between lzf, gzip (default: 26 | lzf) 27 | -r R, --resolution R the resolution, as an integer or as kb (default: 28 | finest) 29 | -n N, --norm N the type of norm to use, choose between VC, VC_SQRT, 30 | KR, none (default: none) 31 | --downsampling D the downsampling method to use, choose between sum, 32 | mean, max, none (default: sum) 33 | 34 | 35 | Examples: 36 | Import all chromosome pairs at the finest available resolution: 37 | 38 | .. code-block:: bash 39 | 40 | gcMapExplorer hic2gcmap input.hic 41 | 42 | List all available chromosomes: 43 | 44 | .. code-block:: bash 45 | 46 | gcMapExplorer hic2gcmap input.hic --list 47 | 48 | Import chromosome pair X X and save output to ``output.gcmap``: 49 | 50 | .. code-block:: bash 51 | 52 | gcMapExplorer hic2gcmap input.hic ouput.gcmap -c X X 53 | 54 | Same as above but save to a generated filename in ``outdir/`` using finest resulution 10kb: 55 | 56 | .. code-block:: bash 57 | 58 | gcMapExplorer hic2gcmap input.hic outdir/ -c X X -r 10kb 59 | 60 | 61 | References: 62 | .. [1] Durand, Neva C. *et al*. Juicer Provides a One-Click System for Analyzing Loop-Resolution Hi-C Experiments, Cell Systems, Volume 3, Issue 1, p. 95-98. 63 | 64 | -------------------------------------------------------------------------------- /docs/commands/homer2cmap.rst: -------------------------------------------------------------------------------- 1 | homer2cmap - HOMER Hi-C matrix to ccmap or gcmap 2 | ------------------------------------------------ 3 | 4 | `HOMER package `_ contains modules to 5 | analyze genome wide interaction data. It creates Hi-C matrix in a specific 6 | format as shown as shown `here `_. 7 | 8 | This format contains contact map in a matrix format. 9 | 10 | Usage: 11 | .. code-block:: bash 12 | 13 | usage: gcMapExplorer homer2cmap [-h] [-i matrix.txt] [-ccm RawObserved] 14 | [-od OUTDIR] [-gcm inOut.gcmap] [-cmeth lzf] 15 | [-dmeth sum] 16 | [-wd /home/rajendra/deskForWork/scratch] 17 | 18 | 19 | 20 | **Optional arguments:** 21 | 22 | .. code-block:: bash 23 | 24 | -h, --help show this help message and exit 25 | -i matrix.txt, --input matrix.txt 26 | File containing HOMER Hi-C ineraction matrix format contact map 27 | 28 | -ccm RawObserved, --ccmap RawObserved 29 | Use this to convert all contact maps to ccmaps file. Provide suffix of 30 | ccmap file names with this option and it will enable the conversion. 31 | 32 | Output ccmap file name is generated automatically as follows; 33 | __.ccmap 34 | 35 | Note that -od/--out-dir option is also required because all ccmaps will be 36 | saved in this directory. 37 | 38 | -od OUTDIR, --out-dir OUTDIR 39 | Directory where all ccmap files will be saved. 40 | -gcm inOut.gcmap, --gcmap inOut.gcmap 41 | Provide gcmap file to convert all contact maps into one gcmap file. 42 | File name should contain full path because -od/--out-dir is not considered 43 | for thi conversion. 44 | 45 | -cmeth lzf, --compression-method lzf 46 | Data compression method for gcmap file. 47 | -dmeth sum, --downsample-method sum 48 | Downsampling method to coarsen the resolution in gcmap file. The option is 49 | intended to use with -gcm/--gcmap option. Three accepted methods are 50 | sum : sum of values, 51 | mean : Average of values and 52 | max : Maximum of values. 53 | 54 | This option generates all coarser maps where resolutions will be coarsened by 55 | a factor of two, consecutively. e.g.: In case of 10 kb input resolution, 56 | downsampled maps of "20kb", "40kb", "80kb", "160kb", "320kb" etc. will be 57 | generated until, map size is less than 500. 58 | 59 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 60 | Directory where temporary files will be stored. 61 | 62 | -------------------------------------------------------------------------------- /docs/commands/normIC.rst: -------------------------------------------------------------------------------- 1 | normIC - Normalization by Iterative Correction 2 | ---------------------------------------------- 3 | 4 | This method normalize the raw contact map by removing biases from 5 | experimental procedure. This is an method of matrix balancing, however, in the 6 | normalized, sum of rows and columns are **not** equal to one. 7 | 8 | Usage: 9 | 10 | .. code-block:: bash 11 | 12 | usage: gcMapExplorer normIC [-h] [-i input.gcmap] [-fi gcmap] 13 | [-o output.gcmap] [-fo gcmap] [-t 0.0001] 14 | [-vmax VMAX] [-vmin VMIN] [-c 500] [-ptnd 99] 15 | [-tdo 0.8] [-cmeth lzf] 16 | [-wd /home/rajendra/deskForWork/scratch] 17 | 18 | 19 | 20 | **Optional arguments:** 21 | 22 | .. code-block:: bash 23 | 24 | -h, --help show this help message and exit 25 | -i input.gcmap, --input input.gcmap 26 | Input ccmap or gcmap file. 27 | 28 | -fi gcmap, --format-input gcmap 29 | Input format: 'ccmap' or 'gcmap'. 30 | 31 | -o output.gcmap, --output output.gcmap 32 | Output ccmap or gcmap file. 33 | 34 | When input file is ccmap, output file can be gcmap. However, when a input file 35 | is gcmap, output file will be only in gcmap. 36 | 37 | -fo gcmap, --format-output gcmap 38 | Input format: 'ccmap' or 'gcmap'. 39 | 40 | When input file is ccmap, output file can be gcmap. However, when a input file 41 | is gcmap, output file will be only in gcmap. 42 | 43 | -t 0.0001, --tolerance 0.0001 44 | Tolerance for matrix balancing. 45 | Smaller tolerance increases accuracy in sums of rows and columns. 46 | 47 | -vmax VMAX, --maximum-value VMAX 48 | Minimum threshold value for normalization. 49 | If contact frequency is less than or equal to this threshold value, 50 | this value is discarded during normalization. 51 | 52 | -vmin VMIN, --minimum-value VMIN 53 | Maximum threshold value for normalization. 54 | If contact frequency is greater than or equal to this threshold value, 55 | this value is discarded during normalization. 56 | 57 | -c 500, --iteration 500 58 | Number of iteration to stop the normalization. 59 | 60 | -ptnd 99, --percentile-threshold-no-data 99 61 | It can be used to filter the map, where rows/columns with largest numbers 62 | of missing data can be discarded. Its value should be between 1 and 100. 63 | This options discard the rows and columns which are above this percentile. 64 | For example: if this value is 99, those rows or columns will be discarded which 65 | contains larger than number of zeros (missing data) at 99 percentile. 66 | 67 | To calculate percentile, all blank rows are removed, then in all rows, number 68 | of zeros are counted. Afterwards, number of zeros at input percentile is 69 | obtained. In next step, if a row contain number of zeros larger than this 70 | percentile value, the whole row and column is assigned to have missing data. 71 | This percentile indicates highest numbers of zeros (missing data) in given 72 | rows/columns. 73 | 74 | -tdo 0.8, --threshold-data-occupancy 0.8 75 | It can be used to filter the map, where rows/columns with largest numbers 76 | of missing data can be discarded.This ratio is: 77 | (number of bins with data) / (total number of bins in the given row/column) 78 | 79 | For example: if -tdo = 0.8, then all rows containing more than 20% of 80 | missing data will be discarded. 81 | 82 | -cmeth lzf, --compression-method lzf 83 | Data compression method for output gcmap file. 84 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 85 | Directory where temporary files will be stored. 86 | -------------------------------------------------------------------------------- /docs/commands/normKR.rst: -------------------------------------------------------------------------------- 1 | normKR - Normalization by Knight-Ruiz matrix balancing 2 | ------------------------------------------------------ 3 | 4 | The Knight-Ruiz (KR) matrix balancing is a fast algorithm to normalize a 5 | symmetric matrix. A doubly stochastic matrix is obtained after this 6 | normalization. In this matrix, sum of rows and columns are equal to one. 7 | 8 | Usage: 9 | 10 | .. code-block:: bash 11 | 12 | usage: gcMapExplorer normKR [-h] [-i input.gcmap] [-fi gcmap] 13 | [-o output.gcmap] [-fo gcmap] [-t 1e-12] [-m RAM] 14 | [-vmax VMAX] [-vmin VMIN] [-mscm 20000] [-ptnd 99] 15 | [-tdo 0.8] [-cmeth lzf] 16 | [-wd /home/rajendra/deskForWork/scratch] 17 | 18 | **Optional arguments:** 19 | 20 | .. code-block:: bash 21 | 22 | -h, --help show this help message and exit 23 | -i input.gcmap, --input input.gcmap 24 | Input ccmap or gcmap file. 25 | 26 | -fi gcmap, --format-input gcmap 27 | Input format: 'ccmap' or 'gcmap'. 28 | 29 | -o output.gcmap, --output output.gcmap 30 | Output ccmap or gcmap file. 31 | 32 | When input file is ccmap, output file can be gcmap. However, when a input file 33 | is gcmap, output file will be only in gcmap. 34 | 35 | -fo gcmap, --format-output gcmap 36 | Output format: 'ccmap' or 'gcmap'. 37 | 38 | When input file is ccmap, output file can be gcmap. However, when a input file 39 | is gcmap, output file will be only in gcmap. 40 | 41 | -t 1e-12, --tolerance 1e-12 42 | Tolerance for matrix balancing. 43 | Smaller tolerance increases accuracy in sums of rows and columns. 44 | 45 | -m RAM, --memory RAM The memory used for calculation. Acceptable keywords are 'RAM' or 'HDD'. 46 | 47 | In case of RAM, memory is used for the calculation. In case of Disk, all 48 | intermediate steps will use DIsk Drive to store intermediate data. 49 | 50 | This option is ONLY VALID when input file is in ccmap format. 51 | 52 | -vmax VMAX, --maximum-value VMAX 53 | Minimum threshold value for normalization. 54 | If contact frequency is less than or equal to this threshold value, 55 | this value is discarded during normalization. 56 | 57 | -vmin VMIN, --minimum-value VMIN 58 | Maximum threshold value for normalization. 59 | If contact frequency is greater than or equal to this threshold value, 60 | this value is discarded during normalization. 61 | 62 | -mscm 20000, --map-size-ceiling-for-memory 20000 63 | Maximum size of contact map allowed for calculation using RAM. 64 | If map size or shape is larger than this value, normalization will be 65 | performed using disk (HDD). This option is ONLY VALID when input file is in 66 | gcmap format. 67 | 68 | -ptnd 99, --percentile-threshold-no-data 99 69 | It can be used to filter the map, where rows/columns with largest numbers 70 | of missing data can be discarded. Its value should be between 1 and 100. 71 | This options discard the rows and columns which are above this percentile. 72 | For example: if this value is 99, those rows or columns will be discarded which 73 | contains larger than number of zeros (missing data) at 99 percentile. 74 | 75 | To calculate percentile, all blank rows are removed, then in all rows, number 76 | of zeros are counted. Afterwards, number of zeros at input percentile is 77 | obtained. In next step, if a row contain number of zeros larger than this 78 | percentile value, the whole row and column is assigned to have missing data. 79 | This percentile indicates highest numbers of zeros (missing data) in given 80 | rows/columns. 81 | 82 | -tdo 0.8, --threshold-data-occupancy 0.8 83 | It can be used to filter the map, where rows/columns with largest numbers 84 | of missing data can be discarded.This ratio is: 85 | (number of bins with data) / (total number of bins in the given row/column) 86 | 87 | For example: if -tdo = 0.8, then all rows containing more than 20% of 88 | missing data will be discarded. 89 | 90 | -cmeth lzf, --compression-method lzf 91 | Data compression method for output gcmap file. 92 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 93 | Directory where temporary files will be stored. 94 | -------------------------------------------------------------------------------- /docs/commands/normMCFS.rst: -------------------------------------------------------------------------------- 1 | normMCFS - Scale maps using Median/Mean Contact Frequency 2 | --------------------------------------------------------- 3 | 4 | This method can be used to normalize contact map with expected values. 5 | These expected values could be either Median or Average contact values 6 | for particular distance between two locations/coordinates. At first, 7 | Median/Average distance contact frequency for each distance is calculated. 8 | Subsequently, the observed contact frequency is either divided ('o/e') or 9 | subtracted ('o-e') by median/average contact frequency obtained for 10 | distance between the two locations. 11 | 12 | Usage: 13 | 14 | .. code-block:: bash 15 | 16 | usage: gcMapExplorer normMCFS [-h] [-i input.gcmap] [-fi gcmap] 17 | [-o output.gcmap] [-fo gcmap] [-s median] 18 | [-vmax VMAX] [-vmin VMIN] [-st o/e] [-ptnd 99] 19 | [-tdo 0.8] [-cmeth lzf] 20 | [-wd /home/rajendra/deskForWork/scratch] 21 | 22 | 23 | 24 | 25 | **Optional arguments:** 26 | 27 | .. code-block:: bash 28 | 29 | -h, --help show this help message and exit 30 | -i input.gcmap, --input input.gcmap 31 | Input ccmap or gcmap file. 32 | 33 | -fi gcmap, --format-input gcmap 34 | Input format: 'ccmap' or 'gcmap'. 35 | 36 | -o output.gcmap, --output output.gcmap 37 | Output ccmap or gcmap file. 38 | 39 | When input file is ccmap, output file can be gcmap. However, when a input file 40 | is gcmap, output file will be only in gcmap. 41 | 42 | -fo gcmap, --format-output gcmap 43 | Input format: 'ccmap' or 'gcmap'. 44 | 45 | When input file is ccmap, output file can be gcmap. However, when a input file 46 | is gcmap, output file will be only in gcmap. 47 | 48 | -s median, --stats median 49 | Statistics to be considered for scaling. 50 | It may be either “mean” or “median”. By default, it is “median”. 51 | 52 | -vmax VMAX, --maximum-value VMAX 53 | Minimum threshold value for normalization. 54 | If contact frequency is less than or equal to this threshold value, 55 | this value is discarded during normalization. 56 | 57 | -vmin VMIN, --minimum-value VMIN 58 | Maximum threshold value for normalization. 59 | If contact frequency is greater than or equal to this threshold value, 60 | this value is discarded during normalization. 61 | 62 | -st o/e, --stype o/e Type of scaling. 63 | It may be either 'o/e' or 'o-e'. In case of 'o/e', 64 | Observed/Expected will be calculated while (Observed - Expected) 65 | will be calculated for 'o-e'. 66 | 67 | -ptnd 99, --percentile-threshold-no-data 99 68 | It can be used to filter the map, where rows/columns with largest numbers 69 | of missing data can be discarded. Its value should be between 1 and 100. 70 | This options discard the rows and columns which are above this percentile. 71 | For example: if this value is 99, those rows or columns will be discarded which 72 | contains larger than number of zeros (missing data) at 99 percentile. 73 | 74 | To calculate percentile, all blank rows are removed, then in all rows, number 75 | of zeros are counted. Afterwards, number of zeros at input percentile is 76 | obtained. In next step, if a row contain number of zeros larger than this 77 | percentile value, the whole row and column is assigned to have missing data. 78 | This percentile indicates highest numbers of zeros (missing data) in given 79 | rows/columns. 80 | 81 | -tdo 0.8, --threshold-data-occupancy 0.8 82 | It can be used to filter the map, where rows/columns with largest numbers 83 | of missing data can be discarded.This ratio is: 84 | (number of bins with data) / (total number of bins in the given row/column) 85 | 86 | For example: if -tdo = 0.8, then all rows containing more than 20% of 87 | missing data will be discarded. 88 | 89 | -cmeth lzf, --compression-method lzf 90 | Data compression method for output gcmap file. 91 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 92 | Directory where temporary files will be stored. 93 | -------------------------------------------------------------------------------- /docs/commands/normVC.rst: -------------------------------------------------------------------------------- 1 | normVC - Normalization by Vanilla-Coverage 2 | ------------------------------------------ 3 | 4 | This method was first used for inter-chromosomal map. Later it was used for 5 | intra-chromosomal map by Rao et al., 2014 (http://dx.doi.org/10.1016/j.cell.2014.11.021). 6 | This is a simple method where at first each element is divided by sum of 7 | respective row and subsequently divided by sum of respective column. 8 | 9 | For more details, see publications: 10 | 1) https://doi.org/10.1126/science.1181369 11 | 2) http://dx.doi.org/10.1016/j.cell.2014.11.021 12 | 13 | Usage: 14 | 15 | .. code-block:: bash 16 | 17 | usage: gcMapExplorer normVC [-h] [-i input.gcmap] [-fi gcmap] 18 | [-o output.gcmap] [-fo gcmap] [-sq] [-vmax VMAX] 19 | [-vmin VMIN] [-ptnd 99] [-tdo 0.8] [-cmeth lzf] 20 | [-wd /home/*****/scratch] 21 | 22 | **Optional arguments:** 23 | 24 | .. code-block:: bash 25 | 26 | -h, --help show this help message and exit 27 | -i input.gcmap, --input input.gcmap 28 | Input ccmap or gcmap file. 29 | 30 | -fi gcmap, --format-input gcmap 31 | Input format: 'ccmap' or 'gcmap'. 32 | 33 | -o output.gcmap, --output output.gcmap 34 | Output ccmap or gcmap file. 35 | 36 | When input file is ccmap, output file can be gcmap. However, when a input file 37 | is gcmap, output file will be only in gcmap. 38 | 39 | -fo gcmap, --format-output gcmap 40 | Output format: 'ccmap' or 'gcmap'. 41 | 42 | When input file is ccmap, output file can be gcmap. However, when a input file 43 | is gcmap, output file will be only in gcmap. 44 | 45 | -sq, --sqroot Square-root of normalized map 46 | 47 | -vmax VMAX, --maximum-value VMAX 48 | Minimum threshold value for normalization. 49 | If contact frequency is less than or equal to this threshold value, 50 | this value is discarded during normalization. 51 | 52 | -vmin VMIN, --minimum-value VMIN 53 | Maximum threshold value for normalization. 54 | If contact frequency is greater than or equal to this threshold value, 55 | this value is discarded during normalization. 56 | 57 | -ptnd 99, --percentile-threshold-no-data 99 58 | It can be used to filter the map, where rows/columns with largest numbers 59 | of missing data can be discarded. Its value should be between 1 and 100. 60 | This options discard the rows and columns which are above this percentile. 61 | For example: if this value is 99, those rows or columns will be discarded which 62 | contains larger than number of zeros (missing data) at 99 percentile. 63 | 64 | To calculate percentile, all blank rows are removed, then in all rows, number 65 | of zeros are counted. Afterwards, number of zeros at input percentile is 66 | obtained. In next step, if a row contain number of zeros larger than this 67 | percentile value, the whole row and column is assigned to have missing data. 68 | This percentile indicates highest numbers of zeros (missing data) in given 69 | rows/columns. 70 | 71 | -tdo 0.8, --threshold-data-occupancy 0.8 72 | It can be used to filter the map, where rows/columns with largest numbers 73 | of missing data can be discarded.This ratio is: 74 | (number of bins with data) / (total number of bins in the given row/column) 75 | 76 | For example: if -tdo = 0.8, then all rows containing more than 20% of 77 | missing data will be discarded. 78 | 79 | -cmeth lzf, --compression-method lzf 80 | Data compression method for output gcmap file. 81 | -wd /home/*****/scratch, --work-dir /home/*****/scratch 82 | Directory where temporary files will be stored. 83 | -------------------------------------------------------------------------------- /docs/commands/pairCoo2cmap.rst: -------------------------------------------------------------------------------- 1 | pairCoo2cmap - paired COO sparse matrix to ccmap or gcmap 2 | --------------------------------------------------------- 3 | 4 | This format is very similar to COO format with an additional information of 5 | chromosome. Therefore, maps for all chromosome could be contained in a single 6 | file. 7 | 8 | This type of format appeared with this `publication 9 | `_ 10 | (`GEO datasets `_). 11 | 12 | Following file format can be read as a text file, where first and second 13 | column is location on chromosome and third column is the value: 14 | 15 | :: 16 | 17 | chr4 60000 75000 chr4 60000 75000 0.1163470887070292 18 | chr4 60000 75000 chr4 105000 120000 0.01292745430078102 19 | chr4 60000 75000 chr4 435000 450000 0.01292745430078102 20 | chr4 75000 90000 chr4 75000 90000 0.05170981720312409 21 | chr4 75000 90000 chr4 345000 360000 0.01292745430078102 22 | chr4 90000 105000 chr4 90000 105000 0.01292745430078102 23 | . 24 | . 25 | . 26 | . 27 | . 28 | . 29 | 30 | 31 | Usage: 32 | .. code-block:: bash 33 | 34 | usage: gcMapExplorer pairCoo2cmap [-h] [-i maps.txt] [-ccm RawObserved] 35 | [-od OUTDIR] [-gcm inOut.gcmap] [-cmeth lzf] 36 | [-dmeth sum] 37 | [-wd /home/rajendra/deskForWork/scratch] 38 | 39 | 40 | **Optional arguments:** 41 | 42 | .. code-block:: bash 43 | 44 | -h, --help show this help message and exit 45 | -i maps.txt, --input maps.txt 46 | Input file name. 47 | 48 | -ccm RawObserved, --ccmap RawObserved 49 | Use this to convert all contact maps to ccmaps file. Provide suffix of 50 | ccmap file names with this option and it will enable the conversion. 51 | 52 | Output ccmap file name is generated automatically as follows; 53 | __.ccmap 54 | 55 | Note that -od/--out-dir option is also required because all ccmaps will be 56 | saved in this directory. 57 | 58 | -od OUTDIR, --out-dir OUTDIR 59 | Directory where all ccmap files will be saved. 60 | -gcm inOut.gcmap, --gcmap inOut.gcmap 61 | Provide gcmap file to convert all contact maps into one gcmap file. 62 | File name should contain full path because -od/--out-dir is not considered 63 | for thi conversion. 64 | 65 | -cmeth lzf, --compression-method lzf 66 | Data compression method for gcmap file. 67 | -dmeth sum, --downsample-method sum 68 | Downsampling method to coarsen the resolution in gcmap file. The option is 69 | intended to use with -gcm/--gcmap option. Three accepted methods are 70 | sum : sum of values, 71 | mean : Average of values and 72 | max : Maximum of values. 73 | 74 | This option generates all coarser maps where resolutions will be coarsened by 75 | a factor of two, consecutively. e.g.: In case of 10 kb input resolution, 76 | downsampled maps of "20kb", "40kb", "80kb", "160kb", "320kb" etc. will be 77 | generated until, map size is less than 500. 78 | 79 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 80 | Directory where temporary files will be stored. 81 | 82 | -------------------------------------------------------------------------------- /docs/commands/wig2h5.rst: -------------------------------------------------------------------------------- 1 | wig2h5 2 | ~~~~~~ 3 | 4 | **Description:** 5 | 6 | .. code-block:: bash 7 | 8 | Import a wig file to HDF5 format h5 file 9 | ============================================ 10 | 11 | wig file can be converted into gcMapExplorer compatible HDF5 file using 12 | this tool. This HDF5 file can be loaded into gcMapExplorer browser for 13 | interactive visualization. 14 | 15 | This tool does not require any external program. 16 | 17 | Resolutions 18 | =========== 19 | By default, original data are downsampled to following resolutions: '1kb', 20 | '2kb', '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb', 21 | '200kb', '320kb', '500kb', '640kb', and '1mb'. 22 | 23 | The data are downsampled at this stage only to speed up the visualization 24 | process as downsampling might slow down the interactive visualization. 25 | 26 | Downsampling/Coarsening method 27 | ============================== 28 | Presently, six methods are implemented: 29 | 1) min -> Minimum value 30 | 2) max -> Maximum value 31 | 3) amean -> Arithmetic mean or average 32 | 4) hmean -> Harmonic mean 33 | 5) gmean -> Geometric mean 34 | 6) median -> Median 35 | 36 | All these methods are used by default. 37 | See below help for "-dm/--downsample-method" option to change the methods. 38 | 39 | To keep original 1 base resolution data 40 | ======================================= 41 | By default, the output h5 file does not contain original 1-base resolution 42 | data to reduce the file size. To keep the original data in h5 file, used 43 | -ko/--keep-original flag. 44 | 45 | 46 | 47 | **Usage:** 48 | 49 | .. code-block:: bash 50 | 51 | usage: gcMapExplorer wig2h5 [-h] [-i input.wig] [-t "Genomic Dataset"] 52 | [-r "List of Resolutions"] 53 | [-dm "List of downsampling method"] 54 | [-icn CHROMNAME] [-cmeth lzf] [-o out.h5] [-ow] 55 | [-ko] [-idf index.json] 56 | [-wd /home/rajendra/deskForWork/scratch] 57 | 58 | 59 | 60 | **Optional arguments:** 61 | 62 | .. code-block:: bash 63 | 64 | -h, --help show this help message and exit 65 | -i input.wig, --input input.wig 66 | Input wig file. 67 | 68 | -t "Genomic Dataset", --title "Genomic Dataset" 69 | Title of the dataset. 70 | -r "List of Resolutions", --resolutions "List of Resolutions" 71 | Additional input resolutions other than these resolutions: 1kb', '2kb', 72 | '4kb', '5kb', '8kb', '10kb', '20kb', '40kb', '80kb', '100kb', '160kb','200kb', 73 | '320kb', '500kb', '640kb', and '1mb'. 74 | 75 | Resolutions should be provided in comma separated values. For Example: 76 | -r "25kb, 50kb, 75kb" 77 | 78 | -dm "List of downsampling method", --downsample-method "List of downsampling method" 79 | Methods to coarse or downsample the data for converting from 1-base 80 | to coarser resolutions. If this option is not provided, all six methods (see 81 | above) will be considered. User may use only subset of these methods. 82 | For example: -dm "max, amean" can be used for downsampling by only these 83 | two methods. 84 | 85 | -icn CHROMNAME, --input-chromosome CHROMNAME 86 | Input Chromosome Name. 87 | If this is provided, only this chromosome data is extracted and stored in h5 88 | file. 89 | 90 | -cmeth lzf, --compression-method lzf 91 | Data compression method in h5 file. 92 | -o out.h5, --out out.h5 93 | Output h5 file. 94 | 95 | If file is already present, it will replace the data. Therefore, be careful 96 | if a file with same name is present. 97 | 98 | -ow, --overwrite If a output file is already present, overwrite the datasets in the output 99 | file. 100 | 101 | -ko, --keep-original To copy original 1-base resolution data in h5 file. This will increase the 102 | file size significantly. 103 | 104 | -idf index.json, --index-file index.json 105 | Index file in json format. 106 | A file in json format containing indices (position in wig file) and sizes of 107 | chromosomes. If this file is not present and given as input, a new file will be 108 | generated. If this file is present, indices and sizes will be taken from this 109 | file. If index and size of input chromosome is not present in json file, these 110 | will be determined from wig file and stored in same json file. This file could 111 | be very helpful in case when same wig file has to be read many times because 112 | step to determine index and size of chromosome is skipped. 113 | 114 | -wd /home/rajendra/deskForWork/scratch, --work-dir /home/rajendra/deskForWork/scratch 115 | Directory where temporary files will be stored. 116 | -------------------------------------------------------------------------------- /docs/dLcmaps.rst: -------------------------------------------------------------------------------- 1 | 2 | .. include:: downloadCCMapLinks.txt 3 | .. include:: dlDatasetLinks.txt 4 | 5 | 6 | .. |GEO-HiC-Human-Cell-2014| raw:: html 7 | 8 | GEO datasets 9 | 10 | .. |HiC-Human-Cell-2014| raw:: html 11 | 12 | publication 13 | 14 | 15 | 16 | Download Example Datasets 17 | ========================= 18 | 19 | 20 | Contact map - gcmap/ccmap format 21 | -------------------------------- 22 | 23 | Followings are the ``gcmap`` format files available for the download. 24 | These data were taken from |GEO-HiC-Human-Cell-2014|, which was published 25 | along with this |HiC-Human-Cell-2014|. 26 | 27 | 28 | GM12878 Cell Types 29 | ~~~~~~~~~~~~~~~~~~ 30 | * Raw Observed - Finest 10 kb resolution - LZF compressed : |GM12878-10kb-raw-lzf| 31 | * Raw Observed - Finest 10 kb resolution - GZIP compressed : |GM12878-10kb-raw-gz| 32 | * KR Balanced - Finest 10 kb resolution - LZF compressed : |GM12878-10kb-kr-lzf| 33 | * KR Balanced - Finest 10 kb resolution - GZIP compressed : |GM12878-10kb-kr-gz| 34 | * Iteratively Corrected - Finest 10 kb resolution - LZF compressed : |GM12878-10kb-ic-lzf| 35 | * Iteratively Corrected - Finest 10 kb resolution - GZIP compressed : |GM12878-10kb-ic-gz| 36 | * Average Contacts by Distance Normalized - Finest 10 kb resolution - LZF compressed : |GM12878-10kb-acd-lzf| 37 | * Average Contacts by Distance Normalized - Finest 10 kb resolution - GZIP compressed : |GM12878-10kb-acd-gz| 38 | 39 | K562 Cell Types 40 | ~~~~~~~~~~~~~~~ 41 | * Raw Observed - Finest 10 kb resolution - LZF compressed : |K562-10kb-raw-lzf| 42 | * Raw Observed - Finest 10 kb resolution - GZIP compressed : |K562-10kb-raw-gz| 43 | * KR Balanced - Finest 10 kb resolution - LZF compressed : |K562-10kb-kr-lzf| 44 | * KR Balanced - Finest 10 kb resolution - GZIP compressed : |K562-10kb-kr-gz| 45 | * Iteratively Corrected - Finest 10 kb resolution - LZF compressed : |K562-10kb-ic-lzf| 46 | * Iteratively Corrected - Finest 10 kb resolution - GZIP compressed : |K562-10kb-ic-gz| 47 | * Average Contacts by Distance Normalized - Finest 10 kb resolution - LZF compressed : |K562-10kb-acd-lzf| 48 | * Average Contacts by Distance Normalized - Finest 10 kb resolution - GZIP compressed : |K562-10kb-acd-gz| 49 | 50 | 51 | **** 52 | 53 | 54 | Genomic datasets - h5 format 55 | ---------------------------- 56 | 57 | Followings dataset in h5 formats are available for the download. 58 | These were downloaded and converted from |Encode-Experiment-Matrix|. 59 | 60 | GM12878 Cell Types 61 | ~~~~~~~~~~~~~~~~~~ 62 | * RNA-seq : |GM12878-RNA-seq| 63 | * Histone modifications H3K9ac : |GM12878-H3K9ac| 64 | * Histone modifications H3K27ac : |GM12878-H3K27ac| 65 | * Histone modifications H3K36me3 : |GM12878-H3K36me3| 66 | * Histone modifications H3K79me2 : |GM12878-H3K79me2| 67 | * Histone modifications H3K4me3 : |GM12878-H3K4me3| 68 | * CTCF Binding Site Raw Signal : |GM12878-CTCF| 69 | 70 | 71 | K562 Cell Types 72 | ~~~~~~~~~~~~~~~ 73 | * RNA-seq : |GM12878-RNA-seq| 74 | * Histone modifications H3K9ac : |K562-H3K9ac| 75 | * Histone modifications H3K27ac : |K562-H3K27ac| 76 | * Histone modifications H3K36me3 : |K562-H3K36me3| 77 | * Histone modifications H3K79me2 : |K562-H3K79me2| 78 | * Histone modifications H3K4me3 : |K562-H3K4me3| 79 | * CTCF Binding Site Raw Signal : |K562-CTCF| 80 | -------------------------------------------------------------------------------- /docs/dlDatasetLinks.txt: -------------------------------------------------------------------------------- 1 | 2 | .. |Encode-Experiment-Matrix| raw:: html 3 | 4 | ENCODE Experiment Matrix 5 | 6 | 7 | .. GM12878 datasets 8 | 9 | .. |GM12878-RNA-seq| raw:: html 10 | 11 | Download 12 | 13 | .. |GM12878-H3K9ac| raw:: html 14 | 15 | Download 16 | 17 | .. |GM12878-H3K27ac| raw:: html 18 | 19 | Download 20 | 21 | .. |GM12878-H3K36me3| raw:: html 22 | 23 | Download 24 | 25 | .. |GM12878-H3K79me2| raw:: html 26 | 27 | Download 28 | 29 | .. |GM12878-H3K4me3| raw:: html 30 | 31 | Download 32 | 33 | .. |GM12878-CTCF| raw:: html 34 | 35 | Download 36 | 37 | 38 | 39 | 40 | .. K562 datasets 41 | 42 | .. |K562-RNA-seq| raw:: html 43 | 44 | Download 45 | 46 | .. |K562-H3K9ac| raw:: html 47 | 48 | Download 49 | 50 | .. |K562-H3K27ac| raw:: html 51 | 52 | Download 53 | 54 | .. |K562-H3K36me3| raw:: html 55 | 56 | Download 57 | 58 | .. |K562-H3K79me2| raw:: html 59 | 60 | Download 61 | 62 | .. |K562-H3K4me3| raw:: html 63 | 64 | Download 65 | 66 | .. |K562-CTCF| raw:: html 67 | 68 | Download 69 | -------------------------------------------------------------------------------- /docs/downloadCCMapLinks.txt: -------------------------------------------------------------------------------- 1 | .. GM12878 Hi-C maps 2 | 3 | .. |GM12878-10kb-raw-lzf| raw:: html 4 | 5 | Download 6 | 7 | .. |GM12878-10kb-raw-gz| raw:: html 8 | 9 | Download 10 | 11 | .. |GM12878-10kb-kr-lzf| raw:: html 12 | 13 | Download 14 | 15 | .. |GM12878-10kb-kr-gz| raw:: html 16 | 17 | Download 18 | 19 | .. |GM12878-10kb-ic-lzf| raw:: html 20 | 21 | Download 22 | 23 | .. |GM12878-10kb-ic-gz| raw:: html 24 | 25 | Download 26 | 27 | .. |GM12878-10kb-acd-lzf| raw:: html 28 | 29 | Download 30 | 31 | .. |GM12878-10kb-acd-gz| raw:: html 32 | 33 | Download 34 | 35 | 36 | 37 | .. K562 Hi-C maps 38 | .. |K562-10kb-raw-lzf| raw:: html 39 | 40 | Download 41 | 42 | .. |K562-10kb-raw-gz| raw:: html 43 | 44 | Download 45 | 46 | .. |K562-10kb-kr-lzf| raw:: html 47 | 48 | Download 49 | 50 | .. |K562-10kb-kr-gz| raw:: html 51 | 52 | Download 53 | 54 | .. |K562-10kb-ic-lzf| raw:: html 55 | 56 | Download 57 | 58 | .. |K562-10kb-ic-gz| raw:: html 59 | 60 | Download 61 | 62 | .. |K562-10kb-acd-lzf| raw:: html 63 | 64 | Download 65 | 66 | .. |K562-10kb-acd-gz| raw:: html 67 | 68 | Download 69 | -------------------------------------------------------------------------------- /docs/faq.rst: -------------------------------------------------------------------------------- 1 | Frequently asked questions 2 | ========================== 3 | 4 | gcMapExplorer browser: 5 | * `How to solve - When multiple maps are loaded, tick-labels are overlapped?`_ 6 | 7 | 8 | gcMapExplorer browser 9 | --------------------- 10 | 11 | 12 | How to solve - When multiple maps are loaded, tick-labels are overlapped? 13 | ------------------------------------------------------------------------- 14 | Several default settings could be change to resolve this issue. 15 | 16 | * By changing page size and orientation: When page size is increased, the space 17 | between maps also increases. Page size can be changed to either standard A4, 18 | A3 A2 and A1 size or any custom size through menu bar. 19 | * By changing axis properties: Properties such as font-size of axis-labels, 20 | tick intervals, labels rotation etc can be changed to increase the visibility 21 | of labels. Axis properties dialog can be accessed by right clicking on any 22 | map or plot. This dialog contains all necessary options to change the display 23 | style of axis elements. 24 | 25 | By combining these options, display quality of axis-labels can be changed in 26 | case of multiple maps. 27 | -------------------------------------------------------------------------------- /docs/file_formats.rst: -------------------------------------------------------------------------------- 1 | .. |hdf5| raw:: html 2 | 3 | HDF5 4 | 5 | .. |numpy memmap| raw:: html 6 | 7 | numpy memmap 8 | 9 | File formats 10 | ============ 11 | 12 | gcMapExplorer uses three format of files. Both gcmap and genomic track file are 13 | in |hdf5| format while ccmap file is in |numpy memmap| format. 14 | 15 | .. toctree:: 16 | gcmap file 17 | ccmap file 18 | genomic track HDF5 (h5) file 19 | -------------------------------------------------------------------------------- /docs/images/axis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/axis.png -------------------------------------------------------------------------------- /docs/images/browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/browser.png -------------------------------------------------------------------------------- /docs/images/browser_indexed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/browser_indexed.png -------------------------------------------------------------------------------- /docs/images/color-bar-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/color-bar-dialog.png -------------------------------------------------------------------------------- /docs/images/colormap_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/colormap_dialog.png -------------------------------------------------------------------------------- /docs/images/dataset_selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/dataset_selector.png -------------------------------------------------------------------------------- /docs/images/genome_track_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/genome_track_options.png -------------------------------------------------------------------------------- /docs/images/h5Converter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/h5Converter.png -------------------------------------------------------------------------------- /docs/images/importer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/importer.png -------------------------------------------------------------------------------- /docs/images/marker_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/marker_options.png -------------------------------------------------------------------------------- /docs/images/normalizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/normalizer.png -------------------------------------------------------------------------------- /docs/images/pageSize_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/pageSize_dialog.png -------------------------------------------------------------------------------- /docs/images/view-point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/docs/images/view-point.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. hiCMapAnalyze documentation master file, created by 2 | sphinx-quickstart on Wed Sep 30 22:10:12 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Genome Contact Map Explorer - gcMapExplorer 7 | ------------------------------------------- 8 | 9 | It is a platform to visualize and analyze the contact maps that are generated from Hi-C experiments. This package is developed by considering the huge size of contact maps at very fine resolution. It contains 10 | 11 | * :ref:`gui-table` - Several windows like applications to perform tasks. 12 | * Command Line Interface - Several commands to perform tasks. 13 | * :ref:`import-hic-command-table` 14 | * :ref:`convert-to-h5-file-table` 15 | * :ref:`normalize-maps-table` 16 | * `Application Programming Interface `_ 17 | - It can be used to perform analysis by any mathematical operations through programming. 18 | 19 | **For Discussion and Questions, visit** `this forum `_ 20 | 21 | Features 22 | -------- 23 | 24 | * Support for **huge contact maps** - Use of Disk instead of RAM - Matrices/arrays are stored in Disks - 25 | mathematical operations by directly reading/writing from/to Disks, **without loading them into RAM** 26 | * A `browser `_ with rich interfaces 27 | for **Comparative** and **Interactive** visualization of **two dimensional contact maps** along 28 | with **genomic datasets** such as produced by DNase-seq, ChIP-seq, RNA-seq etc. 29 | * Contact maps can be **zoomed in/out** from finest resolution to whole chromosome level. 30 | * Rich customizations of **color scale for contact maps** visualization 31 | * Rich customizations of **X- and Y- axis properties**. 32 | 33 | * `Normalization of contact maps `_ by 34 | * **Iterative Correction** (IC) 35 | * **Knight-Ruiz Matrix Balancing** (KR) 36 | * **Vanilla-Coverage** (VC) 37 | * **Distance-Frequency** 38 | 39 | * A **new file format** based on HDF5 for `genome contact map `_ 40 | and `genomic track datasets `_. 41 | 42 | * **Portable**, **platform independent** and can be read through C/C++, JAVA, Python and R programming language. 43 | * **Very fast to read** - fast browsing of contact maps and genomic datasets 44 | 45 | * Another file format for `chromosomal contact map `_ 46 | - much faster than above format to read/write but not compact. Suitable for performing calculations. 47 | * `A GUI interface and commands `_ 48 | to convert Coordinate Sparse, Pair Coordinate Sparse, HOMER Interaction matrix, Bin-Contact formats into the new gcmap and ccmap formats. 49 | * `Interface and commands to convert bigWig/wig/bed file to genomic track dataset h5 file 50 | `_. 51 | * `Interface and commands for contact map Normalizations `_. 52 | * Publication ready images at one click. 53 | 54 | 55 | Citation 56 | -------- 57 | 58 | Rajendra Kumar, Haitham Sobhy, Per Stenberg and Ludvig Lizana. 59 | `Genome Contact Map Explorer - A platform for the comparison, interactive visualization and analysis of genome contact maps. `_ 60 | *Nucleic Acids Res.* (2017). 61 | 62 | 63 | Screen-shots 64 | ------------ 65 | 66 | .. figure:: images/browser.png 67 | :scale: 40% 68 | :alt: Screen snapshot of Genome Contact Map browser 69 | 70 | Genome Contact Map browser 71 | 72 | .. figure:: images/axis.png 73 | :scale: 35% 74 | :alt: Screen snapshot of Axis Properties interface in Browser 75 | 76 | Axis Properties interface in Browser 77 | 78 | 79 | .. figure:: images/importer.png 80 | :scale: 35% 81 | :alt: Screen snapshot of Importer Interface 82 | 83 | gcmap Importer Interface 84 | 85 | 86 | .. figure:: images/h5Converter.png 87 | :scale: 35% 88 | :alt: Screen snapshot of genomic track dataset converter 89 | 90 | genomic track dataset converter Interface 91 | 92 | 93 | .. figure:: images/normalizer.png 94 | :scale: 35% 95 | :alt: Screen snapshot of normalizer interface 96 | 97 | Contact map normalization Interface 98 | 99 | **** 100 | 101 | 102 | Contents 103 | ======== 104 | 105 | .. py:module:: gcMapExplorer 106 | 107 | .. toctree:: 108 | :maxdepth: 2 109 | 110 | Requirements and Installation 111 | How to use gcMapExplorer? 112 | Genome Contact Map Browser 113 | About file formats 114 | Normalization of Hi-C maps 115 | Frequently asked questions 116 | Download example datasets 117 | Summary of Python Modules 118 | Examples using Python Modules 119 | Python Modules documentation 120 | 121 | 122 | Indices 123 | ======= 124 | 125 | * :ref:`genindex` 126 | * :ref:`modindex` 127 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | .. |appdirs| raw:: html 2 | 3 | appdirs 4 | 5 | .. |numpy| raw:: html 6 | 7 | numpy 8 | 9 | .. |scipy| raw:: html 10 | 11 | scipy 12 | 13 | .. |matplotlib| raw:: html 14 | 15 | matplotlib 16 | 17 | .. |h5py| raw:: html 18 | 19 | h5py 20 | 21 | .. |Cython| raw:: html 22 | 23 | Cython 24 | 25 | .. |PyQt5| raw:: html 26 | 27 | PyQt5 28 | 29 | .. |Homebrew| raw:: html 30 | 31 | Homebrew 32 | 33 | .. |WinPython| raw:: html 34 | 35 | WinPython3-Qt5 36 | 37 | Requirements and Installation 38 | ============================= 39 | 40 | 41 | Requirements 42 | ------------ 43 | 44 | gcMapExplorer is written in Python3, therefore, it **requires Python3** for 45 | installation. It also requires several external Python packages. 46 | 47 | **Package Required during installation:** It has to be installed before gcMapExplorer installation. 48 | 49 | * |Cython| 50 | 51 | **Package required after installation:** These packages are installed automatically during gcMapExplorer installation. 52 | 53 | * |appdirs| 54 | * |numpy| 55 | * |scipy| 56 | * |matplotlib| 57 | * |h5py| 58 | 59 | **Package required to install manually:** 60 | 61 | * |PyQt5| - It needs to be installed manually. In case of **Python-3.5**, it can be installed automatically from PyPI. 62 | 63 | **** 64 | 65 | Installation Steps on Linux 66 | --------------------------- 67 | 68 | 1. Python3 is available through package managers such as **yum** (Fedora, CentOs), **YaST** (OpenSuse) and **apt-get** 69 | (Ubuntu, Linux Mint). For example on ubuntu: run ``sudo apt-get install python3`` command to install Python3. 70 | 71 | 2. Install Cython by ``pip3 install Cython`` command. 72 | 73 | 3. Similar to Python3, PyQt5 is available through package managers. For example on ubuntu: run ``sudo apt-get install python3-pyqt5`` command 74 | to install Python3. 75 | 76 | 4. Install **gcMapExplorer** by ``pip3 install gcMapExplorer`` command. 77 | 78 | 79 | **** 80 | 81 | 82 | Installation Steps on MacOS 83 | --------------------------- 84 | 85 | 1. Python3 is available through |Homebrew| package manager. After installing Homebrew, run ``brew install python3`` command to install Python3. 86 | 87 | 2. Install Cython by ``pip3 install Cython`` command. 88 | 89 | 3. Similar to Python3, PyQt5 is available through |Homebrew|. Run ``brew install pyqt5 --with-python3`` command to install pyqt5. 90 | 91 | 4. Install **gcMapExplorer** by ``pip3 install gcMapExplorer`` command. 92 | 93 | 94 | **** 95 | 96 | Installation Steps on Windows OS 97 | -------------------------------- 98 | 99 | 1. Download and install |WinPython|. Note that WinPython should include PyQt5. 100 | 101 | 2. Open WinPython directory (Default is in C:/ drive) and click on **"WinPython Command Prompt"**. It will open a command prompt terminal. 102 | 103 | 3. Run ``pip install gcMapExplorer`` in command prompt terminal to install **gcMapExplorer** 104 | 105 | .. note:: 106 | To execute gcMapExplorer command, simple command prompt terminal (from Start Menu) might not work. 107 | Use **"WinPython Command Prompt"** present in WinPython directory to launch or execute gcMapExplorer. 108 | 109 | 110 | Updating gcMapExplorer 111 | ---------------------- 112 | To update the gcMapExplorer package use following command: 113 | 114 | .. code-block:: bash 115 | 116 | pip install --upgrade --no-deps gcMapExplorer 117 | 118 | 119 | **OR** 120 | 121 | .. code-block:: bash 122 | 123 | pip3 install --upgrade --no-deps gcMapExplorer 124 | 125 | 126 | ``--upgrade`` flag is used to update the package and ``--no-deps`` prevents 127 | update of dependent packages like numpy, scipy, matplotlib etc. 128 | 129 | 130 | Configuring gcMapExplorer 131 | ------------------------- 132 | 133 | Presently two types of global options are required. 134 | * Scratch Directory to dump intermediate temporary files 135 | * Location to ``bigWigInfo`` and ``bigWigToWig`` tool 136 | 137 | These options are stored in a configuration file. During first use of gcMapExplorer, Scratch Directory is set to 138 | by default temporary directory depending on OS. Location to external tools can be set by either manually opening and 139 | editing configuration file or through ``gcMapExplorer`` Python module (see below). 140 | 141 | For quick look to configuration file and cleaning scratch directory, ``gcMapExplorer config`` command can be used: 142 | 143 | .. toctree:: 144 | :maxdepth: 1 145 | 146 | config : To print configuration file and clean scratch directory 147 | 148 | 149 | 150 | Configuration using ``gcMapExplorer`` Python modules: 151 | 152 | * Print configuration file: :meth:`gcMapExplorer.config.printConfig` 153 | * Get configuration as dictionary: :meth:`gcMapExplorer.config.getConfig` 154 | * Update configuration file: :meth:`gcMapExplorer.config.updateConfig` 155 | * Clean scratch directory: :meth:`gcMapExplorer.config.cleanScratch` 156 | -------------------------------------------------------------------------------- /docs/modules_examples/export_ccmap.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "#### Export .ccmap as text file\n", 8 | "\n", 9 | "Presently only [COO list format](https://en.wikipedia.org/wiki/Sparse_matrix#Coordinate_list_.28COO.29) is implemented in `gcMapExplorer.ccmap.export_ccmap` function. In COO format, lists of (row, column, value) as three tab seprated columns are written in output file." 10 | ] 11 | }, 12 | { 13 | "cell_type": "raw", 14 | "metadata": { 15 | "raw_mimetype": "text/restructuredtext" 16 | }, 17 | "source": [ 18 | ".. seealso::\n", 19 | " Module :meth:`gcMapExplorer.ccmap.export_ccmap`" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 1, 25 | "metadata": {}, 26 | "outputs": [], 27 | "source": [ 28 | "import gcMapExplorer.lib as gmlib" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 2, 34 | "metadata": {}, 35 | "outputs": [], 36 | "source": [ 37 | "# Input files and path\n", 38 | "inputPath='normalized/'\n", 39 | "files= ['chr5_100kb_normKR.ccmap', 'chr15_100kb_normKR.ccmap', \n", 40 | " 'chr20_100kb_normKR.ccmap', 'chr21_100kb_normKR.ccmap']\n", 41 | "\n", 42 | "#Output files and path\n", 43 | "outputPath = 'export/'\n", 44 | "outputs=['chr5_100kb.txt', 'chr15_100kb.txt', 'chr20_100kb.txt', 'chr21_100kb.txt']\n", 45 | "\n", 46 | "\n", 47 | "for i, o in zip(files, outputs):\n", 48 | " ccmap = gmlib.ccmap.load_ccmap(inputPath+i)\n", 49 | " gmlib.ccmap.export_cmap(ccmap, outputPath+o, doNotWriteZeros=True)" 50 | ] 51 | } 52 | ], 53 | "metadata": { 54 | "celltoolbar": "Raw Cell Format", 55 | "kernelspec": { 56 | "display_name": "Python 3", 57 | "language": "python", 58 | "name": "python3" 59 | }, 60 | "language_info": { 61 | "codemirror_mode": { 62 | "name": "ipython", 63 | "version": 3 64 | }, 65 | "file_extension": ".py", 66 | "mimetype": "text/x-python", 67 | "name": "python", 68 | "nbconvert_exporter": "python", 69 | "pygments_lexer": "ipython3", 70 | "version": "3.4.3" 71 | } 72 | }, 73 | "nbformat": 4, 74 | "nbformat_minor": 1 75 | } 76 | -------------------------------------------------------------------------------- /docs/modules_examples/index.rst: -------------------------------------------------------------------------------- 1 | .. |numpy memmap| raw:: html 2 | 3 | numpy memmap 4 | 5 | 6 | .. |numpy array| raw:: html 7 | 8 | numpy array 9 | 10 | 11 | .. |numpy array concept| raw:: html 12 | 13 | here 14 | 15 | .. |indexing and slicing| raw:: html 16 | 17 | indexing and slicing 18 | 19 | .. |numpy routines| raw:: html 20 | 21 | numpy 22 | 23 | .. |scipy routines| raw:: html 24 | 25 | scipy 26 | 27 | .. |tutorial| raw:: html 28 | 29 | here. 30 | 31 | 32 | Contents 33 | -------- 34 | 35 | **Please download tutorial files** |tutorial| 36 | 37 | .. toctree:: 38 | :maxdepth: 1 39 | 40 | How to Import external Hi-C map data? 41 | How to normalize Hi-C map? 42 | How to access Hi-C data from ccmap file? 43 | Using masked array with Hi-C map 44 | How to export Hi-C data as text file? 45 | How to access map from gcmap file? 46 | Comparison - original KR algorithm and implemented method 47 | Comparison - original ICE algorithm and implemented method 48 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | appdirs>=1.4 2 | numpy>=1.6 3 | scipy>=0.9 4 | matplotlib>=1.1.0 5 | dask>=0.7.3 6 | toolz>=0.7.4 7 | h5py>=2.2.1 8 | psutil>=5.2.0 9 | scikit-learn>=0.19.0 10 | Cython>=0.22.0 11 | nbsphinx>=0.2.8 12 | jupyter_client>=4.1.0 13 | ipython>=6.0.0 14 | -------------------------------------------------------------------------------- /docs/usage.rst: -------------------------------------------------------------------------------- 1 | 2 | .. |tutorial| raw:: html 3 | 4 | here. 5 | 6 | 7 | How to use gcMapExplorer? 8 | ========================= 9 | 10 | Several interfaces are available as following. 11 | 12 | * :ref:`gui-table` - Several windows like applications to perform tasks. 13 | * Command Line Interface - Several commands to perform tasks. 14 | * :ref:`import-hic-command-table` 15 | * :ref:`convert-to-h5-file-table` 16 | * :ref:`normalize-maps-table` 17 | * `Application Programming Interface `_ 18 | - It can be used to perform analysis by any mathematical operations through programming. Tutorial files with 19 | Jupyter-Notebooks can be downloaded from |tutorial| 20 | 21 | Usage 22 | ----- 23 | 24 | Run ``gcMapExplorer`` command on terminal to get list of all sub-commands. 25 | 26 | **Following sub-commands are available:** 27 | 28 | .. list-table:: Graphical User Interface Applications 29 | :widths: 1, 4 30 | :header-rows: 1 31 | :name: gui-table 32 | 33 | * - Command 34 | - Function 35 | 36 | * - `browser `_ 37 | - Interactive Browser for genomic contact maps 38 | 39 | * - `cmapImporter `_ 40 | - Interface to import contact maps and datasets 41 | 42 | * - `cmapNormalizer `_ 43 | - Interface to normalize contact maps 44 | 45 | * - `h5Converter `_ 46 | - Interface to convert bigWig/wig/bed file to h5 file 47 | 48 | 49 | .. list-table:: Commands to import Hi-C data 50 | :widths: 1, 4 51 | :header-rows: 1 52 | :name: import-hic-command-table 53 | 54 | * - Command 55 | - Function 56 | 57 | * - `coo2cmap `_ 58 | - Import COO sparse matrix format to ccmap or gcmap 59 | 60 | * - `pairCoo2cmap `_ 61 | - Import map from files similar to paired COO format 62 | 63 | * - `homer2cmap `_ 64 | - Import HOMER Hi-C interaction matrix to ccmap or gcmap 65 | 66 | * - `bc2cmap `_ 67 | - Import Bin-Contact format files to ccmap or gcmap 68 | 69 | * - `hic2gcmap `_ 70 | - Import hic to gcmap 71 | 72 | 73 | .. list-table:: Commands to convert bigWig/wig/bed to h5 74 | :widths: 1, 4 75 | :header-rows: 1 76 | :name: convert-to-h5-file-table 77 | 78 | * - Command 79 | - Function 80 | 81 | * - `bigwig2h5 `_ 82 | - Convert a bigWig file to HDF5 format h5 file 83 | 84 | * - `wig2h5 `_ 85 | - Convert a wig file to HDF5 format h5 file 86 | 87 | * - `bed2h5 `_ 88 | - Convert a bed file to HDF5 format h5 file 89 | 90 | * - `encode2h5 `_ 91 | - Download and convert ENCODE datasets to HDF5 format h5 files 92 | 93 | 94 | .. list-table:: Commands to normalize Hi-C map 95 | :widths: 1, 4 96 | :header-rows: 1 97 | :name: normalize-maps-table 98 | 99 | * - Command 100 | - Function 101 | 102 | * - `normKR `_ 103 | - Normalization using Knight-Ruiz matrix balancing 104 | 105 | * - `normVC `_ 106 | - Normalization using Vanilla-Coverage method 107 | 108 | * - `normIC `_ 109 | - Normalization using Iterative Correction 110 | 111 | * - `normMCFS `_ 112 | - Scale maps using Median/Mean Contact Frequency 113 | 114 | 115 | .. list-table:: Commands for Analysis 116 | :widths: 1, 4 117 | :header-rows: 1 118 | 119 | * - Command 120 | - Function 121 | 122 | 123 | * - corrBWcmaps 124 | - Calculate correlation between contact maps 125 | 126 | 127 | .. list-table:: Configuration utility 128 | :widths: 1, 4 129 | :header-rows: 1 130 | 131 | * - Command 132 | - Function 133 | 134 | 135 | * - `config `_ 136 | - To print configuration file and clean scratch directory 137 | 138 | 139 | Command help 140 | ------------ 141 | Run ``gcMapExplorer -h`` command. 142 | 143 | For example: 144 | * ``gcMapExplorer normKR -h`` 145 | * ``gcMapExplorer coo2cmap -h`` 146 | -------------------------------------------------------------------------------- /gcMapExplorer/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from ._version import __version__ 3 | 4 | from . import config 5 | 6 | from .lib import * 7 | 8 | from . import main 9 | -------------------------------------------------------------------------------- /gcMapExplorer/_version.py: -------------------------------------------------------------------------------- 1 | __version__ = '1.0.30' 2 | -------------------------------------------------------------------------------- /gcMapExplorer/clui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/clui/__init__.py -------------------------------------------------------------------------------- /gcMapExplorer/clui/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Author: Rajendra Kumar 4 | # 5 | # This file is part of gcMapExplorer 6 | # Copyright (C) 2016-2017 Rajendra Kumar, Ludvig Lizana, Per Stenberg 7 | # 8 | # gcMapExplorer is a free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # gcMapExplorer is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with gcMapExplorer. If not, see . 20 | # 21 | # ============================================================================= 22 | 23 | import sys 24 | import argparse 25 | 26 | from gcMapExplorer.config import cleanScratch, printConfig 27 | 28 | description = \ 29 | """To print configuration file and clean scratch directory 30 | 31 | This can be used to print configuration file and its content. 32 | 33 | ================================================= 34 | """ 35 | 36 | cleanScratchHelp=\ 37 | """Clean scratch directory 38 | gcMapexplorer try to remove all temporary files present in scracth 39 | directory. However, due to crash and errors, sometimes these files cannot be removed. 40 | Therefore, by this simple command, all temporary files from the scracth directory 41 | is removed. 42 | 43 | Note: Temporary files could be huge and therefore it is advised to run this command periodically. 44 | 45 | Note: Do not use this command when any of the gcMapExplorer tools or module are in execution process. 46 | 47 | """ 48 | 49 | printConfigHelp=\ 50 | """Print configuration file 51 | It will print location configuration file and its content. 52 | 53 | """ 54 | 55 | 56 | def main(): 57 | # Construct command line arguments and parsed it 58 | parser, args = parseArguments() 59 | 60 | if args.cleanScratch: 61 | cleanScratch() 62 | 63 | if args.printConfig: 64 | printConfig() 65 | 66 | def parseArguments(): 67 | parser = argparse.ArgumentParser( 68 | prog='gcMapExplorer config', 69 | description=description, 70 | formatter_class=argparse.RawTextHelpFormatter) 71 | 72 | parser.add_argument('-cs', '--clean-scratch', action='store_true', dest='cleanScratch', 73 | default=False, help=cleanScratchHelp) 74 | 75 | parser.add_argument('-pc', '--print-config', action='store_true', dest='printConfig', 76 | default=False, help=printConfigHelp) 77 | 78 | idx = sys.argv.index("config")+1 79 | args = parser.parse_args(args=sys.argv[idx:]) 80 | 81 | return parser, args 82 | 83 | if __name__ == "__main__": 84 | main() 85 | -------------------------------------------------------------------------------- /gcMapExplorer/clui/hic2gcmap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # This file is part of gcMapExplorer 4 | # Copyright (C) 2016-2018 Rajendra Kumar, Ludvig Lizana, Per Stenberg 5 | # 6 | # gcMapExplorer is a free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # gcMapExplorer is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with gcMapExplorer. If not, see . 18 | # 19 | # ============================================================================= 20 | from argparse import ArgumentParser, ArgumentTypeError 21 | 22 | from gcMapExplorer.lib.hic2gcmap import hic2gcmap 23 | from gcMapExplorer.lib.hicparser import HicFileType, NormType 24 | 25 | 26 | def resolution(string): 27 | if string == "finest": 28 | return string 29 | 30 | if string.endswith("kb"): 31 | string = string[:-2] + "000" 32 | 33 | try: 34 | value = int(string) 35 | except ValueError: 36 | raise ArgumentTypeError("Resolution must be a positive integer or integer ending with 'kb'") 37 | else: 38 | if value <= 0: 39 | raise ArgumentTypeError("Resolution must be a positive integer") 40 | return value 41 | 42 | 43 | def norm(string): 44 | if string == "none": 45 | return None 46 | return NormType(string) 47 | 48 | 49 | def main(): 50 | from os import path 51 | import sys 52 | 53 | parser = ArgumentParser(prog="gcMapExplorer hic2gcmap", description="Convert hic files to gcmap", 54 | allow_abbrev=False) 55 | parser.add_argument("input", type=HicFileType(), help="hic input file") 56 | parser.add_argument("output", type=str, nargs="?", help="output file or directory", default=".") 57 | group = parser.add_mutually_exclusive_group() 58 | group.add_argument("-c", "--chromosomes", type=str, nargs=2, metavar=("A", "B"), help="a pair of chromosomes A B") 59 | group.add_argument("-l", "--list", action="store_true", help="list all available chromosomes") 60 | parser.add_argument("--compression", type=str, choices=("lzf", "gzip"), default="lzf", metavar="C", 61 | help="compression type, choose between lzf, gzip (default: lzf)") 62 | parser.add_argument("-r", "--resolution", type=resolution, default="finest", metavar="R", 63 | help="the resolution, as an integer or as kb (default: finest)") 64 | parser.add_argument("-n", "--norm", type=str, choices=("VC", "VC_SQRT", "KR", "none"), metavar="N", 65 | default="none", 66 | help="the type of norm to use, choose between VC, VC_SQRT, KR, none (default: none)") 67 | parser.add_argument("--downsampling", type=str, choices=("sum", "mean", "max", "none"), default="sum", metavar="D", 68 | help="the downsampling method to use, choose between sum, mean, max, none (default: sum)") 69 | 70 | args = parser.parse_args(args=sys.argv[sys.argv.index("hic2gcmap") + 1:]) 71 | 72 | hic = args.input 73 | 74 | if args.list: 75 | print(", ".join(hic.chromosomes)) 76 | return 77 | 78 | if path.isdir(args.output): 79 | filename = path.splitext(path.basename(args.input.name))[0] 80 | output_file = path.join(args.output, filename) 81 | if args.chromosomes: 82 | output_file += "_" + "_".join(args.chromosomes) 83 | if args.downsampling == "none" and args.resolution != "finest": 84 | output_file += "_" + str(args.resolution)[:-3] + "kb" 85 | if args.norm != "none": 86 | output_file += "_" + args.norm 87 | output_file += "_" + args.compression 88 | output_file += ".gcmap" 89 | else: 90 | output_file = args.output 91 | 92 | if args.chromosomes: 93 | chr1, chr2 = args.chromosomes 94 | try: 95 | hic2gcmap(hic, chr1, chr2, output_file, resolution=args.resolution, norm_type=norm(args.norm), 96 | compression=args.compression, 97 | downsampling=args.downsampling) 98 | except Exception as e: 99 | print("Error: {}".format(e)) 100 | else: # all chromosomes 101 | chromosome_names = filter(lambda pair: "All" not in pair, (hic.chromosome_names(r) for r in hic.records)) 102 | for chr1, chr2 in chromosome_names: 103 | try: 104 | hic2gcmap(hic, chr1, chr2, output_file, resolution=args.resolution, norm_type=norm(args.norm), 105 | compression=args.compression, 106 | downsampling=args.downsampling) 107 | except Exception as e: 108 | print("Error: {}".format(e)) 109 | 110 | 111 | if __name__ == "__main__": 112 | main() 113 | -------------------------------------------------------------------------------- /gcMapExplorer/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Author: Rajendra Kumar 4 | # 5 | # This file is part of gcMapExplorer 6 | # Copyright (C) 2016-2017 Rajendra Kumar, Ludvig Lizana, Per Stenberg 7 | # 8 | # gcMapExplorer is a free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # gcMapExplorer is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with gcMapExplorer. If not, see . 20 | # 21 | #============================================================================= 22 | 23 | import os, re, sys 24 | import tempfile 25 | import configparser 26 | from appdirs import system 27 | from appdirs import AppDirs 28 | import psutil 29 | 30 | 31 | defaultConfigText=""" 32 | [Dirs] 33 | WorkingDirectory = {0} 34 | 35 | [Programs] 36 | bigWigInfo = None 37 | bigWigToWig = None 38 | 39 | """.format(tempfile.gettempdir()) 40 | 41 | configAppDirs = AppDirs('gcMapExplorer') 42 | 43 | if system == 'win32': 44 | configFileName = 'gcMapExplorer.ini' 45 | else: 46 | configFileName = 'gcMapExplorer.conf' 47 | 48 | configFile = os.path.join(configAppDirs.user_config_dir, configFileName) 49 | 50 | 51 | def _defaultConfiguration(): 52 | config = configparser.ConfigParser() 53 | config.read_string(defaultConfigText) 54 | return config 55 | 56 | def updateConfig(section, option, value): 57 | """ Update configuration file 58 | 59 | Parameters 60 | ---------- 61 | section : str 62 | Section of the configuration files. It could be ``Dirs`` or ``Programs``. 63 | option : str 64 | Input option, for which value is to be changed. 65 | value : str or int 66 | New value of the input option. 67 | """ 68 | 69 | config = getConfig() 70 | 71 | if section not in config: 72 | return 73 | if option not in config[section]: 74 | return 75 | 76 | config[section][option] = value 77 | 78 | with open(configFile, 'w') as fout: 79 | config.write(fout) 80 | 81 | def getConfig(): 82 | """ To get the present configuration. 83 | 84 | Configuration file has the following organization. 85 | 86 | :: 87 | 88 | Configuration 89 | ├─────────── Dirs 90 | │ └──────── WorkingDirectory 91 | │ 92 | └─────────── Programs 93 | ├──────── bigWigInfo 94 | └──────── bigWigToWig 95 | 96 | 97 | In case no configuration file is found, a new file is generated and default 98 | value is assigned to each option. 99 | 100 | Returns 101 | ------- 102 | config : dict 103 | Dictionary of Dictionaries with option name and value pair. 104 | For example, config['Dirs']['WorkingDirectory'] contains path to 105 | scratch directory. Similarly, config['Programs']['bigWigInfo'] 106 | contains path to bigWigInfo program. 107 | 108 | 109 | """ 110 | if not os.path.exists(configFile): 111 | 112 | if not os.path.exists(configAppDirs.user_config_dir): 113 | try: 114 | os.makedirs(configAppDirs.user_config_dir) 115 | except OSError: 116 | pass 117 | 118 | 119 | config = _defaultConfiguration() 120 | print(" No configuration file found... Generating a new configuration file with default values as follows:") 121 | print("==============================") 122 | print("Configuration file: {0}".format(configFile)) 123 | print("==============================") 124 | config.write(sys.stdout) 125 | print("==============================") 126 | 127 | with open(configFile, 'w') as fout: 128 | config.write(fout) 129 | 130 | else: 131 | config = configparser.ConfigParser() 132 | config.read(configFile) 133 | 134 | return config 135 | 136 | def printConfig(): 137 | """Print configuration file 138 | 139 | It can be used to print the configuration file. It shows the current 140 | configuration of gcMapExplorer. 141 | 142 | """ 143 | config = getConfig() 144 | print("==============================") 145 | print("Configuration file: {0}".format(configFile)) 146 | print("==============================") 147 | config.write(sys.stdout) 148 | print("==============================") 149 | 150 | 151 | def cleanScratch(): 152 | """ Clean scratch directory. 153 | 154 | It checks whether any other gcMapExplorer process is running. In case, 155 | when only one process (i.e. current) is running, all files with "gcx" 156 | prefix will be deleted from default scratch directory. 157 | 158 | """ 159 | config = getConfig() 160 | count = 0 161 | for pid in psutil.pids(): 162 | p = None 163 | try: 164 | p = psutil.Process(pid) 165 | except psutil.NoSuchProcess: 166 | pass 167 | 168 | if p is not None: 169 | if 'gcMapExplorer' in p.name(): 170 | count += 1 171 | 172 | # If only one gcMapExplorer is running, it is the current one 173 | if count == 1: 174 | for f in os.listdir(config['Dirs']['WorkingDirectory']): 175 | 176 | fname = os.path.join(config['Dirs']['WorkingDirectory'], f) 177 | if not os.path.isfile(fname): 178 | continue 179 | basename = os.path.basename(fname) 180 | base = os.path.splitext(basename)[0] 181 | if "gcx" in base: 182 | try: 183 | print(' Removing File: {0}'.format(fname)) 184 | os.remove(fname) 185 | except IOError: 186 | pass 187 | 188 | print(' ... Finished Cleaning') 189 | -------------------------------------------------------------------------------- /gcMapExplorer/gui/UIs/aboutBrowser.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 560 10 | 350 11 | 12 | 13 | 14 | 15 | 560 16 | 350 17 | 18 | 19 | 20 | 21 | 560 22 | 350 23 | 24 | 25 | 26 | About Browser 27 | 28 | 29 | 30 | 31 | 32 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 33 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 34 | p, li { white-space: pre-wrap; } 35 | </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> 36 | <p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:14pt; font-weight:600;">Genome Contact Map Explorer (gcMapExplorer) Browser</span></p> 37 | <p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:11pt;">Copyright (C) 2016-2018 Rajendra Kumar, Ludvig Lizana, Per Stenberg</span></p> 38 | <p align="justify" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">It is a browser to visualize the contact maps that are generated from Hi-C experiments. It can be used for </span><span style=" font-family:'Sans Serif'; font-weight:600;">Comparative</span><span style=" font-family:'Sans Serif';"> and </span><span style=" font-family:'Sans Serif'; font-weight:600;">Interactive</span><span style=" font-family:'Sans Serif';"> visualization of two dimensional contact maps along with genomic datasets such as produced by DNase-seq, ChIP-seq, RNA-seq etc.</span></p> 39 | <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-weight:600;">Author:</span><span style=" font-family:'Sans Serif';"> Rajendra Kumar, ICE Lab, Department of Physics, Umeå University, Umeå, Sweden.</span></p> 40 | <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-weight:600;">Source-code:</span><span style=" font-family:'Sans Serif';"> </span><a href="https://github.com/rjdkmr/gcMapExplorer"><span style=" font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;">https://github.com/rjdkmr/gcMapExplorer</span></a></p> 41 | <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-weight:600;">Website</span><span style=" font-family:'Sans Serif';">: </span><a href="http://gcmapexplorer.readthedocs.io"><span style=" font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;">http://gcmapexplorer.readthedocs.io</span></a></p></body></html> 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Qt::Horizontal 51 | 52 | 53 | 54 | 40 55 | 20 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | OK 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /gcMapExplorer/gui/UIs/textFileSelector.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 200 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 400 22 | 200 23 | 24 | 25 | 26 | 27 | 400 28 | 200 29 | 30 | 31 | 32 | Select File and Plot Position 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | File Name: 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Title: 62 | 63 | 64 | 65 | 66 | 67 | 68 | Genomic Data 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Plot Position: 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Bottom 88 | 89 | 90 | 91 | 92 | Top 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Qt::Horizontal 101 | 102 | 103 | 104 | 40 105 | 20 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /gcMapExplorer/gui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/__init__.py -------------------------------------------------------------------------------- /gcMapExplorer/gui/guiHelpers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Author: Rajendra Kumar 4 | # 5 | # This file is part of gcMapExplorer 6 | # Copyright (C) 2016-2017 Rajendra Kumar, Ludvig Lizana, Per Stenberg 7 | # 8 | # gcMapExplorer is a free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # gcMapExplorer is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with gcMapExplorer. If not, see . 20 | # 21 | #============================================================================= 22 | 23 | import logging 24 | import os 25 | 26 | from PyQt5.QtWidgets import * 27 | from PyQt5.QtCore import * 28 | from PyQt5.QtGui import * 29 | from PyQt5.uic import loadUiType 30 | 31 | 32 | '''Show this directory in file-dialog''' 33 | lastVisitedDir = os.getcwd() 34 | 35 | # Determine absolute path to UIs directory. Relative path from this directory does not work. 36 | DirToThisScript = os.path.dirname(os.path.abspath(__file__)) 37 | PathToUIs = os.path.join(DirToThisScript, 'UIs') 38 | 39 | ## To divert log output into QPlainTextWidget 40 | class pyQtLogHandler(QObject, logging.Handler): 41 | messageEmitted = pyqtSignal( str ) 42 | def __init__(self): 43 | super().__init__() 44 | self.setFormatter(logging.Formatter('%(levelname)s:%(name)s:%(message)s')) 45 | 46 | def emit(self, record): 47 | msg = self.format(record) 48 | self.messageEmitted.emit(msg) 49 | 50 | class qtThread(QThread): 51 | resultReady = pyqtSignal() 52 | 53 | def __init__(self, parent=None, target=None, args=(), kwargs=None): 54 | super(qtThread, self).__init__(parent) 55 | self.results = None 56 | self._target = target 57 | self._args = args 58 | self._kwargs = kwargs 59 | 60 | 61 | def callRun(self): 62 | try: 63 | if self._target: 64 | if self._kwargs is not None: 65 | self.results = self._target(*self._args, **self._kwargs) 66 | else: 67 | self.results = self._target(*self._args) 68 | finally: 69 | # Avoid a refcycle if the thread is running a function with 70 | # an argument that has a member that points to the thread. 71 | del self._target, self._args, self._kwargs 72 | 73 | self.resultReady.emit() 74 | 75 | def run(self): 76 | self.callRun() 77 | 78 | 79 | def qThreadTerminated(): 80 | currentThread = qtThread.currentThread() 81 | if currentThread is not None: 82 | if currentThread.isInterruptionRequested(): 83 | return True 84 | else: 85 | return False 86 | else: 87 | return False 88 | 89 | 90 | def getSelectedRowColumnFromTable(table): 91 | # Total number of row 92 | r = table.rowCount() 93 | c = table.columnCount() 94 | 95 | # Determine which cell of row is selected 96 | selectedRow = None 97 | selectedCol = None 98 | for i in range(r): 99 | for j in range(c): 100 | if table.item(i, j) is None: 101 | table.setItem( i, j, QTableWidgetItem(0) ) 102 | 103 | if table.item(i, j).isSelected(): 104 | selectedRow = i 105 | selectedCol = j 106 | break 107 | 108 | return selectedRow, selectedCol 109 | 110 | def checkFileExist(lineEdit, qwidget): 111 | if not lineEdit.text(): return 112 | filename = str( lineEdit.text() ) 113 | if not os.path.isfile( filename ): 114 | msg = "[ {0} ] \n Not found !!!".format(filename) 115 | msgBox = QMessageBox(QMessageBox.Warning, 'Warning', msg, 116 | QMessageBox.Ok, qwidget) 117 | msgBox.exec_() 118 | msgBox.close() 119 | 120 | lineEdit.undo() 121 | lineEdit.setFocus() 122 | 123 | def checkDirExist(lineEdit, qwidget): 124 | if not lineEdit.text(): return 125 | dirname = str( lineEdit.text() ) 126 | if not os.path.isdir( dirname ): 127 | msg = "[ {0} ] \n Not found !!!".format(dirname) 128 | msgBox = QMessageBox(QMessageBox.Warning, 'Warning', msg, 129 | QMessageBox.Ok, qwidget) 130 | msgBox.exec_() 131 | msgBox.close() 132 | 133 | lineEdit.undo() 134 | lineEdit.setFocus() 135 | 136 | def showWarningMessageBox(msg, qwidget): 137 | msgBox = QMessageBox(QMessageBox.Warning, 'Warning', msg, QMessageBox.Ok, qwidget) 138 | msgBox.exec_() 139 | msgBox.close() 140 | 141 | def constrainValueInLineEdit(qwidget, lineEdit, minvalue, maxvalue,): 142 | """ Whether value in a lineEdit is within limit. 143 | 144 | It checks whether value in a lineEdit is between the limit, otherwise 145 | throw a warning to user. 146 | 147 | """ 148 | value = float(lineEdit.text()) 149 | 150 | if not value: return 151 | 152 | if value > maxvalue or value < minvalue: 153 | msg = "Value should be between {0} and {1} !!!".format(minvalue, maxvalue) 154 | msgBox = QMessageBox(QMessageBox.Warning, 'Warning', msg, 155 | QMessageBox.Ok, qwidget) 156 | msgBox.exec_() 157 | msgBox.close() 158 | 159 | lineEdit.selectAll() 160 | lineEdit.setFocus() 161 | 162 | def getFileExtension(name): 163 | return os.path.splitext(name)[1] 164 | -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/afmhot.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/afmhot.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/afmhot_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/afmhot_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/autumn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/autumn.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/autumn_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/autumn_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/blue_green.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/blue_green.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/blue_purple.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/blue_purple.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/blues.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/blues.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/bone.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/bone.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/bone_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/bone_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/cool.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/cool.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/cool_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/cool_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/copper.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/copper.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/copper_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/copper_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/gist_heat.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/gist_heat.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/gist_heat_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/gist_heat_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/gray.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/gray.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/gray_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/gray_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/green_blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/green_blue.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/greens.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/greens.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/greys.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/greys.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/hot.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/hot.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/hot_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/hot_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/oranges.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/oranges.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/oranges_red.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/oranges_red.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/pink.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/pink.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/pink_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/pink_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/purple_blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/purple_blue.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/purple_blue_green.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/purple_blue_green.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/purple_red.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/purple_red.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/purples.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/purples.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/red_purples.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/red_purples.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/reds.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/reds.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/spring.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/spring.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/spring_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/spring_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/summer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/summer.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/summer_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/summer_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/winter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/winter.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/winter_r.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/winter_r.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/yellow_green.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/yellow_green.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/yellow_green_blue.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/yellow_green_blue.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/yellow_orange_brown.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/yellow_orange_brown.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/cmaps/yellow_orange_red.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/cmaps/yellow_orange_red.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/downArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/downArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/downArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/downArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/fitPlotsTight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/fitPlotsTight.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/gotoPlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/gotoPlay.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/hspaceDecrement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/hspaceDecrement.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/hspaceIncrement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/hspaceIncrement.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftDownArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftDownArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftDownArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftDownArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftUpArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftUpArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/leftUpArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/leftUpArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/resetArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/resetArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/resetArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/resetArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightDownArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightDownArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightDownArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightDownArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightUpArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightUpArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/rightUpArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/rightUpArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/upArrow.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/upArrow.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/upArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/upArrow.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/vspaceDecrement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/vspaceDecrement.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/vspaceIncrement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/vspaceIncrement.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/zoomIn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/zoomIn.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/zoomIn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/zoomIn.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/zoomOut.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/zoomOut.ico -------------------------------------------------------------------------------- /gcMapExplorer/gui/icons/zoomOut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjdkmr/gcMapExplorer/c33a1ef13d4edc8212be423ac7470af8d48ac5d5/gcMapExplorer/gui/icons/zoomOut.png -------------------------------------------------------------------------------- /gcMapExplorer/gui/qtStyle.qss: -------------------------------------------------------------------------------- 1 | QWidget { 2 | color: #FFFFFF; 3 | background-color: #3A3A3A; 4 | } 5 | 6 | QPushButton { 7 | color: #000000; 8 | border: 1px solid #FFAA00; 9 | border-radius: 6px; 10 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFAA00, stop: 1 #A46D00); 11 | min-width: 90px; 12 | min-height: 20px; 13 | } 14 | 15 | QPushButton:pressed { 16 | color: #FFFFFF; 17 | border: 1px solid #FFAA00; 18 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #767676 , stop: 1 #303030 ); 19 | } 20 | 21 | QPushButton:flat { 22 | border: 1px solid #FFAA00; 23 | } 24 | 25 | QPushButton:default { 26 | border-color: #00FF00; /* make the default button prominent */ 27 | } 28 | 29 | QToolButton { 30 | color: #000000; 31 | border: 1px solid #FFAA00; 32 | border-radius: 6px; 33 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFAA00, stop: 1 #A46D00); 34 | min-height: 20px; 35 | } 36 | 37 | QToolButton:pressed { 38 | color: #FFFFFF; 39 | border: 1px solid #FFAA00; 40 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #767676 , stop: 1 #303030 ); 41 | } 42 | 43 | QToolButton:checked { 44 | color: #FFFFFF; 45 | border: 1px solid #FFAA00; 46 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #767676 , stop: 1 #303030 ); 47 | } 48 | 49 | QToolButton:hover { 50 | color: #FFFFFF; 51 | border: 1px solid #FFAA00; 52 | background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #767676 , stop: 1 #303030 ); 53 | } 54 | 55 | QToolButton:flat { 56 | border: 1px solid #FFAA00; 57 | } 58 | 59 | QToolButton:default { 60 | border-color: #00FF00; /* make the default button prominent */ 61 | } 62 | 63 | QLabel { 64 | padding: 2px; 65 | color: #FFFFFF; 66 | } 67 | 68 | QAbstractScrollArea { 69 | background-color: qlineargradient(x0: 1, y1: 0, x2: 0, y2: 1, stop: 0 #585858 , stop: 1 #444444 ); 70 | border: 1px solid #767676; 71 | color: #FFFFFF; 72 | } 73 | -------------------------------------------------------------------------------- /gcMapExplorer/lib/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = [ 'ccmap', 2 | 'gcmap', 3 | 'importer', 4 | 'ccmapHelpers', 5 | 'cmstats', 6 | 'normalizer', 7 | 'normalizeKnightRuiz', 8 | 'genomicsDataHandler', 9 | 'corrMatrix', 10 | 'statDist', 11 | 'compartments'] 12 | -------------------------------------------------------------------------------- /gcMapExplorer/lib/compartments.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Author: Rajendra Kumar 4 | # 5 | # This file is part of gcMapExplorer 6 | # Copyright (C) 2016-2017 Rajendra Kumar, Ludvig Lizana, Per Stenberg 7 | # 8 | # gcMapExplorer is a free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # gcMapExplorer is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with gcMapExplorer. If not, see . 20 | # 21 | #============================================================================= 22 | 23 | import gcMapExplorer.lib as gmlib 24 | import numpy as np 25 | from sklearn.cluster import KMeans, AgglomerativeClustering 26 | from sklearn.decomposition import PCA 27 | 28 | def correctForPeaks(matrix, pc, correctionFactor): 29 | negIdx = np.nonzero(pc < 0) 30 | posIdx = np.nonzero(pc > 0) 31 | 32 | for i in range(matrix.shape[0]): 33 | posSum = np.median(matrix[i][posIdx]) 34 | negSum = np.median(matrix[i][negIdx]) 35 | 36 | # print(posSum, negSum, pc[i]) 37 | factor = 1 38 | if posSum > negSum * correctionFactor and pc[i] < 0: 39 | factor = -1 40 | # print(i, posSum, negSum) 41 | 42 | if negSum > posSum * correctionFactor and pc[i] > 0: 43 | factor = -1 44 | # print(i, posSum, negSum) 45 | 46 | pc[i] = pc[i] * factor 47 | 48 | return pc 49 | 50 | 51 | def calculateCompartments(ccmap, method='k-means', peakCorrectionFactor=None): 52 | if method not in ['k-means', 'hierarchical', 'PCA']: 53 | raise ValueError('Method should be : {0}'.format(['k-means', 'hierarchical'])) 54 | 55 | ccmap.make_readable() 56 | matrix = (ccmap.matrix[~ccmap.bNoData, :])[:, ~ccmap.bNoData] # Selected row-column which are not all zeros 57 | matrix[np.isnan(matrix)] = 0 58 | 59 | if method == 'k-means': 60 | cls = KMeans(n_clusters=2).fit(matrix) 61 | 62 | if method == 'hierarchical': 63 | cls = AgglomerativeClustering(n_clusters=2).fit(matrix) 64 | 65 | if method in ['k-means', 'hierarchical']: 66 | labels = cls.labels_[:] 67 | labels[np.nonzero(labels == 0)] = -1 68 | 69 | if method == 'PCA': 70 | pca = PCA(n_components=2) 71 | pca.fit(matrix) 72 | t_pc = pca.transform(matrix) 73 | labels = t_pc.T[0][:] 74 | 75 | # Correction for wrong peaks 76 | if peakCorrectionFactor is not None: 77 | labels = correctForPeaks(matrix, labels, peakCorrectionFactor) 78 | 79 | j = 0 80 | compartment = np.zeros((ccmap.matrix.shape[0],)) 81 | for i in range(ccmap.matrix.shape[0]): 82 | if not ccmap.bNoData[i]: 83 | compartment[i] = labels[j] 84 | j = j + 1 85 | 86 | return compartment 87 | 88 | 89 | def determineABforGCMap(gcMapInputFile, h5OutFile, minResolution, method='k-means', peakCorrectionFactor=None, 90 | compression='lzf', workDir=None, logHandler=None): 91 | if method not in ['k-means', 'hierarchical', 'PCA']: 92 | raise ValueError('Method should be : {0}'.format(['k-means', 'hierarchical'])) 93 | 94 | # Get list of maps in ascending order 95 | gcmap = gmlib.gcmap.GCMAP(gcMapInputFile) 96 | gcmap.loadSmallestMap() 97 | mapList = gcmap.mapNameList.copy() 98 | 99 | hdf5Handle = gmlib.genomicsDataHandler.HDF5Handler(h5OutFile) 100 | hdf5Handle.open() 101 | 102 | minBinsize = gmlib.ccmap.resolutionToBinsize(minResolution) 103 | 104 | for mapName in mapList: 105 | 106 | print(mapName) 107 | 108 | # Iterate over available resolutions 109 | gcmap.changeMap(mapName) 110 | 111 | while minBinsize > gmlib.ccmap.resolutionToBinsize(gcmap.resolution): 112 | gcmap.toCoarserResolution() 113 | 114 | previousResolution = gcmap.resolution 115 | 116 | while True: 117 | ccMap = gmlib.gcmap.loadGCMapAsCCMap(gcmap.hdf5, mapName=mapName, resolution=gcmap.resolution, 118 | workDir=workDir) 119 | data = calculateCompartments(ccMap, method=method, peakCorrectionFactor=peakCorrectionFactor) 120 | del ccMap 121 | 122 | if peakCorrectionFactor is not None: 123 | name = 'Compartment by ' + str(method) + ' ' + str(peakCorrectionFactor) 124 | else: 125 | name = 'Compartment by ' + str(method) 126 | 127 | hdf5Handle.addDataByArray(mapName, gcmap.resolution, name, data, compression=compression) 128 | 129 | gcmap.toCoarserResolution() 130 | if previousResolution == gcmap.resolution: 131 | break 132 | else: 133 | previousResolution = gcmap.resolution 134 | 135 | del gcmap 136 | del hdf5Handle -------------------------------------------------------------------------------- /gcMapExplorer/lib/corrMatrixCoreSRC.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "corrMatrixCoreSRC.h" 7 | 8 | int _correlationMatrix(double *in_array, double *out_array, int size, double *maskvalue) 9 | { 10 | double **in, **out, r = 0.0, random =0; 11 | int i=0, j=0, counter =0, nthreads, chunk = 50; 12 | 13 | // Convert 1D array to 2D array by pointers 14 | in = (double**) malloc(size * sizeof(double*)); 15 | out = (double**) malloc(size * sizeof(double*)); 16 | for(i=0; i 3) 173 | { 174 | xmean = xsum/counter; 175 | ymean = ysum/counter; 176 | 177 | for(i=0;i. 20 | # 21 | #============================================================================= 22 | 23 | import numpy as np 24 | 25 | from . import util 26 | 27 | # This method normalize the raw contact map by removing biases from experimental procedure. 28 | # For more details, see `this publication `_. 29 | # 30 | # Steps are taken from supporting information. 31 | # Below only double-sided (DS) reads only version is implemented, therefore 32 | # terms with SS are not present here. For example Steps 2 and 3 is not present. 33 | 34 | def performIterativeCorrection(matrix, tol, iteration): 35 | count = 0 36 | contact_count = np.sum(matrix) 37 | B = np.ones((matrix.shape[0],1), dtype=np.float) # Step - 0 38 | prev_B = None 39 | 40 | # Step - 8, Repeat steps 1-7 until variance of dB becomes negligible. 41 | while True: 42 | dB = np.sum(matrix, axis=0) # Step - 1, Sum over rows 43 | dB = dB.reshape((matrix.shape[0],1)) 44 | dB = dB/np.mean(dB[dB != 0]) # Step - 4, Renormalization by mean value 45 | dB[dB == 0] = 1 # Step - 5, Set zeros value to one 46 | 47 | # Step - 6, Divide W_ij by dB_i dB_j 48 | matrix /= dB 49 | matrix /= dB.T 50 | 51 | B = B * dB # Step - 7 52 | B *= np.sqrt(np.sum(matrix) / contact_count) 53 | matrix *= contact_count / np.sum(matrix) 54 | 55 | if prev_B is not None: 56 | if np.abs(prev_B - B).sum() < tol or count > iteration: 57 | break 58 | 59 | count = count + 1 60 | prev_B = B.copy() 61 | 62 | # Vanilla coverage normalization 63 | def performVCNormalization(A, Out=None, sqroot=False, bNoData=None): 64 | mshape = A.shape 65 | 66 | toReturn = False 67 | 68 | if Out is None: 69 | Out = np.zeros(A.shape, dtype=A.dtype) 70 | toReturn = True 71 | 72 | csum = np.sum(A, axis=1) 73 | for m in range(mshape[0]): 74 | if bNoData is not None: 75 | if bNoData[m]: 76 | continue 77 | Out[m] = (A[m] / csum[m])[:] 78 | 79 | for m in range(mshape[0]): 80 | if bNoData is not None: 81 | if bNoData[m]: 82 | continue 83 | Out[:, m] = (Out[:,m] / csum[m])[:] 84 | 85 | if sqroot: 86 | Out[:] = np.sqrt(Out[:]) 87 | 88 | if toReturn: 89 | return Out 90 | 91 | def normalizeByAvgContactByDivision(A, avgContacts, Out=None): 92 | mshape = A.shape 93 | 94 | toReturn = False 95 | 96 | if Out is None: 97 | Out = np.zeros(A.shape, dtype=A.dtype) 98 | toReturn = True 99 | 100 | # Do along diagonal 101 | for m in range(mshape[0]): 102 | 103 | # do for postive diagonal offset 104 | idx = util.kth_diag_indices(m, A) 105 | if avgContacts[m] != 0: 106 | Out[idx] = A[idx] / avgContacts[m] 107 | else: 108 | Out[idx] = A[idx] 109 | 110 | # Do for negative diagonal offset 111 | del idx 112 | if m != 0: 113 | idx = util.kth_diag_indices(m*-1, A) 114 | if avgContacts[m] != 0: 115 | Out[idx] = A[idx] / avgContacts[m] 116 | else: 117 | Out[idx] = A[idx] 118 | del idx 119 | 120 | if toReturn: 121 | return Out 122 | 123 | def normalizeByAvgContactBySubtraction(A, avgContacts, Out=None): 124 | mshape = A.shape 125 | 126 | toReturn = False 127 | 128 | if Out is None: 129 | Out = np.zeros(A.shape, dtype=A.dtype) 130 | toReturn = True 131 | 132 | # Do along diagonal 133 | for m in range(mshape[0]): 134 | 135 | # do for postive diagonal offset 136 | idx = util.kth_diag_indices(m, A) 137 | if avgContacts[m] != 0: 138 | values = A[idx] - avgContacts[m] 139 | vidx = np.nonzero( values < 0) 140 | if vidx[0].shape[0] > 0: 141 | values[vidx] = np.ones(vidx[0].shape) 142 | vidx = np.nonzero( A[idx] == 0) 143 | if vidx[0].shape[0] > 0: 144 | values[vidx] = np.zeros(vidx[0].shape) 145 | 146 | Out[idx] = values 147 | 148 | else: 149 | Out[idx] = A[idx] 150 | 151 | # Do for negative diagonal offset 152 | del idx 153 | if m != 0: 154 | idx = util.kth_diag_indices(m*-1, A) 155 | if avgContacts[m] != 0: 156 | values = A[idx] - avgContacts[m] 157 | vidx = np.nonzero( values < 0) 158 | if vidx[0].shape[0] > 0: 159 | values[vidx] = np.ones(vidx[0].shape) 160 | vidx = np.nonzero( A[idx] == 0) 161 | if vidx[0].shape[0] > 0: 162 | values[vidx] = np.zeros(vidx[0].shape) 163 | 164 | Out[idx] = values 165 | else: 166 | Out[idx] = A[idx] 167 | del idx 168 | 169 | if toReturn: 170 | return Out 171 | -------------------------------------------------------------------------------- /gcMapExplorer/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Author: Rajendra Kumar 4 | # 5 | # This file is part of gcMapExplorer 6 | # Copyright (C) 2016-2017 Rajendra Kumar, Ludvig Lizana, Per Stenberg 7 | # 8 | # gcMapExplorer is a free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # gcMapExplorer is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with gcMapExplorer. If not, see . 20 | # 21 | #============================================================================= 22 | 23 | import sys, os, random 24 | import numpy as np 25 | import logging 26 | 27 | from .config import cleanScratch 28 | 29 | # Set logging level 30 | logging.basicConfig(level=logging.INFO) 31 | 32 | gui_tools = ['browser', 'cmapImporter', 'cmapNormalizer', 'h5Converter'] 33 | convert_tools = ['coo2cmap', 'pairCoo2cmap', 'homer2cmap', 'bc2cmap', 'hic2gcmap', 'bigwig2h5', 'wig2h5', 'bed2h5', 'encode2h5'] 34 | norm_tools = ['normKR', 'normVC', 'normIC', 'normMCFS'] 35 | analysis_tools = ['corrBWcmaps'] 36 | utility_tools = ['config'] 37 | 38 | def main(): 39 | options = {'browser':'Interactive Browser for genomic contact maps', 40 | 'cmapImporter':'Interface to import contact maps and datasets', 41 | 'cmapNormalizer' : 'Interface to normalize contact maps', 42 | 'h5Converter' : 'Convert bigWig/wig/bed file to browser compatible h5 format', 43 | 'coo2cmap':'Import COO sparse matrix format to ccmap or gcmap', 44 | 'pairCoo2cmap': 'Import map from files similar to paired sparse matrix Coordinate (COO) format', 45 | 'homer2cmap':'Import HOMER Hi-C interaction matrix to ccmap or gcmap', 46 | 'bc2cmap': 'Import Bin-Contact format files to ccmap or gcmap', 47 | 'hic2gcmap': 'Import hic file to gcmap', 48 | 'bigwig2h5': 'Import a bigWig file to browser compatible h5 format', 49 | 'wig2h5': 'Import a wig file to browser compatible h5 format', 50 | 'bed2h5' : 'Import a bed file to browser compatible h5 format', 51 | 'encode2h5' : 'Download and convert datasets from ENCODE project', 52 | 'normKR' : 'Normalization using Knight-Ruiz matrix balancing', 53 | 'normVC' : 'Normalization using Vanilla-Coverage method', 54 | 'normIC' : 'Normalization using Iterative Correction', 55 | 'normMCFS' : 'Normalization by Median Contact Frequency Scaling', 56 | 'corrBWcmaps' : 'Calculate correlation between contact maps', 57 | 'config': 'To print configuration file and clean scratch directory'} 58 | 59 | if len(sys.argv)<=1: 60 | show_help(options) 61 | sys.exit(-1) 62 | if sys.argv[1] not in options: 63 | print(' ERROR: "{0}" is not an accepted option.\n' .format(sys.argv[1])) 64 | show_help(options) 65 | sys.exit(-1) 66 | 67 | if sys.argv[1] == 'config': 68 | from .clui import config 69 | config.main() 70 | 71 | if sys.argv[1] == 'browser': 72 | from .gui import browser 73 | browser.main() 74 | 75 | if sys.argv[1] == 'cmapImporter': 76 | from .gui import importer_ui as impui 77 | impui.main() 78 | 79 | if sys.argv[1] == 'cmapNormalizer': 80 | from .gui import normalizer_ui 81 | normalizer_ui.main() 82 | 83 | if sys.argv[1] == 'h5Converter': 84 | from .gui import h5Converter 85 | h5Converter.main() 86 | 87 | if sys.argv[1] == 'coo2cmap': 88 | from .clui import coo2cmap 89 | coo2cmap.main() 90 | 91 | if sys.argv[1] == 'pairCoo2cmap': 92 | from .clui import pairCoo2cmap 93 | pairCoo2cmap.main() 94 | 95 | if sys.argv[1] == 'homer2cmap': 96 | from .clui import homer2cmap 97 | homer2cmap.main() 98 | 99 | if sys.argv[1] == 'bc2cmap': 100 | from .clui import bc2cmap 101 | bc2cmap.main() 102 | 103 | if sys.argv[1] == 'hic2gcmap': 104 | from .clui import hic2gcmap 105 | hic2gcmap.main() 106 | 107 | if sys.argv[1] == 'bigwig2h5': 108 | from .clui import bigwig2h5 109 | bigwig2h5.main() 110 | 111 | if sys.argv[1] == 'wig2h5': 112 | from .clui import wig2h5 113 | wig2h5.main() 114 | 115 | if sys.argv[1] == 'bed2h5': 116 | from .clui import bed2h5 117 | bed2h5.main() 118 | 119 | if sys.argv[1] == 'encode2h5': 120 | from .clui import encode2h5 121 | encode2h5.main() 122 | 123 | if sys.argv[1] == 'normKR': 124 | from .clui import normKR 125 | normKR.main() 126 | 127 | if sys.argv[1] == 'normVC': 128 | from .clui import normVC 129 | normVC.main() 130 | 131 | if sys.argv[1] == 'normIC': 132 | from .clui import normIC 133 | normIC.main() 134 | 135 | if sys.argv[1] == 'normMCFS': 136 | from .clui import normMCFS 137 | normMCFS.main() 138 | 139 | if sys.argv[1] == 'corrBWcmaps': 140 | from .clui import corrBWcmaps 141 | corrBWcmaps.main() 142 | 143 | def show_help(options): 144 | print(' ==============================') 145 | print(' Usage:') 146 | print(' gcMapExplorer