Ejemplo n.º 1
0
            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')
    print "%s.mrc written. " % (output, )

    logging.info('END')
Ejemplo n.º 2
0
    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 n <= 20:
        #n must be greater than 20 with current implementation of fast
        #mode using KDTrees. So switch to slow mode, since its a small grid anyways
        args.mode = "slow"

    if args.mode == "fast":
        rho = saxs.pdb2map_gauss(pdb,xyz=xyz,sigma=args.resolution,mode="fast",eps=1e-6)
    elif args.mode == "slow":
        rho = saxs.pdb2map_gauss(pdb,xyz=xyz,sigma=args.resolution,mode="slow")
    else:
        print "Note: Using FFT method results in severe truncation ripples in map."
        print "This will also run a quick refinement of phases to attempt to clean this up."
        rho, pdbidx = saxs.pdb2map_FFT(pdb,x=x,y=y,z=z,radii=None)
        rho = saxs.denss_3DFs(rho_start=rho,dmax=side,voxel=dx,oversampling=1.,shrinkwrap=False,support=pdbidx)
    print
    saxs.write_mrc(rho,side,output+".mrc")