示例#1
0
def ConstructSegmentForAnalysis(raw_chain):
    """Returns a list of Segment instance from the
    Chain instance which is properly modified for use in
    the this application.
    """
    ## Sets that atm.include attribute for each atom in the chains
    ## being analyzed by tlsmd
    for atm in raw_chain.iter_all_atoms():
        atm.include = atom_selection.calc_include_atom(atm)

    ## ok, use the chain but use a segment and cut off
    ## any leading and trailing non-amino acid residues
    ## do not include a fragment with no included atoms
    naa = raw_chain.count_amino_acids()
    nna = raw_chain.count_nucleic_acids()

    if naa > nna:
        iter_residues = raw_chain.iter_amino_acids()
    elif nna > naa:
        iter_residues = raw_chain.iter_nucleic_acids()
        
    segment = Structure.Segment(chain_id = raw_chain.chain_id)
    for frag in iter_residues:
        for atm in frag.iter_all_atoms():
            if atm.include:
                segment.add_fragment(frag)
                break

    ## apply data smooth if desired
    if conf.globalconf.adp_smoothing > 0:
        adp_smoothing.IsotropicADPDataSmoother(segment, conf.globalconf.adp_smoothing)

    ## this is useful: for each fragment in the minimization
    ## set a attribute for its index position
    for i, frag in enumerate(segment.iter_fragments()):
        frag.ifrag = i

    ## create a TLSModelAnalyzer instance for the chain, and
    ## attach the instance to the chain for use by the rest of the
    ## program
    segment.tls_analyzer = tlsmdmodule.TLSModelAnalyzer()
    xlist = atom_selection.chain_to_xmlrpc_list(segment.iter_all_atoms())
    segment.tls_analyzer.set_xmlrpc_chain(xlist)

    return segment
示例#2
0
def ConstructSegmentForAnalysis(raw_chain):
    """Returns a list of Segment instance from the Chain instance which is 
    properly modified for use in the this application.
    """
    console.debug_stdoutln(">tlsmd_analysis->ConstructSegmentForAnalysis(chain %s)" % (
        raw_chain.chain_id))

    ## NOTE: raw_chain = "Chain(1:A, Res(MET,1,A)...Res(VAL,50,A))"
    ## Sets that atm.include attribute for each atom in the chains
    ## being analyzed by tlsmd
    for atm in raw_chain.iter_all_atoms():
        #atm.include = atom_selection.calc_include_atom(atm)
        atm.include = atom_selection.calc_include_atom(atm, reject_messages = True)

    ## ok, use the chain but use a segment and cut off
    ## any leading and trailing non-amino acid residues
    ## do not include a fragment with no included atoms
    naa = nna = ota = 0
    naa = raw_chain.count_amino_acids()
    nna = raw_chain.count_nucleic_acids()
    ota = raw_chain.count_fragments()

    if naa > nna:
        ## Probably a protein with (possibly) some nucleic acids.
        iter_residues = raw_chain.iter_amino_acids()
    elif nna > naa:
        ## Probably a nucleic acid with (possibly) some amino acids.
        iter_residues = raw_chain.iter_nucleic_acids()

    if naa == 0 and nna == 0 and ota > 0:
        ## This chain does not have any amino or nucleic acids, so skip.
        return ""

    segment = Structure.Segment(chain_id = raw_chain.chain_id)

    for frag in iter_residues:
        for atm in frag.iter_all_atoms():
            if atm.include:
                segment.add_fragment(frag)
                break

    ## apply data smooth if desired (default is "0")
    if conf.globalconf.adp_smoothing > 0:
        adp_smoothing.IsotropicADPDataSmoother(segment, 
                                               conf.globalconf.adp_smoothing)

    ## this is useful: for each fragment in the minimization
    ## set an attribute for its index position
    for i, frag in enumerate(segment.iter_fragments()):
        ## NOTE (by Christoph):
        ## Example output:
        ## 0 : Res(MET,1,A)
        ## 1 : Res(ILE,2,A)
        ## ...
        frag.ifrag = i

    ## create a TLSModelAnalyzer instance for the chain, and attach the
    ## instance to the chain for use by the rest of the program
    segment.tls_analyzer = tlsmdmodule.TLSModelAnalyzer()
    xlist = atom_selection.chain_to_xmlrpc_list(segment.iter_all_atoms())
    segment.tls_analyzer.set_xmlrpc_chain(xlist)

    ## INPUT : raw_chain = "Chain(1:A, Res(MET,1,A)...Res(VAL,50,A))"
    ## OUTPUT: segment   = "Segment(1:A, Res(MET,1,A)...Res(VAL,50,A))"
    return segment