def MARTINI(residue):
    """
    Reduces complexity of protein residue to the MARTINI coarse grained model:
    CA, O, Bead(s) in specific atom location.
    
    Reference:
    Monticelli et al. The MARTINI coarse-grained force field: extension to proteins. 
    J. Chem. Theory Comput. (2008) vol. 4 (5) pp. 819-834
    """
    
    conversion_table = {
                        "LEU": ["CG"],
                        "ALA": [], # No Side Chain  
                        "GLY": [],  
                        "VAL": ["CB"],
                        "GLU": ["CB"],
                        "ASP": ["CG"],
                        "THR": ["CB"],
                        "LYS": ["CG", "CE"],
                        "ILE": ["CD1"],
                        "ARG": ["CG", "NE"],
                        "ASN": ["CG"],
                        "PRO": ["CG"],
                        "PHE": ["CG", "CE1", "CE2"],
                        "GLN": ["CB"],
                        "SER": ["CB"],
                        "HIS": ["CB", "ND1", "NE2"],
                        "MET": ["CG"],
                        "TYR": ["CG", "CE1", "CE2"],
                        "TRP": ["CB", "CD1", "CD2", "CE2"],
                        "CYS": ["SG"],
                        }
                        
    cg_residue = deepcopy(residue)
    
    residue_name = cg_residue.resname
    
    if residue_name not in conversion_table:
        raise ValueError("Residue %s not recognized" %residue_name)
    
    for atom in cg_residue.child_dict.keys():
        if cg_residue[atom].name in conversion_table[residue_name]:
            # S1, S2, S3, or S4
            name = "S%s" % (int(conversion_table[residue_name].index(cg_residue[atom].name)) + 1)
            cg_residue[atom].name = name
            cg_residue[atom].fullname = " %s " %name
            cg_residue[atom].id = name
            cg_residue[atom].occupancy = int(cg_residue[atom].occupancy)
            cg_residue[atom].bfactor = int(cg_residue[atom].bfactor)
            cg_residue[atom].coord = [ int(xyz) for xyz in cg_residue[atom].coord ]
            
        elif cg_residue[atom].name == "CA":
            cg_residue[atom].name = "BB"
            cg_residue[atom].fullname = " BB "
            cg_residue[atom].id = "BB"
            cg_residue[atom].occupancy = int(cg_residue[atom].occupancy)
            cg_residue[atom].bfactor = int(cg_residue[atom].bfactor)
            cg_residue[atom].coord = [ int(xyz) for xyz in cg_residue[atom].coord ]                        
        else:
            cg_residue.detach_child(cg_residue[atom].name)
            
            
    return cg_residue
def MARTINI ( residue ) : conversion_table = { "LEU" : [ "CG" ] , "ALA" : [ ] , "GLY" : [ ] , "VAL" : [ "CB" ] , "GLU" : [ "CB" ] , "ASP" : [ "CG" ] , "THR" : [ "CB" ] , "LYS" : [ "CG" , "CE" ] , "ILE" : [ "CD1" ] , "ARG" : [ "CG" , "NE" ] , "ASN" : [ "CG" ] , "PRO" : [ "CG" ] , "PHE" : [ "CG" , "CE1" , "CE2" ] , "GLN" : [ "CB" ] , "SER" : [ "CB" ] , "HIS" : [ "CB" , "ND1" , "NE2" ] , "MET" : [ "CG" ] , "TYR" : [ "CG" , "CE1" , "CE2" ] , "TRP" : [ "CB" , "CD1" , "CD2" , "CE2" ] , "CYS" : [ "SG" ] , } cg_residue = deepcopy ( residue ) residue_name = cg_residue . resname if residue_name not in conversion_table : raise ValueError ( "Residue %s not recognized" % residue_name ) for atom in cg_residue . child_dict . keys ( ) : if cg_residue [ atom ] . name in conversion_table [ residue_name ] : name = "S%s" % ( int ( conversion_table [ residue_name ] . index ( cg_residue [ atom ] . name ) ) + 1 ) cg_residue [ atom ] . name = name cg_residue [ atom ] . fullname = " %s " % name cg_residue [ atom ] . id = name cg_residue [ atom ] . occupancy = int ( cg_residue [ atom ] . occupancy ) cg_residue [ atom ] . bfactor = int ( cg_residue [ atom ] . bfactor ) cg_residue [ atom ] . coord = [ int ( xyz ) for xyz in cg_residue [ atom ] . coord ] elif cg_residue [ atom ] . name == "CA" : cg_residue [ atom ] . name = "BB" cg_residue [ atom ] . fullname = " BB " cg_residue [ atom ] . id = "BB" cg_residue [ atom ] . occupancy = int ( cg_residue [ atom ] . occupancy ) cg_residue [ atom ] . bfactor = int ( cg_residue [ atom ] . bfactor ) cg_residue [ atom ] . coord = [ int ( xyz ) for xyz in cg_residue [ atom ] . coord ] else : cg_residue . detach_child ( cg_residue [ atom ] . name ) return cg_residue
Reduces complexity of protein residue to the MARTINI coarse grained model:
    CA, O, Bead(s) in specific atom location.
    
    Reference:
    Monticelli et al. The MARTINI coarse-grained force field: extension to proteins. 
    J. Chem. Theory Comput. (2008) vol. 4 (5) pp. 819-834