Esempio n. 1
0
def InitWalls(pdbid: str) -> TunnelWalls:
    """Initiate walls for a particular structure. This consumes a dataframe given that a choice of tunnel is present"""
    def get_tunnels_dataframe(csvpath: str) -> pd.DataFrame:
        tunnel_instance = pd.read_csv(csvpath)
        xyzr = tunnel_instance[['Distance', 'FreeRadius', 'X', 'Y', 'Z']]
        return xyzr

    TUNNELS = os.getenv("TUNNELS")
    log = Log(os.getenv('TUNNEL_LOG'))

    struct = log.get_struct(pdbid)
    taxid = str(int(struct['taxid'].values[0]))
    choice = int(struct['moletunnel'].values[0])

    tunnelfile = "tunnel_{}.csv".format(choice)

    if choice < 1:
        """See docs for disambiguation. Either mole hasn't succeeded or there is something blockign the tunnel."""
        print("Choice under 1.")
        return

    tunnelcsv = get_tunnels_dataframe(
        os.path.join(TUNNELS, taxid, pdbid, 'csv', tunnelfile))
    tw = TunnelWalls(pdbid, fetchStructure(pdbid), tunnelcsv)
    tw.consumeMoleDataframe(10)
    return tw
Esempio n. 2
0
def added_ptcs():
    for struct in _300852:
        
        x = residues_average( get_ptc_residues(fetchStructure(struct),struct,[ 2055 , 2056 , 2451 , 2452 , 2507 , 2506 ]) )
        if len(x)>0:
            cord = list( map(lambda x: str(x), x) )
            cord = ",".join(cord)
            log.update_struct(struct,dowrite=True,**{"PTC_average":str(cord)})
        else:continue
Esempio n. 3
0
def calc_constriction_site(pdbid: str):
    """Here the assumption is that the constriction site is unique and so is then the KDTree min then."""
    pdbid = pdbid.upper()

    chainL22: str = log.get_struct(pdbid)['uL22'].values[0]
    chainL4: str = log.get_struct(pdbid)['uL4'].values[0]

    if ',' in chainL22: chainL22 = chainL22.split(',')[0]
    if ',' in chainL4: chainL4 = chainL4.split(',')[0]

    struct = fetchStructure(pdbid)[0]

    L4: Chain = struct[chainL4]
    L22: Chain = struct[chainL22]

    l4res = [*L4.get_atoms()]
    l22res = [*L22.get_atoms()]

    kdtreeonl4 = KDTree([*map(lambda x: x.get_coord(), l4res)])
    kdtreeonl22 = KDTree([*map(lambda x: x.get_coord(), l22res)])

    nbridin22: Atom = None
    nbridin4: Atom = None
    atom: Atom

    distances_indexes = kdtreeonl4.query(
        [*map(lambda x: x.get_coord(), l22res)])
    dist = 99999999
    for x in zip([*distances_indexes[0]], [*distances_indexes[1]]):
        if x[0] < dist:
            dist = x[0]
            nbridin4 = x[1]

    distances_indexes = kdtreeonl22.query(
        [*map(lambda x: x.get_coord(), l4res)])
    dist = 99999999
    for x in zip([*distances_indexes[0]], [*distances_indexes[1]]):
        if x[0] < dist:
            dist = x[0]
            nbridin22 = x[1]

    l4atomcord = l4res[nbridin4].get_coord()
    l22atomcord = l22res[nbridin22].get_coord()

    centerline = np.mean([l4atomcord, l22atomcord], axis=0)
    residueInL4: Residue = l4res[nbridin4].get_parent()
    residueInL22: Residue = l22res[nbridin22].get_parent()

    print(
        """{} {} in chain {}({}) is closest to {} {} in chain{}({}).\n Centerline:{}"""
        .format(residueInL22.get_resname(),
                residueInL22.get_id()[1], chainL22, 'uL22',
                residueInL4.get_resname(),
                residueInL4.get_id()[1], chainL4, 'uL4', centerline))

    return {"uL22": residueInL22, "uL4": residueInL4, "centerline": centerline}
Esempio n. 4
0
def added_ptcs():
    for struct in _9606:
        x = get_ptc_residues(fetchStructure(struct), struct, ['4452'])
        if len(x) > 0:
            cord = list(map(lambda x: str(x), get_CA_or(x[0]).get_coord()))
            cord = ",".join(cord)
            log.update_struct(struct,
                              dowrite=True,
                              **{"PTC_average": str(cord)})
        else:
            continue
Esempio n. 5
0
from ciftools.Structure import fetchStructure
from ciftools.scripts.splitStruct import fetchChain
from typing import List
from Bio.PDB.Residue import Residue
from pymol import cmd
from ciftools.TunnelScripts.TunnelLog import Log


RADIUS      = os.getenv('SCOOP_RADIUS')
TUNNELS     = os.getenv('TUNNELS')
STATIC_ROOT = os.getenv('STATIC_ROOT')


pdbid         = sys.argv[1].upper()
log           = Log(os.getenv('TUNNEL_LOG'))
struct        = fetchStructure(pdbid)
record        = log.get_struct(pdbid)
species       = str( int( record.taxid.values[0] ) )

structpath    = os.path.join(STATIC_ROOT,pdbid,"{}.cif".format(pdbid))
scoopsavepath = os.path.join(TUNNELS,species,pdbid,'{}_{}Ascoop.pdb'.format(pdbid,RADIUS))
if not os.path.exists(os.path.dirname( scoopsavepath )):
    os.makedirs(os.path.dirname( scoopsavepath ))


cmd.load(structpath)
x = cmd.select(f'resi 2504')
cmd.select(f'br. {pdbid} w. {RADIUS} of \'sele\'')
cmd.save( scoopsavepath, 'sele' )
print("Saved to {}".format(scoopsavepath))
Esempio n. 6
0
def fetchChain(pdbid: str, strandid: str) -> Chain:
    pdbid = pdbid.upper()
    struct = fetchStructure(pdbid)
    chain: Chain = struct[0][strandid]
    return chain