<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>I am currently working on a subpackage for Biopython (called
      Bio.Structure), that converts a Bio.PDB.Model.Model into a numpy
      array containing coordinates and annotations for doing easily
      efficient calculations (for example calculating average
      structure). This array can be converted back into a
      Bio.PDB.Model.Model and than saved as PDB file using PDBIO().
      Currently docstrings and code comments are missing, so I will
      contribute this code only in a few days, but you can check out the
      source code at
      <a class="moz-txt-link-freetext" href="https://github.com/padix-key/biopython/tree/numpy-structure">https://github.com/padix-key/biopython/tree/numpy-structure</a>.</p>
    <p>Best regards,</p>
    <p>Patrick Kunzmann<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Am 23.05.2017 um 12:04 schrieb Souparno
      Adhikary:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAL6QJ1Api4pHUPjeEsiS7uj2GZE48F5MCgJ-JuRGh4dVbKut=A@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>
            <div>I want to calculate the average structure from multiple
              frames in a pdb file and save it to another pdb file.<br>
              <br>
            </div>
            I wrote the code to calculate the average co-ordinates
            successfully like below:<br>
            <br>
            #!/usr/bin/python<br>
            <br>
            from Bio.PDB.PDBParser import PDBParser<br>
            <br>
            import numpy as np<br>
            <br>
            parser=PDBParser(PERMISSIVE=1)<br>
            <br>
            structure_id="mode_7"<br>
            filename="mode_7.pdb"<br>
            structure=parser.get_structure(structure_id, filename)<br>
            model1=structure[0]<br>
            s=(124,3)<br>
            newc=np.zeros(s,dtype=np.float32)<br>
            counter=1<br>
            fincoord=[]<br>
            for i in range(0,29):<br>
                coord=[]    <br>
                model=structure[i]<br>
                for chain in model.get_list():<br>
                    for residue in chain.get_list():<br>
                        ca=residue["CA"]<br>
                        coord.append(ca.get_coord())<br>
            <br>
                newc=np.add(newc,coord)<br>
                counter+=1<br>
            <br>
            fincoord=np.divide(newc,counter)<br>
            <br>
            print fincoord<br>
            <br>
            print "END"<br>
            <br>
          </div>
          Now I want to write the coordinates in fincoord to a new pdb
          file i.e. everything will be the same like the structure[0]
          except the coordinates. Can you tell me how can I edit the
          coordinates of a specific model or replace it with my array
          and save it to another file?<br>
          <br>
        </div>
        Thanks<br clear="all">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div class="gmail_signature">
                    <div dir="ltr"><br>
                    </div>
                    <div>Souparno Adhikary,<br>
                    </div>
                    <div>CHPC Lab,<br>
                    </div>
                    <div>University of Calcutta.<br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Biopython mailing list  -  <a class="moz-txt-link-abbreviated" href="mailto:Biopython@mailman.open-bio.org">Biopython@mailman.open-bio.org</a>
<a class="moz-txt-link-freetext" href="http://mailman.open-bio.org/mailman/listinfo/biopython">http://mailman.open-bio.org/mailman/listinfo/biopython</a></pre>
    </blockquote>
    <br>
  </body>
</html>