Hi Pete,
it's surely beneficial and good to know how software works especially if
it's part of your research, I entirely agree. Though, on the other hand, I
don't feel too bad about not knowing the CS behind the implementation of MS
Word when I use it for my documents editing. I guess it depends h
Nat,
I agree that deep understanding of column-formatted text isn't really
necessary (there's not much internal complexity there).
I was attempting to point out that the general rule of not re-inventing
the wheel doesn't always apply. Even when we're addressing biological
questions, if we'r
On Fri, Jun 7, 2013 at 8:37 AM, Pete Meyer wrote:
> On the other hand, programming an implementation of something is a good
> way to make sure that you really understand it - even if you end up using
> another program.
I would argue that it's not really necessary to understand the column
format
"Resist the urge to duplicate the work of others" should be the first rule of
programming if its not already (although it's the hardest rule to follow).
On the other hand, programming an implementation of something is a good
way to make sure that you really understand it - even if you end up
> "Resist the urge to duplicate the work of others" should be the first rule of
> programming if its not already (although it's the hardest rule to follow).
I completely agree in principal, but certainly practicality is different. If
you're doing anything complex, or even doing several simple
On Jun 5, 2013, at 10:41 PM, Nat Echols wrote:
> On Thu, Jun 6, 2013 at 2:37 PM, GRANT MILLS
> wrote:
> My script seems to miscount the columns and read the two as one column, does
> anyone know how to avoid this? (PS, I've googled this like crazy but I either
> don't understand or the link i
Hi Grant -
In addition to the other good suggestions, there is also the Biopython
project's PDB parser.
http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc148
Cheers,
Jared
--
Jared Sampson
Xiangpeng Kong Lab
NYU Langone Medical Center
Old Public Health Building, Room 610
341 East 25th
#for line in open("PDBfile.pdb"):
#if "ATOM" in line:
#column=line.split()
#c4=column[4]
If you're dealing with a pdb that may have REMARK lines, you're better
off using "if line.startswith('ATOM') or line.startswith('HETATM')" for
your conditional here.
I'd also use the
You could use FORTRAN. It's good at formatted I/O.
On 06/06/13 00:37, GRANT MILLS wrote:
Dear CCP4BB,
I'm trying to write a simple python script to retrieve and manipulate
PDB data using the following code:
#for line in open("PDBfile.pdb"):
#if "ATOM" in line:
#column=line.split(
On Thu, 2013-06-06 at 14:41 +1000, Nat Echols wrote:
> You should resist the temptation to write your own PDB parser; that
> way lies pain and suffering. There are multiple free libraries for
> Python that can be used for this task - I recommend either CCTBX or
> BioPython (probably the latter if
ATOM records have fixed format so you can (and should) use string
slicing instead, like so (one-liner)
serial, aname, altloc, resn, chid, resi, insCode, x, y, z, occ, b,
element, q = line[6:11], line[12:16], line[16], line[17:20], line[21],
line[22:26], line[26], line[30:38], line[38:46], line[46:
Grant,
Python will do this sort of thing using strings - you can split a text string
by the character positions.
For example:
mystring='abcdefg'
mystring[0:3]
will return...
'abc'
and...
mystring[4:5]
will return 'de' etc.
The PDB format is fixed - so you can use this approach to get the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Dear Grant,
computer programs split fields based on a 'field separator', usually
e.g. a space or tab or end-of-line. There is nothing to separate
"1.00201.10" into two fields, and you as a human only can read this
because you know that
a) these should
On Thu, Jun 6, 2013 at 2:37 PM, GRANT MILLS wrote:
> My script seems to miscount the columns and read the two as one column,
> does anyone know how to avoid this? (PS, I've googled this like crazy but I
> either don't understand or the link is irrelevant)
>
You should resist the temptation to w
Dear CCP4BB,
I'm trying to write a simple python script to retrieve and manipulate PDB data
using the following code:
#for line in open("PDBfile.pdb"):
#if "ATOM" in line:
#column=line.split()
#c4=column[4]
and then writing to a new document with:
#with open("selection.pdb"
15 matches
Mail list logo