> For the complete documentation index, see [llms.txt](https://byte-research.gitbook.io/cryostar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://byte-research.gitbook.io/cryostar/faq.md).

# FAQ

**Q: CUDA out of memory error?**\
**A:** Our model is developed on a V100 with 32G of graphics memory. In case your graphics memory is limited, it's advisable to suitably lower the `train_batch_per_gpu` and `val_batch_per_gpu` parameters within the `data` dictionary of the configuration file.

**Q: How can I run the Python scripts mentioned in the tutorial?**\
**A:** 1) Copying the script: You can copy the script to your local environment. This might involve copying and pasting the script into a local file, or downloading a provided file. 2) Modifying parameters: Depending on the experiment you wish to conduct, you may need to modify certain parameters within the script. This often involves opening the script in a text editor (like VS Code or vim), and then manually changing parameter values in the file. 3) Step 3 - Running the script: You can run the script by using the Python command in your terminal or command prompt. The general format is:

```sh
(cryostar) $ python <script_name.py>
```

**Q: The results didn't correctly display DNA/RNA when visualized.**

<figure><img src="/files/s3hkw4Z82iSZiKAKihdH" alt="" width="563"><figcaption><p>Coarse-grained structure visualized in ChimeraX</p></figcaption></figure>

**A:** We store coarse-grained protein structures, where CA substitutes for amino acids, and C1' substitutes for nucleotides. In ChimeraX, C1' won't be rendered as a ribbon diagram when executing 'show cartoon'. A workaround is to change all C1' to P for visualization. Here's a Python script that you could refer to.

```python
# change_c1_to_p.py
import os
import os.path as osp

import numpy as np
import mrcfile
import biotite.structure as struc

from cryostar.utils.pdb_tools import bt_read_pdb, bt_save_pdb

result_path = "pca-1.pdb"

atom_stack = bt_read_pdb(result_path)

tmp = []

for i in range(atom_stack.stack_depth()):
    tmp_atom_arr = atom_stack[i]
    rna_mask = struc.filter_nucleotides(tmp_atom_arr)
    
    tmp_rna = tmp_atom_arr[rna_mask]
    tmp_atom_name_arr = tmp_rna.atom_name
    tmp_atom_name_arr.fill("P")
    tmp_ele_arr = tmp_rna.element
    tmp_ele_arr.fill("P")

    tmp_rna.atom_name = tmp_atom_name_arr
    tmp_rna.element = tmp_ele_arr
    tmp_atom_arr.atom_name[rna_mask] = tmp_atom_name_arr
    tmp_atom_arr.element[rna_mask] = tmp_ele_arr

    tmp.append(tmp_atom_arr.copy())

tmp = struc.stack(tmp)
bt_save_pdb(result_path.replace(".pdb", "_altered.pdb"), tmp)
```

**Q: When I export tasks from cryoSPARC, file paths appear as soft links?**\
**A:** You might need to use a script to process and convert the symbolic links in the post-conversion `starfile` into absolute paths. A example python script is:

```python
# link2abs_path.py
from pathlib import Path

import starfile

if __name__ == "__main__":
    # starfile path
    src_starfile_path = Path("xxx.star")
    
    src_df = starfile.read(src_starfile_path)
    dst_df = deepcopy(src_df)

    if "particles" in src_df:
        img_names = src_df["particles"]["rlnImageName"]
    else:
        img_names = src_df["rlnImageName"]

    def name_change(src_name):
        idx, path_suffix = src_name.split('@')
        path = data_root / path_suffix
        abs_path = path.readlink()
        return f"{idx}@{str(abs_path)}"

    new_image_names = list(map(name_change, img_names))

    if "particles" in dst_df:
        dst_df["particles"]["rlnImageName"] = new_image_names
    else:
        dst_df["rlnImageName"] = new_image_names

    starfile.write(dst_df, Path("modified_" + src_starfile_path.name))
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://byte-research.gitbook.io/cryostar/faq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
