def extractChainStep(self, structFileName):

        import json
        outFileName = self._getExtraPath("atomStruct_extractChain.cif")
        aStruct1 = AtomicStructHandler(structFileName)
        chainIdDict = json.loads(self.inputStructureChain.get())
        end = self.end.get()
        if end == -1:
            end = sys.maxsize

        aStruct1.extractChain(chainID=chainIdDict['chain'],
                              start=self.start.get(),
                              end=end,
                              modelID=chainIdDict['model'],
                              filename=outFileName)
        self.createOutputStep(outFileName)
 def extractAllChainsStep(self, structFileName):
     import json
     outFileName = self._getExtraPath("atomStruct_extractChain_%s.cif")
     aStruct1 = AtomicStructHandler(structFileName)
     listOfChains, _ = aStruct1.getModelsChains()
     for model, chainDic in listOfChains.items():
         for chainID, lenResidues in chainDic.items():
             chainIdDict = json.loads(
                 '{"model": %d, "chain": "%s", "residues": %d}' %
                 (model, str(chainID), lenResidues))
             chainIDStr = chainIdDict['chain']
             aStruct1.extractChain(modelID=chainIdDict['model'],
                                   chainID=chainIDStr,
                                   start=-1,
                                   end=sys.maxsize,
                                   filename=outFileName % chainIDStr)
             self.createOutputStep(outFileName % chainIDStr,
                                   suffix=chainIDStr)