Skip to content

Commit

Permalink
feat: sort and compress final pairs with pairtools
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Sep 4, 2023
1 parent 102e662 commit 55fe4f2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RUN conda install -c conda-forge -y \
samtools \
htslib \
pysam \
cooler && conda clean -afy
cooler \
pairtools && conda clean -afy

RUN pip install -Ur requirements.txt
# Using pip:
Expand Down
5 changes: 3 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: env-name
name: base
channels:
- conda-forge
- bioconda
Expand All @@ -21,4 +21,5 @@ dependencies:
- pysam
- htslib
- pyfastx
- cooler
- cooler
- pairtools
14 changes: 11 additions & 3 deletions hicstuff/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,9 +1101,17 @@ def _out_file(fname):

# Move final pairs file to main dir.
p = pathlib.Path(use_pairs).absolute()
parent_dir = p.parents[1]
p.rename(parent_dir / p.name)

pairsf = p.parents[1] / p.name
p.rename(pairsf)

# Sort and compress final pairs file
pairstools_cmd = "pairtools sort".split(" ")
sorted_pairsf = str(pairsf) + ".gz"
sort_args = "--output {out} --tmpdir {tmp_dir}".format(
out = sorted_pairsf, tmp_dir = tmp_dir
)
sp.call(pairstools_cmd + sort_args.split(" ") + [pairsf], shell=False)

# Clean temporary files
if not no_cleanup:
tempfiles = [
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ scikit-learn
pysam
pyfastx
cooler
pairtools

0 comments on commit 55fe4f2

Please sign in to comment.