コード例 #1
0
    allrhos = np.array(
        [denss_outputs[i][8] for i in np.arange(superargs.nmaps)])
    sides = np.array([denss_outputs[i][9] for i in np.arange(superargs.nmaps)])

    if superargs.ref is not None:
        #allow input of reference structure
        if superargs.ref.endswith('.pdb'):
            refside = sides[0]
            voxel = (refside / allrhos[0].shape)[0]
            halfside = refside / 2
            n = int(refside / voxel)
            dx = refside / n
            x_ = np.linspace(-halfside, halfside, n)
            x, y, z = np.meshgrid(x_, x_, x_, indexing='ij')
            xyz = np.column_stack((x.ravel(), y.ravel(), z.ravel()))
            pdb = saxs.PDB(superargs.ref)
            if superargs.center:
                pdb.coords -= pdb.coords.mean(axis=0)
            refrho = saxs.pdb2map_gauss(pdb,
                                        xyz=xyz,
                                        sigma=superargs.resolution)
            refrho = refrho * np.sum(allrhos[0]) / np.sum(refrho)
        if superargs.ref.endswith('.mrc'):
            refrho, refside = saxs.read_mrc(superargs.ref)

    if superargs.enan:
        print()
        print(" Selecting best enantiomers...")
        try:
            allrhos, scores = saxs.select_best_enantiomers(
                allrhos, cores=superargs.cores)
コード例 #2
0
        sys.exit(1)
    else:
        if args.ref.endswith('.pdb'):
            logging.info('Center PDB reference: %s', args.center)
            logging.info('PDB reference map resolution: %.2f', args.resolution)
            refbasename, refext = os.path.splitext(args.ref)
            refoutput = refbasename + "_centered.pdb"
            refside = side
            voxel = (refside / movrho.shape)[0]
            halfside = refside / 2
            n = int(refside / voxel)
            dx = refside / n
            x_ = np.linspace(-halfside, halfside, n)
            x, y, z = np.meshgrid(x_, x_, x_, indexing='ij')
            xyz = np.column_stack((x.ravel(), y.ravel(), z.ravel()))
            pdb = saxs.PDB(args.ref)
            if args.center:
                pdb.coords -= pdb.coords.mean(axis=0)
                pdb.write(filename=refoutput)
            refrho = saxs.pdb2map_gauss(pdb, xyz=xyz, sigma=args.resolution)
            refrho = refrho * np.sum(movrho) / np.sum(refrho)
            saxs.write_mrc(refrho, side, filename=refbasename + '_pdb.mrc')
        if args.ref.endswith('.mrc'):
            refrho, refside = saxs.read_mrc(args.ref)
        if (not args.ref.endswith('.mrc')) and (not args.ref.endswith('.pdb')):
            print "Invalid reference filename given. .mrc or .pdb file required"
            sys.exit(1)

    aligned = saxs.principal_axis_alignment(refrho, rho)

    saxs.write_mrc(aligned, side, output + '.mrc')
コード例 #3
0
    side = args.side
    if args.voxel is None:
        voxel = side / args.nsamples
    else:
        voxel = args.voxel

    halfside = side / 2
    n = int(side / voxel)
    #want n to be even for speed/memory optimization with the FFT, ideally a power of 2, but wont enforce that
    if n % 2 == 1: n += 1
    dx = side / n
    x_ = np.linspace(-halfside, halfside, n)
    x, y, z = np.meshgrid(x_, x_, x_, indexing='ij')

    xyz = np.column_stack((x.ravel(), y.ravel(), z.ravel()))
    pdb = saxs.PDB(args.file)
    if args.center:
        pdboutput = basename + "_centered.pdb"
        pdb.coords -= pdb.coords.mean(axis=0)
        pdb.write(filename=pdboutput)

    if args.mode == "fast":
        #rho = saxs.pdb2map_gauss(pdb,xyz=xyz,sigma=args.resolution,mode="fast",eps=1e-6)
        rho = saxs.pdb2map_fastgauss(pdb,
                                     x=x,
                                     y=y,
                                     z=z,
                                     sigma=args.resolution,
                                     r=args.resolution * 2)
    elif args.mode == "slow":
        print("slow mode doesn't exist anymore. Use fast mode.")