From 101ffd503563da5e94454c790b907a0fc600e2f9 Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Fri, 18 Aug 2023 16:27:53 -0300 Subject: [PATCH 1/7] Update: Change Python file Test --- test/dna-test.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/dna-test.py diff --git a/test/dna-test.py b/test/dna-test.py new file mode 100644 index 0000000..e69de29 From 0d6caa42d5a9f8b01d8b4f25db710322f6219bfe Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Sun, 20 Aug 2023 07:53:59 -0300 Subject: [PATCH 2/7] Update: Change Libraries --- test/dna-test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/dna-test.py b/test/dna-test.py index e69de29..834f6aa 100644 --- a/test/dna-test.py +++ b/test/dna-test.py @@ -0,0 +1,6 @@ +import numpy as np +from Bio.PDB import PDBParser +from OpenGL.GL import * +from OpenGL.GLUT import * +from OpenGL.GLU import * + From 8a3aed876ce7347f70514834b8e55b3db969d446 Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Sun, 20 Aug 2023 08:07:42 -0300 Subject: [PATCH 3/7] Update: Setting the conts for viewing (window/camera) --- test/dna-test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/dna-test.py b/test/dna-test.py index 834f6aa..225a736 100644 --- a/test/dna-test.py +++ b/test/dna-test.py @@ -4,3 +4,14 @@ from OpenGL.GLUT import * from OpenGL.GLU import * +# Defininfo as conts para visualização (janela/camera) +WINDOW_TITLE = "DNA Humano" +WINDOW_WIDTH = 800 +WINDOW_HEIGHT = 600 +FOV = 45 +NEAR = 1 +FAR = 50 +CAMERA_POS = (0, 0, -15) +CAMERA_TARGET = (0, 0, 0) +CAMERA_UP = (0, 1, 0) + From 991dfa176c1cac4a14c7c50f534d5d5a672aa9da Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Sun, 20 Aug 2023 08:13:30 -0300 Subject: [PATCH 4/7] Update: Defining a function to load the structure of DNA from a PDB file --- test/dna-test.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/dna-test.py b/test/dna-test.py index 225a736..d60b8ce 100644 --- a/test/dna-test.py +++ b/test/dna-test.py @@ -4,7 +4,7 @@ from OpenGL.GLUT import * from OpenGL.GLU import * -# Defininfo as conts para visualização (janela/camera) +# Definindo as conts para visualização (janela/camera) WINDOW_TITLE = "DNA Humano" WINDOW_WIDTH = 800 WINDOW_HEIGHT = 600 @@ -15,3 +15,11 @@ CAMERA_TARGET = (0, 0, 0) CAMERA_UP = (0, 1, 0) +# Definindo uma função para carregar a estrutura do DNA a partir de um arquivo PDB +def load_dna_structure(pdb_file): + parser = PDBParser(QUIET=True) + structure = parser.get_structure('DNA', pdb_file) + model = structure[0] + return model + +# Definindo uma função para desenhar a estrutura do DNA usando linhas \ No newline at end of file From ea46c48742e229a2c3516507618719499e0bd500 Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Sun, 20 Aug 2023 08:23:12 -0300 Subject: [PATCH 5/7] Update: Defining a function to draw the structure of DNA using lines --- test/dna-test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/dna-test.py b/test/dna-test.py index d60b8ce..3246678 100644 --- a/test/dna-test.py +++ b/test/dna-test.py @@ -22,4 +22,14 @@ def load_dna_structure(pdb_file): model = structure[0] return model -# Definindo uma função para desenhar a estrutura do DNA usando linhas \ No newline at end of file +# Definindo uma função para desenhar a estrutura do DNA usando linhas +def draw_dna_model(model): + glLineWidth(2.0) + glBegin(GL_LINE) + for chain in model.get_chains(): + for residue in chain: + for atom in residue: + if atom.get_name() == "p": + x, y, z = atom.get_coord() + glVertex3f(x, y, z) + glEnd() \ No newline at end of file From 36b069d96bec6e609df19ebe7b39f1354e83b113 Mon Sep 17 00:00:00 2001 From: sameckmatheus Date: Sun, 20 Aug 2023 08:40:09 -0300 Subject: [PATCH 6/7] Update: dna-test.py and remove dna.py --- dna.py | 53 ------------------------------------------------ test/dna-test.py | 3 ++- 2 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 dna.py diff --git a/dna.py b/dna.py deleted file mode 100644 index 60e6b7e..0000000 --- a/dna.py +++ /dev/null @@ -1,53 +0,0 @@ -import numpy as np -from Bio.PDB import PDBParser -from OpenGL.GL import * -from OpenGL.GLUT import * -from OpenGL.GLU import * - -def load_dna_structure(pdb_file): - parser = PDBParser(QUIET=True) - structure = parser.get_structure('DNA', pdb_file) - model = structure[0] - return model - -# Inicializando a janela OpenGL -def draw_dna_model(model): - glutInit() - glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) - glutCreateWindow("Representação do DNA humano") - - # Inicializando a renderização da janela - def render(): - glClear(GL_COLOR_BUFFER_CLEAR) - glRotatef(1, 3, 1, 1) - - glLineWidth(2.0) - glBegin(GL_LINES) - for chain in model.get_chains(): - for residue in chain: - for atom in residue: - if atom.get_name() == "p": - x, y, z = atom.get_coord() - glVertex3f(x, y, z) - glEnd() - glFlush() - - # Inicializando a matriz de projeção - glMatrixMode(GL_PROJECTION) - glLoadIdentity() - gluPerspective(45, (800 / 600), 1, 50) - - # Definindo a posição do observador - glMatrixMode(GL_MODELVIEW) - glLoadIdentity() - gluLookAt(0, 0, -15, 0, 0, 0, 0, 1, 0) - - # Iniciando o loop de renderização - glutDisplayFunc(render) - glutIdleFunc(render) - glutMainLoop() - -if __name__ == "__main__": - # Substituindo "dna.pdb" pelo caminho do arquivo PDB que contém a estrutura do DNA - dna_structure = load_dna_structure("dna.pdb") - draw_dna_model(dna_structure) \ No newline at end of file diff --git a/test/dna-test.py b/test/dna-test.py index 3246678..bac4c7b 100644 --- a/test/dna-test.py +++ b/test/dna-test.py @@ -32,4 +32,5 @@ def draw_dna_model(model): if atom.get_name() == "p": x, y, z = atom.get_coord() glVertex3f(x, y, z) - glEnd() \ No newline at end of file + glEnd() + From 37e1bec3ffa50001d6e754fcc977eed9618fce24 Mon Sep 17 00:00:00 2001 From: Matheus Sameck <105814501+sameckmatheus@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:53:00 -0300 Subject: [PATCH 7/7] Update README.md --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be2c69d..a35b483 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ -# 3D_DNA +# Modelo 3D do DNA com Biopython e PyOpenGL -Modelo 3D do DNA utilizando as bibliotecas Biopython e PyOpenGL para criar uma representação gráfica do elemento em questão +Este projeto consiste em utilizar as bibliotecas Biopython e PyOpenGL para criar um modelo em 3D do DNA. + +## Pré-requisitos + +Antes de executar o projeto, é necessário instalar as bibliotecas Biopython e PyOpenGL. Você pode fazer isso através dos seguintes comandos: + + pip install biopython + pip install PyOpenGL + pip install PyOpenGL_accelerate + +Além disso, é importante ter um conhecimento básico em Biologia Molecular e programação em Python. + +## Utilização + +Para utilizar o modelo 3D do DNA, execute o arquivo `dna_model.py` através do terminal ou de um ambiente de desenvolvimento Python. O modelo será exibido em uma janela gráfica. + +Caso deseje mudar as configurações do modelo, como a posição do observador e o zoom, altere os valores das constantes no início do arquivo `dna_model.py`. + +## Licença + +Este projeto está licenciado sob a licença \[MIT]. Leia o arquivo LICENSE para mais detalhes.