示例#1
0
    def render_callback(self, frame):
        try:
            self.molecule.deleteCoordSet(self.molecule.coordSets[frame])
        except:
            pass
        self.molecule.LoadFrame(frame + 1)
        Midas.match("#0:1-545", "#1:1-545")
        Midas.undisplay("#0")

        Midas.color("byatom", "#0")
        Midas.undisplay("#0.=H=")
        Midas.wait(1)
        t = time.time()

        pct_complete = self.frames_done / float(self.frames_total) * 100
        if self.frames_done:
            time_to_complete = (t - self.t0) / self.frames_done * (
                self.frames_total - self.frames_done)
        else:
            time_to_complete = 0

        self.f.write(
            "Rendered frame %d (%d of %d, %d-%d), %5.2f%% complete, %5.2f seconds remaining)\n"
            % (frame, self.frames_done, self.frames_total, start, stop,
               pct_complete, time_to_complete))
        self.f.flush()
        self.frames_done += 1
        return True
示例#2
0
 def update_model_color(self):
     model_id = openModels.listIds()[-1][0]
     if not self.keep_selection:
         Midas.color('orange red', '#%d' % self.movie_id)
     else:
         Midas.color('forest green', '#%d' % model_id)
         Midas.color('byhet', '#%d' % model_id)
         Midas.color('forest green', '#%d' % self.movie_id)
     Midas.color('byhet', '#%d' % self.movie_id)
示例#3
0
def MethodOne():
    Midas.close("all")
    openMolecule(pdbid)

    efhand = "#0:117-147"
    calcium = "#0:151.het"
    backboneAtoms = "@n,c,ca,o"
    negRes = "::asp,glu"

    # Display EF-Hand
    Midas.represent("bs", efhand)
    Midas.show(efhand + "&" + negRes)
    Midas.color("green", efhand + "&" + negRes)
    Midas.color("cyan", "#0:135")
    Midas.color("byatom", efhand + backboneAtoms)
    # Midas.resrepr("edged", efhand)
    Midas.resrepr("smooth", "#0")

    # Display Calcium
    Midas.display(calcium)
    Midas.color("cyan", calcium)
    Midas.vdwdefine("ca", "ca", 0.5, calcium)
    Midas.represent("sphere", calcium)

    # Adjust View
    Midas.center(calcium)
    Midas.cofr(calcium)
    chimera.viewer.scaleFactor = 7

    # Add Feature Shells
    s = FeatureShellNode(6, 1, sphereColor=(.2, 0, .4), sphereTransparency=.1)
    t = apply(newTranslation, getLocation(calcium))
    t.addChild(s.spheres)
    useVRML(t, name="FEATURE Spheres")
    t = apply(newTranslation, getLocation(calcium))
    t.addChild(s.circles)
    useVRML(t, name="FEATURE Rings")

    # Add Markers
    markerSize = 1
    markerColor = "yellow"

    alphaLoc = (26.768, 15.445, 3.308)
    betaLoc = (24.006, 18.672, 1.650)
    centroidLoc = (27.1862, 17.9809, 1.31815)

    g = GroupNode()
    g.addChild(newMarker(alphaLoc, markerSize, markerColor))
    g.addChild(newMarker(betaLoc, markerSize, markerColor))
    g.addChild(newMarker(centroidLoc, markerSize, markerColor))
    #useVRML(g,name="FEATURE Markers")

    # Show Water
    water = "#0:231.water"
    Midas.display(water)
    Midas.vdwdefine("hoh", "o", 0.2, water)
    Midas.represent("sphere", water)
示例#4
0
def NDBColors(residues):
	import Midas
	color_names = set(std['NDB color'] for std in standard_bases.values())
	colors = {}
	for n in color_names:
		colors[n] = []
	for r in residues:
		try:
			info = standard_bases[nucleic3to1[r.type]]
		except KeyError:
			continue
		color = info['NDB color']
		colors[color].append(r)
	for color, residues in colors.items():
		if residues:
			Midas.color(color, residues)
			Midas.ribcolor(color, residues)
示例#5
0
    def _displayMotif(self, motif):
        # obtain modelNo
        modelNo = myvrml.getModelNo(motif.pdbid.lower())
        if modelNo == None:
            print "No Model"
            return

        group = myvrml.GroupNode()

        # obtain chain residue numbers
        chainRes = []
        mol = chimera.openModels.list(id=modelNo)[0]
        residues = mol.residues
        residues.sort(lambda a, b: cmp(a.id.position, b.id.position))
        for res in residues:
            if res.id.chainId.strip() == motif.chainid:
                chainRes.append(res)

        # Hilight motif
        motifSel = "#%d:%d-%d.%s" % (
            modelNo, chainRes[motif.start].id.position,
            chainRes[motif.end - 1].id.position, motif.chainid)
        if gVerbose:
            print "MOTIFSEL:", motifSel
            print "START RES:", chainRes[motif.start].type,
            print "STOP RES:", chainRes[motif.end - 1].type
        Midas.color("red", motifSel)
        Midas.rescolor("red", motifSel)

        if gHaveCore:
            # Hilight coreMotif
            coreMotifSel = "#%d:%d-%d.%s" % (
                modelNo, chainRes[motif.coreStart].id.position,
                chainRes[motif.coreEnd - 1].id.position, motif.chainid)
            print "CORESEL:", coreMotifSel
            Midas.color("yellow", coreMotifSel)

        print motif

        return group
#path = "C:/Users/dhaslam/Downloads/274635.all_in_one/274635.all_in_one/274635.contactmap.txt"
path = sys.argv[1]

it = 0
i = 0
breakVar = 0
noRepeat = int(sys.argv[2])

with open(path) as inf:
    for line in inf:
        AA1, AA2, trash1, trash2, trash3 = line.strip().split(",")
        next(inf)

        if it == 38:
            break

        if float(trash3) < float(sys.argv[3]):
            break

        if noRepeat == 1:
            for i in range(0, len(AAList)):
                if AA1 == AAList[i] or AA2 == AAList[i]:
                    breakVar = 1

            if breakVar == 1:
                break
        Midas.color(colors[it], sel=':' + str(AA1))
        Midas.color(colors[it], sel=':' + str(AA2))
        it = it + 1
        AAList.append(AA1)
        AAList.append(AA2)