<html><head><base href="x-msg://1468/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Graeme,</div><div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="font-family: Calibri, sans-serif; font-size: 15px; ">This should be easy but I can’t find anything!</span><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Sans'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-GB" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p>&nbsp;</o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">I have a .res file:<o:p></o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p>&nbsp;</o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">[...]</div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p>&nbsp;</o:p></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">which I would like to read, invert the hand of and write as a pdb file. I got stuck trying to work through the example / test code. Can someone point me in the right direction?</div></div></div></span></blockquote><br></div><div><div>from cctbx import xray</div><div>from cStringIO import StringIO</div><div><br></div><div>res= """</div><div>REM Best SHELXD solution: &nbsp; CC 41.11 &nbsp; CC(weak) 23.51 &nbsp; CFOM &nbsp;64.62</div><div>REM</div><div>TITL sad_fa.ins SAD in P422</div><div>CELL &nbsp;0.98000 &nbsp; 78.17 &nbsp; 78.17 &nbsp; 37.87 &nbsp; 90.00 &nbsp; 90.00 &nbsp; 90.00</div><div>LATT &nbsp;-1</div><div>SYMM -Y+1/2,X+1/2,Z+1/4</div><div>SYMM -X,-Y,Z+1/2</div><div>SYMM Y+1/2,-X+1/2,Z+3/4</div><div>SYMM X+1/2,-Y+1/2,-Z+3/4</div><div>SYMM Y,X,-Z</div><div>SYMM -X+1/2,Y+1/2,-Z+1/4</div><div>SYMM -Y,-X,-Z+1/2</div><div>SFAC SE</div><div>UNIT &nbsp; 256</div><div>SE01 &nbsp; 1 &nbsp;0.600227 &nbsp;0.892868 &nbsp;0.042187 &nbsp; 1.0000 &nbsp;0.2</div><div>SE02 &nbsp; 1 &nbsp;0.627518 &nbsp;0.852661 &nbsp;0.427392 &nbsp; 0.8667 &nbsp;0.2</div><div>SE03 &nbsp; 1 &nbsp;0.867409 &nbsp;0.911667 &nbsp;0.394418 &nbsp; 0.8420 &nbsp;0.2</div><div>SE04 &nbsp; 1 &nbsp;0.489761 &nbsp;0.805634 &nbsp;0.391009 &nbsp; 0.7279 &nbsp;0.2</div><div>SE05 &nbsp; 1 &nbsp;0.642792 &nbsp;0.649048 &nbsp;0.369694 &nbsp; 0.7172 &nbsp;0.2</div><div>SE06 &nbsp; 1 &nbsp;0.678879 &nbsp;0.535027 &nbsp;0.477918 &nbsp; 0.4571 &nbsp;0.2</div><div>SE07 &nbsp; 1 &nbsp;0.609207 &nbsp;0.572754 &nbsp;0.421746 &nbsp; 0.4212 &nbsp;0.2</div><div>SE08 &nbsp; 1 &nbsp;0.584526 &nbsp;0.536499 &nbsp;0.322047 &nbsp; 0.4154 &nbsp;0.2</div><div>SE09 &nbsp; 1 &nbsp;0.843063 &nbsp;0.846794 &nbsp;0.480296 &nbsp; 0.3831 &nbsp;0.2</div><div>SE10 &nbsp; 1 &nbsp;0.622429 &nbsp;0.743332 &nbsp;0.157899 &nbsp; 0.3604 &nbsp;0.2</div><div>SE11 &nbsp; 1 &nbsp;0.626114 &nbsp;0.528595 &nbsp;0.644789 &nbsp; 0.3590 &nbsp;0.2</div><div>HKLF 3</div><div>END</div><div>"""</div><div>xs = xray.structure.from_shelx(file=StringIO(res)) # replace "file" by "filename" here to load from disk</div><div>xs_other_hand = xs.change_hand()</div><div>print xs.as_pdb_file()</div><div><br></div></div></body></html>