Skip to content

Commit

Permalink
fix: add a error fix method and update Chromosome split module
Browse files Browse the repository at this point in the history
  • Loading branch information
Swindler committed Jan 22, 2024
1 parent a210695 commit 7006e4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ cd ./src/models/swin
pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple/
```

> Note: Either GPU or CPU can be installed according to the above steps, and the program will automatically identify the running configuration and environment.
> Note:
>
> If you want to use GPU, please install [CUDA-11.3](https://developer.nvidia.com/cuda-11.3.0-download-archive) and [cuDNN-8.2](https://developer.nvidia.com/rdp/cudnn-archive) before.
> 1. If `src/straw.cpp:34:10: fatal error: curl/curl.h: No such file or directory` is encountered during installation, enter the following command `sudo apt-get install libcurl-dev libcurl4-openssl-dev libssl-dev` in the terminal or refer: `https://stackoverflow.com/questions/11471690/curl-h-no-such-file-or-directory`.
>
> 2. Either GPU or CPU can be installed according to the above steps, and the program will automatically identify the running configuration and environment.
>
> 3. If you want to use GPU, please install [CUDA-11.3](https://developer.nvidia.com/cuda-11.3.0-download-archive) and [cuDNN-8.2](https://developer.nvidia.com/rdp/cudnn-archive) before.

Expand Down
10 changes: 7 additions & 3 deletions src/utils/get_chr_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,15 @@ def split_list(lst, val):
return [lst[:lst.index(val)], lst[lst.index(val) + 1:]] if val in lst else [lst]


def divide_chr(chr_len_txt, hic_file, assembly_file, modified_assembly_file):
def divide_chr(chr_len_txt, hic_file, assembly_file, modified_assembly_file, hic_len):
"""
divide chr
Args:
chr_len_txt: chromosome length txt
hic_file: hic file
assembly_file: assembly file
modified_assembly_file: modified assembly file
hic_len: hic length
Returns:
Expand Down Expand Up @@ -200,7 +201,10 @@ def divide_chr(chr_len_txt, hic_file, assembly_file, modified_assembly_file):
assembly_file = modified_assembly_file

# find ctg
error_contains_ctg = asy_operate.find_site_ctg_s(assembly_file, chr_len, chr_len + 2)
if chr_len + 2 >= hic_len:
error_contains_ctg = asy_operate.find_site_ctg_s(assembly_file, chr_len - 2, chr_len)
else:
error_contains_ctg = asy_operate.find_site_ctg_s(assembly_file, chr_len, chr_len + 2)

# json format
contain_ctg = json.loads(error_contains_ctg)
Expand Down Expand Up @@ -322,7 +326,7 @@ def split_chr(img_file, asy_file, hic_file, cfg_file, device='cpu'):

# split chr
modified_assembly_file = os.path.join(os.path.dirname(img_file), "chr.assembly")
divide_chr(chr_output, hic_file, asy_file, modified_assembly_file)
divide_chr(chr_output, hic_file, asy_file, modified_assembly_file, hic_len)

# get chr number
with open(chr_output, 'r') as file:
Expand Down

0 comments on commit 7006e4e

Please sign in to comment.