def points_from_str(self, s):
        point_pos = basic_io.str_to_points(s)
        for i, pos in enumerate(point_pos):
            if i == 0:
                p = sphere(pos=pos, radius=0.5, color=color.cyan)
            else:
                p = sphere(pos=pos, radius=7.5, color=color.cyan)
            self.points.append(p)

        count = 0
        if len(pos) > 0:
            count = 1 + (len(self.points) - 2) * 2
        for i in range(count):
            line = cylinder(pos=[0, 0, 0],
                            axis=[0, 0, 0],
                            color=color.cyan,
                            radius=7)
            self.lines.append(line)

        self._update_path()

        for p in self.points:
            p.opacity = 0.5
        for l in self.lines:
            l.opacity = 0.5
    def build(self):
        f = open("all_points.str")
        line = f.readline()
        f.close()

        path = basic_io.str_to_points(line)

        mg = None

        f = open("mg.top")
        line = f.readline()
        f.close()

        mg = motif_graph.motif_graph_from_topology(line)

        segments = self._get_segments(path)
        pathes = self._get_sub_pathes(segments)

        if mg == None:
            mg = motif_graph.MotifGraph()

        w = wrapper.FollowPathWrapper()
        w.run(path="path.0.str", mg="mg.top")

        f = open("mt_out.top")
        line = f.readline()
        f.close()

        mt_all = motif_tree.motif_tree_from_topology_str(line)
        mg.add_motif_tree(mt_all)

        print "building:"
        for i in range(1, len(pathes)):

            print "path: ", i

            last_node = mg.last_node()
            s = mg.topology_to_str()
            f = open("mg_input.top", "w")
            f.write(s + "\n")
            f.write(str(last_node.index) + " " + last_node.data.ends[1].name() + "\n")
            f.close()

            w = wrapper.FollowPathWrapper()
            w.run(path="path." + str(i) + ".str", mg="mg_input.top")

            f = open("mt_out.top")
            line = f.readline()
            f.close()

            mt = motif_tree.motif_tree_from_topology_str(line)

            mg.add_motif_tree(mt)
            mt_all.add_motif_tree(mt)

        mg.to_pdb("final_rna_path.pdb")
        f = open("mt_out.top", "w")
        f.write(mt_all.topology_to_str() + "\n")
        f.close()
    def points_from_str(self, s):
        point_pos = basic_io.str_to_points(s)
        for i, pos in enumerate(point_pos):
            if i == 0:
                p = sphere(pos=pos, radius=0.5, color=color.cyan)
            else:
                p = sphere(pos=pos, radius=7.5, color=color.cyan)
            self.points.append(p)

        count = 0
        if len(pos) > 0:
            count = 1 + (len(self.points)-2)*2
        for i in range(count):
            line = cylinder(pos=[0,0,0], axis=[0,0,0],
                            color=color.cyan, radius = 7)
            self.lines.append(line)

        self._update_path()

        for p in self.points:
            p.opacity = 0.5
        for l in self.lines:
            l.opacity = 0.5
Example #4
0
    def build(self):
        f = open("all_points.str")
        line = f.readline()
        f.close()

        path = basic_io.str_to_points(line)

        mg = None

        f = open("mg.top")
        line = f.readline()
        f.close()

        mg = motif_graph.motif_graph_from_topology(line)

        segments = self._get_segments(path)
        pathes = self._get_sub_pathes(segments)

        if mg == None:
            mg = motif_graph.MotifGraph()

        w = wrapper.FollowPathWrapper()
        w.run(path="path.0.str", mg="mg.top")

        f = open("mt_out.top")
        line = f.readline()
        f.close()

        mt_all = motif_tree.motif_tree_from_topology_str(line)
        mg.add_motif_tree(mt_all)

        print "building:"
        for i in range(1, len(pathes)):

            print "path: ", i

            last_node = mg.last_node()
            s = mg.topology_to_str()
            f = open("mg_input.top", "w")
            f.write(s + "\n")
            f.write(
                str(last_node.index) + " " + last_node.data.ends[1].name() +
                "\n")
            f.close()

            w = wrapper.FollowPathWrapper()
            w.run(path="path." + str(i) + ".str", mg="mg_input.top")

            f = open("mt_out.top")
            line = f.readline()
            f.close()

            mt = motif_tree.motif_tree_from_topology_str(line)

            mg.add_motif_tree(mt)
            mt_all.add_motif_tree(mt)

        mg.to_pdb("final_rna_path.pdb")
        f = open("mt_out.top", "w")
        f.write(mt_all.topology_to_str() + "\n")
        f.close()