Package: sfimpute
SnapFISH-IMPUTE: an imputation method for multiplexed DNA FISH dataSnapFISH-IMPUTE fills in the missing 3D coordinates of imaging loci in multiplexed DNA FISH data.InstallationSnapFISH-IMPUTE is available on PyPI and can be installed throughpip. To create a virtual environment before installation, use eitherconda:condacreate--namesfimpute_envpython==3.9.1
condaactivatesfimpute_env
pipinstallsfimputeor if on a computing cluster:moduleloadpython/3.9.1
python-mvenv/PATH/TO/ENVsource/PATH/TO/ENV/bin/activate
pipinstallsfimputeAlthoughMPIandmpi4pyare needed to run the imputation module, the package onPyPIis independent ofMPI, so you can still call functions in SnapFISH-IMPUTE even if MPI is not available.To installmpi4py, please follow the instructions inthis link.UsageImputationTo run the imputation module on a computing cluster, downloadrun_impute.pyand include the following command when submitting the job:mpiexec-np50pythonrun_impute.py-o$OUT/DIRE-d$COORPATH-a$ANNPATH-s$SUFwhereOUT/DIRE: the directory to store imputation resultsCOORPATH: the path of the 3D coordinates file (.txt file separated by\t) with the following columnsregion: imaging region IDhaploid: haploid ID (unique within each imaging region)pos: locus ID (starts from 1)x, y, z: 3D coordinates in nm (missing values are replaced by NaN)ANNPATH: the path of the annotation file (.txt file separated by\t) with the following columnsregion: imaging region IDpos: locus ID (starts from 1)start: starting 1D genomic location of the imaging locusend: ending 1D genomic location of the imaging locusSUF: file suffixThe jupyter notebookpreprcess.ipynbshows how to convert the imaging data to the desired form.The output will be$treeOUT/DIRE
OUT/DIRE/
├──linear_coor_SUF.txt# linear imputation output└──recover_coor_SUF.txt# SnapFISH-IMPUTE resultNormalization of Pairwise DistancesSnapFISH-IMPUTE includes a normalization module to remove 1D genomic distance bias from the data and transform the distribution to approximately $N(0,1)$. This module can be called in Python bydata=sfimpute.preprocess.read_data("PATH/TO/COOR.txt")ann=sfimpute.preprocess.read_data("PATH/TO/ann.txt")pdist_df=sfimpute.impute.to_dist_df(data,ann)norm_df=sfimpute.impute.normalize_pdist_by1d(pdist_df)For a more detailed tutorial about how pairwise distances are calculated and stored, please checkpdistdemo.ipynb.ExampleUse the 5kb chromatin tracing data of mESCs (Huang et al. 2021) as an example. The formatted data is in the folderdata. Using 50 processes:mpiexec-np50pythonrun_impute.py-ooutput-ddata/mESC_Sox2_coor_wnan.txt-adata/mESC_Sox2_ann.txt-smESCs_5kbThe program will print how many values are still unavailable in each iteration:Region 129 initial: 590610 NaN values
Region 129 resized by a factor of 2
Region 129: 56640 NaN values
Region 129 resized by a factor of 2
Region 129: 56640 NaN values
Region CAST initial: 547912 NaN values
Region CAST resized by a factor of 2
Region CAST: 0 NaN valuesAfter the program finished, a directory named output with the following files will be generated$treeoutput
output/
├──linear_coor_mESCs_5kb.txt# linear imputation output└──recover_coor_mESCs_5kb.txt# SnapFISH-IMPUTE resultContact UsIf you have any question regarding SnapFISH-IMPUTE, you can send an email to Hongyu Yu (hongyuyu@unc.edu).