create_test_data.sh 996 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. create_test_cool(){
  3. url=$1
  4. outpath=$2
  5. binsize=$3
  6. if [[ -f ${outpath}/test.cool ]]; then return; fi
  7. if [[ ! -f ${outpath}/source.pairs.gz ]]
  8. then
  9. echo "[Error] Please manually download the file ${url} to ${outpath}"
  10. echo " and give it source.pairs.gz as name"
  11. exit -1
  12. fi
  13. zcat ${outpath}/source.pairs.gz | head -26 | tail -2 | cut -d' ' --output-delimiter=$'\t' -f 2,3 > ${outpath}/test.chrom.sizes
  14. cooler cload pairs --chrom1 2 --pos1 3 --chrom2 4 --pos2 5 \
  15. ${outpath}/test.chrom.sizes:${binsize} \
  16. ${outpath}/source.pairs.gz \
  17. ${outpath}/test.cool
  18. rm ${outpath}/source.pairs.gz
  19. cooler balance --force --max-iters 1000 ${outpath}/test.cool
  20. }
  21. test_data_path="tests/testthat/data"
  22. mkdir -p ${test_data_path}
  23. # Test cool file
  24. source_cool_file="https://data.4dnucleome.org/files-processed/4DNFI2EK1IOQ/@@download/4DNFI2EK1IOQ.pairs.gz"
  25. test_cool_binsize=50000
  26. create_test_cool ${source_cool_file} ${test_data_path} ${test_cool_binsize}