<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> </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> </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> </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: CC 41.11 CC(weak) 23.51 CFOM 64.62</div><div>REM</div><div>TITL sad_fa.ins SAD in P422</div><div>CELL 0.98000 78.17 78.17 37.87 90.00 90.00 90.00</div><div>LATT -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 256</div><div>SE01 1 0.600227 0.892868 0.042187 1.0000 0.2</div><div>SE02 1 0.627518 0.852661 0.427392 0.8667 0.2</div><div>SE03 1 0.867409 0.911667 0.394418 0.8420 0.2</div><div>SE04 1 0.489761 0.805634 0.391009 0.7279 0.2</div><div>SE05 1 0.642792 0.649048 0.369694 0.7172 0.2</div><div>SE06 1 0.678879 0.535027 0.477918 0.4571 0.2</div><div>SE07 1 0.609207 0.572754 0.421746 0.4212 0.2</div><div>SE08 1 0.584526 0.536499 0.322047 0.4154 0.2</div><div>SE09 1 0.843063 0.846794 0.480296 0.3831 0.2</div><div>SE10 1 0.622429 0.743332 0.157899 0.3604 0.2</div><div>SE11 1 0.626114 0.528595 0.644789 0.3590 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>