예제 #1
0
def main(pdb_path, tls_out_path, calc_tls):

    struct = FileIO.LoadStructure(file=pdb_path)

    ## calculate one set of TLS tensors from all the amino acid atoms
    if calc_tls == True:
        tls = TLS.TLSGroup()

        for res in struct.iter_amino_acids():
            for atm in res.iter_atoms():
                tls.append(atm)

        tls.origin = tls.calc_centroid()
        tls.calc_tls_tensors()
        print_TLSGroup(tls)

    else:
        tls_file = TLS.TLSFile()

        ## get TLS groups from REMARK statments in PDB file
        if tls_out_path == None:
            tls_file.set_file_format(TLS.TLSFileFormatPDB())
            try:
                tls_file.load(open(pdb_path, "r"), pdb_path)
            except IOError, e:
                print "[Error] %s: %s" % (str(e), pdb_path)

        ## or get TLS groups from REFMAC TLSOUT file
        else:
예제 #2
0
    def fit_to_chain(self, chain):
        """Re-sets all derived information in the TLSSegment.
        """
        ## cut segment from chain using segment ranges
        segments = []
        for frag_id1, frag_id2 in self.segment_ranges:
            segments.append(chain[frag_id1:frag_id2])
        self.segments = segments

        ## put all atoms in the segment into a new TLSGroup instance
        tls_group = TLS.TLSGroup()
        for segment in self.segments:
            for atm in segment.iter_all_atoms():
                if atm.include is True:
                    tls_group.append(atm)
        self.tls_group = tls_group

        if len(self.tls_group) != self.num_atoms():
            console.stderrln(
                "fit_to_chain: EEK! (%s) len(self.tls_group)=%d != self.num_atoms()=%d"
                % (self, len(self.tls_group), self.num_atoms()))
            raise SystemExit

        ## fit the TLS group parameters
        try:
            self.fit_tls_parameters(chain)
        except:
            print console.formatExceptionInfo()

        ## helpful additions
        tls_info = self.tls_group.calc_tls_info()
        itls_info = TLS.calc_itls_center_of_reaction(self.tls_group.itls_T,
                                                     self.tls_group.itls_L,
                                                     self.tls_group.itls_S,
                                                     self.tls_group.origin)

        self.tls_info = tls_info
        self.itls_info = itls_info

        if conf.globalconf.tls_model in ["ISOT", "NLISOT"]:
            self.tls_group.model = "ISOT"
            self.model_tls_info = itls_info
        elif conf.globalconf.tls_model in ["ANISO", "NLANISO"]:
            self.tls_group.model = "ANISO"
            self.model_tls_info = tls_info

        try:
            self.rmsd_b = tls_calcs.calc_rmsd_tls_biso(self.tls_group)
        except:
            print console.formatExceptionInfo()