Opened 5 months ago

Closed 5 months ago

#17602 closed defect (not a bug)

color different chain using terminal and looping

Reported by: jg0428@… Owned by: pett
Priority: normal Milestone:
Component: Command Line Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Dear ChimeraX team,

I am working at Princeton University. I am trying to export hundreds of proteins from .cif file, label different chain with different color and maybe different sequence also labeled with various colors. Since doing them one by one is time tidious. I am trying to write a script to run one by one automatically. But apparently there is some issue with color code. Then I try to switch to one protein to see if the color code is working or not. But it looks like there is still problems, can't it be operated in terminal to label different chain colors or specific sequence colors? How to modify this to make it work?

single_protein.sh

#!/bin/bash

# Path to ChimeraX executable
chimera_path="/Applications/ChimeraX-1.9.app/Contents/MacOS/ChimeraX"

# Specify the path to your CIF file
input_file="/Users/jg0428/Desktop/40_PDB_exported_structure/Sudan_ZDHHC17.cif"

# Output directory for results
output_dir="/Users/jg0428/Desktop/40_PDB_Output"

"$chimera_path" --cmd "open \"$input_file\"; wait 5; color /A ribbons hotpink; color /B ribbons forestgreen; save \"$output_dir/Sudan_ZDHHC17_test.png\" supersample 3; close session; exit"

ChimeraX_batch.sh

#!/bin/bash

# Path to ChimeraX executable
chimera_path="/Applications/ChimeraX-1.9.app/Contents/MacOS/ChimeraX"

# Input directory containing .cif files
input_dir="/Users/jg0428/Desktop/40_PDB_exported_structure"

# Output directory for results
output_dir="/Users/jg0428/Desktop/40_PDB_Output"

# Loop over each .cif file in the input directory
for input_file in "$input_dir"/*.cif; do
    # Get the base name of the file without extension
    base=$(basename "$input_file" .cif)

    # Run ChimeraX commands for each file
    "$chimera_path" --cmd "open \"$input_file\";wait 2;show chains;color hotpink chain A;color forestgreen chain B;movie record;turn y 1 300;wait 120;movie stop;movie encode bitrate 10000 output \"$output_dir/$base.mp4\";save \"$output_dir/$base.png\" supersample 3;save \"$output_dir/$base.cxs\";close session;exit;"
done

Best,
Jinchao

Change History (2)

comment:1 by pett, 5 months ago

Component: UnassignedCommand Line
Owner: set to pett
Platform: all
Project: ChimeraX
Status: newaccepted

comment:2 by pett, 5 months ago

Resolution: not a bug
Status: acceptedclosed

Hi Jinchao,

The "color" commands in your script are wrong because they have they have the color/target reversed. They should be:

color /chain-id color-name ribbons

not:

color /chain-id ribbons color-name

--Eric

Eric Pettersen
UCSF Computer Graphics Lab

Note: See TracTickets for help on using tickets.