How to unfold only protein atoms using Bio.PDB.Selection?











up vote
3
down vote

favorite












from Bio.PDB import PDBParser
from Bio.PDB import Selection
structure = PDBParser().get_structure('4GBX', '4GBX.pdb') # load your molecule
atom_list = Selection.unfold_entities(structure[0]['E'], 'A') # 'A' is for Atoms in the chain 'E'


When I unfold chain E in the PDB 4GBX using the code above, the last 2 Oxygen atoms in atom_list belong to water heteroatoms in the same chain. How can I get a list of only protein residue atoms and avoid other ligands or water molecules in the selection?










share|improve this question
























  • I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
    – quant
    Nov 15 at 20:44










  • 4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
    – mahaswap
    Nov 15 at 21:21










  • atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
    – mahaswap
    Nov 15 at 21:33






  • 1




    Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
    – quant
    Nov 15 at 21:35








  • 1




    Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
    – mahaswap
    Nov 15 at 21:58















up vote
3
down vote

favorite












from Bio.PDB import PDBParser
from Bio.PDB import Selection
structure = PDBParser().get_structure('4GBX', '4GBX.pdb') # load your molecule
atom_list = Selection.unfold_entities(structure[0]['E'], 'A') # 'A' is for Atoms in the chain 'E'


When I unfold chain E in the PDB 4GBX using the code above, the last 2 Oxygen atoms in atom_list belong to water heteroatoms in the same chain. How can I get a list of only protein residue atoms and avoid other ligands or water molecules in the selection?










share|improve this question
























  • I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
    – quant
    Nov 15 at 20:44










  • 4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
    – mahaswap
    Nov 15 at 21:21










  • atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
    – mahaswap
    Nov 15 at 21:33






  • 1




    Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
    – quant
    Nov 15 at 21:35








  • 1




    Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
    – mahaswap
    Nov 15 at 21:58













up vote
3
down vote

favorite









up vote
3
down vote

favorite











from Bio.PDB import PDBParser
from Bio.PDB import Selection
structure = PDBParser().get_structure('4GBX', '4GBX.pdb') # load your molecule
atom_list = Selection.unfold_entities(structure[0]['E'], 'A') # 'A' is for Atoms in the chain 'E'


When I unfold chain E in the PDB 4GBX using the code above, the last 2 Oxygen atoms in atom_list belong to water heteroatoms in the same chain. How can I get a list of only protein residue atoms and avoid other ligands or water molecules in the selection?










share|improve this question















from Bio.PDB import PDBParser
from Bio.PDB import Selection
structure = PDBParser().get_structure('4GBX', '4GBX.pdb') # load your molecule
atom_list = Selection.unfold_entities(structure[0]['E'], 'A') # 'A' is for Atoms in the chain 'E'


When I unfold chain E in the PDB 4GBX using the code above, the last 2 Oxygen atoms in atom_list belong to water heteroatoms in the same chain. How can I get a list of only protein residue atoms and avoid other ligands or water molecules in the selection?







python bioinformatics biopython pdb protein-database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 at 21:16

























asked Nov 15 at 20:08









mahaswap

518




518












  • I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
    – quant
    Nov 15 at 20:44










  • 4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
    – mahaswap
    Nov 15 at 21:21










  • atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
    – mahaswap
    Nov 15 at 21:33






  • 1




    Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
    – quant
    Nov 15 at 21:35








  • 1




    Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
    – mahaswap
    Nov 15 at 21:58


















  • I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
    – quant
    Nov 15 at 20:44










  • 4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
    – mahaswap
    Nov 15 at 21:21










  • atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
    – mahaswap
    Nov 15 at 21:33






  • 1




    Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
    – quant
    Nov 15 at 21:35








  • 1




    Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
    – mahaswap
    Nov 15 at 21:58
















I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
– quant
Nov 15 at 20:44




I seem to be a bit blind - 4gbx (rcsb.org/structure/4GBX) ... chain E? Are you speaking of atom number 6089 and 6091? However they belong to THR no?
– quant
Nov 15 at 20:44












4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
– mahaswap
Nov 15 at 21:21




4gbx: chain E: water residue numbers 101 and 102: atom numbers 6190 and 6191. Thanks.
– mahaswap
Nov 15 at 21:21












atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
– mahaswap
Nov 15 at 21:33




atom_list[-1].get_full_id() Out[21]: ('4GBX', 0, 'E', ('W', 102, ' '), ('O', ' ')) The 'W' here is for water heteroatom.
– mahaswap
Nov 15 at 21:33




1




1




Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
– quant
Nov 15 at 21:35






Yes, saw that too. However are you sure that the 'W' only occurs for heteroatoms? If yes, you can use something like print([atom for atom in atom_list if atom.get_full_id()[3][0] == " "]) to filter your list ...
– quant
Nov 15 at 21:35






1




1




Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
– mahaswap
Nov 15 at 21:58




Thanks @quant . I think that should do the trick. I guess I need a coffee or two. I remember now that I had done the exact same thing some months ago.
– mahaswap
Nov 15 at 21:58

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327180%2fhow-to-unfold-only-protein-atoms-using-bio-pdb-selection%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327180%2fhow-to-unfold-only-protein-atoms-using-bio-pdb-selection%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?