Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/dscience/biology/parser/Pdbml.d b/src/dscience/biology/parser/Pdbml.d
- index 2389f92..02211ee 100644
- --- a/src/dscience/biology/parser/Pdbml.d
- +++ b/src/dscience/biology/parser/Pdbml.d
- @@ -18,6 +18,7 @@ private import tango.io.Stdout;
- alias Document!(char) XML;
- +
- public class Pdbml{
- private File pdbml;
- private XmlPath!(char).NodeSet root;
- @@ -66,7 +67,7 @@ public class Pdbml{
- return molecules;
- }
- - public IProtein getProtein(uint model, size_t entity_id, char[][][]peptides ...){
- + public IProtein getProtein(uint model, size_t entity_id, char[][][]peptides){
- auto struct_ref_seqCategory = root.descendant("struct_ref_seqCategory");
- auto struct_ref_seq = struct_ref_seqCategory.child("struct_ref_seq").dup;
- IMolecule[][] molecules = new IMolecule[][](peptides.length);
- @@ -85,7 +86,7 @@ public class Pdbml{
- }
- }
- molecules.length = index;
- - createDisulfideBond(molecules, strands);
- + /*createDisulfideBond*/ helper(molecules, strands);
- IProtein protein = new Protein(proteinName, molecules);
- protein.doPeptideBond();
- return protein;
- @@ -179,13 +180,31 @@ public class Pdbml{
- }
- }
- }
- -
- - private void createDisulfideBond(IMolecule[][] molecules, uint[char[]] strands){
- +
- + void helper(IMolecule[][] molecules, uint[char[]] strands)
- + {
- + bool myFilter(XML.Node n)
- + {
- + /*
- + //segfaults
- + bool a1 = (n.query.child("conn_type_id").nodes[0].value == "disulf");
- + bool a2 = (n.query.child("ptnr1_label_asym_id").nodes[0].value in strands) !is null;
- + bool a3 = (n.query.child("ptnr2_label_asym_id").nodes[0].value in strands) !is null;
- + return a1 && a2 && a3;
- + */
- + //works
- + return n.query.child("conn_type_id").nodes[0].value == "disulf" &&
- + (n.query.child("ptnr1_label_asym_id").nodes[0].value in strands && n.query.child("ptnr2_label_asym_id").nodes[0].value in strands);
- + }
- auto struct_connCategory = root.descendant("struct_connCategory");
- - auto struct_conn = struct_connCategory.child("struct_conn").filter((XML.Node n) {
- - return n.query.child("conn_type_id").nodes[0].value == "disulf" && (n.query.child("ptnr1_label_asym_id").nodes[0].value in strands && n.query.child("ptnr2_label_asym_id").nodes[0].value in strands);
- - }).dup;
- - foreach(molecule; struct_conn){
- + auto struct_conn = struct_connCategory.child("struct_conn").filter(&myFilter).dup;
- + createDisulfideBond(molecules, strands, struct_conn);
- + }
- +
- + void createDisulfideBond(IMolecule[][] molecules, uint[char[]] strands, XmlPath!(char).NodeSet struct_conn)
- + {
- + foreach(molecule; struct_conn)
- + {
- size_t molecule1Index = Convert.to!(size_t)(molecule.query.child("ptnr1_label_seq_id").nodes[0].value) - 1;
- size_t molecule2Index = Convert.to!(size_t)(molecule.query.child("ptnr2_label_seq_id").nodes[0].value) - 1;
- char[] ptnr1_label_asym_id = molecule.query.child("ptnr1_label_asym_id").nodes[0].value;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement