# 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="https://3161905052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft6ysULOaJNRifZxaZhLa%2Fuploads%2FhIlUe7pmkO7KDk7ucUxl%2F%E6%88%AA%E5%B1%8F2023-11-16%2019.37.30.png?alt=media&#x26;token=8395af74-8e71-45ff-a3ee-a5d97accf72e" 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))
```
