Re: [Tutor] map one file and print it out following the sequence

2011-10-13 Thread Dave Angel
On 10/13/2011 09:09 AM, lina wrote: I think your final version of sortfile() might look something like: def sortfile(infilename=**INFILENAME, outfilename=OUTFILENAME): infile = open(infilename, "r") intext = infile.readlines() outfile = open(OUTFILENAME, "w") for chainid in CH

Re: [Tutor] map one file and print it out following the sequence

2011-10-13 Thread Andreas Perstinger
On 2011-10-13 15:09, lina wrote: $ python3 map-to-itp.py {'O4': '2', 'C19': '3', 'C21': '1'} C Traceback (most recent call last): File "map-to-itp.py", line 55, in sortfile() File "map-to-itp.py", line 17, in sortfile sortoneblock(chainid,intext,OUTFILENAME) File "map-to-itp.py

Re: [Tutor] map one file and print it out following the sequence

2011-10-13 Thread lina
> I think your final version of sortfile() might look something like: > > def sortfile(infilename=**INFILENAME, outfilename=OUTFILENAME): >infile = open(infilename, "r") >intext = infile.readlines() >outfile = open(OUTFILENAME, "w") >for chainid in CHAINID: >print("chain i

Re: [Tutor] map one file and print it out following the sequence

2011-10-12 Thread Dave Angel
On 10/12/2011 09:57 AM, lina wrote: I do have problems to write each blocks (differentiated by chainID) back one by one, but this will leave it at the end. at present I still have following problems Q1: why the D E F G H I stopped being processed. In what sense do you mean stopped? There are

Re: [Tutor] map one file and print it out following the sequence

2011-10-12 Thread lina
On Wed, Oct 12, 2011 at 8:50 PM, Andreas Perstinger < andreas.perstin...@gmx.net> wrote: > On 2011-10-12 10:27, lina wrote: > >> $ python3 map-to-itp.py >> {'O4': '2', 'C19': '3', 'C21': '1'} >> {'C': '3'} >> {'C': '2'} >> {'C': '1'} >> >> for print(mapping) part, {'O4': '2', 'C19': '3', 'C21': '

Re: [Tutor] map one file and print it out following the sequence

2011-10-12 Thread Andreas Perstinger
On 2011-10-12 10:27, lina wrote: $ python3 map-to-itp.py {'O4': '2', 'C19': '3', 'C21': '1'} {'C': '3'} {'C': '2'} {'C': '1'} for print(mapping) part, {'O4': '2', 'C19': '3', 'C21': '1'} the value doesn't keep the 1, 2, 3 order any more. That's fine, because "mapping" is a dictionary which h

Re: [Tutor] map one file and print it out following the sequence

2011-10-12 Thread lina
On Wed, Oct 12, 2011 at 3:29 PM, Andreas Perstinger < andreas.perstin...@gmx.net> wrote: > On 2011-10-12 05:31, lina wrote: > >> I tried to write one (not working one) as below, so many problems here. >> > > Just some quick remarks: Thanks, Now the newly-improved one as following: but still the

Re: [Tutor] map one file and print it out following the sequence

2011-10-12 Thread Andreas Perstinger
On 2011-10-12 05:31, lina wrote: I tried to write one (not working one) as below, so many problems here. Just some quick remarks: #!/usr/bin/python3 import os.path LINESTOSKIP=0 CHAINID="CDEFGHI" INFILENAME="pdbone.pdb" DICTIONARYFILE="itpone.itp" mapping={} valuefromdict={} def sortfile()

Re: [Tutor] map one file and print it out following the sequence

2011-10-11 Thread lina
I tried to write one (not working one) as below, so many problems here. #!/usr/bin/python3 import os.path LINESTOSKIP=0 CHAINID="CDEFGHI" INFILENAME="pdbone.pdb" DICTIONARYFILE="itpone.itp" mapping={} valuefromdict={} def sortfile(): for chainid in CHAINID: sortoneblock(chainid) d

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread Prasad, Ramit
>attached the clumsy script just to prove what I said is true. and at present I >want to "push" myself on the way of >using python. so I can actually learn >something. I think you were close to the solution. It seemed like all you needed to do was write the output to file correctly (which you

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread lina
On Thu, Oct 6, 2011 at 10:48 PM, Prasad, Ramit wrote: > >I attached the two files. > > Although I will help you, I will not do the work for you. If you are still > having errors, please include your script, python version, and the problem > (if you are getting an error include the full error). >

Re: [Tutor] map one file and print it out following the sequence

2011-10-06 Thread Prasad, Ramit
>I attached the two files. Although I will help you, I will not do the work for you. If you are still having errors, please include your script, python version, and the problem (if you are getting an error include the full error). Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currenci

Re: [Tutor] map one file and print it out following the sequence

2011-09-29 Thread Prasad, Ramit
, 'CUR', '1', '30.338', '28.778', '-6.812', '1.00', '0.00']] You should note, that I just used "print" I did not write to file. You will need to actually create/open a file, run through the list (e.g.

Re: [Tutor] map one file and print it out following the sequence

2011-09-29 Thread lina
On Thu, Sep 29, 2011 at 10:57 PM, Prasad, Ramit wrote: > From: tutor-bounces+ramit.prasad=jpmorgan@python.org [mailto: > tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of lina > Sent: Tuesday, September 27, 2011 10:35 PM > Cc: tutor > Subject: Re: [Tutor] map one

Re: [Tutor] map one file and print it out following the sequence

2011-09-29 Thread Prasad, Ramit
From: tutor-bounces+ramit.prasad=jpmorgan@python.org [mailto:tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of lina Sent: Tuesday, September 27, 2011 10:35 PM Cc: tutor Subject: Re: [Tutor] map one file and print it out following the sequence Hi, Thanks for both of your reply

Re: [Tutor] map one file and print it out following the sequence

2011-09-28 Thread Alan Gauld
On 28/09/11 04:34, lina wrote: File 1 is: 3 C 1 CUR C19 10.200 12.0110 4 CR1 1 CUR C20 1 -0.060 12.0110 5HC 1 CUR H20 10.060 1.0080 File 2 is: ATOM 2 H20 CUR 1 30.338 28.778 -6.812 1.

Re: [Tutor] map one file and print it out following the sequence

2011-09-27 Thread lina
Hi, Thanks for both of your reply. File 1 is: 3 C 1 CUR C19 10.200 12.0110 4 CR1 1 CUR C20 1 -0.060 12.0110 5HC 1 CUR H20 10.060 1.0080 File 2 is: ATOM 2 H20 CUR 1 30.338 28.778 -6.812 1.

Re: [Tutor] map one file and print it out following the sequence

2011-09-27 Thread Prasad, Ramit
>I have file 1: cur.itp > > 1   CH3 1  CUR  C1 1    0.066  15.0350   > 2    OA 1  CUR  O1 1   -0.183  15.9994   > 3 C 1  CUR  C2 1    0.126  12.0110   >and file 2: procesed.pdb >ATOM  1  H52 CUR 1  33.502  30.958  -9.83

Re: [Tutor] map one file and print it out following the sequence

2011-09-27 Thread Alan Gauld
On 27/09/11 14:45, lina wrote: Hi, I have file 1: cur.itp 1 CH3 1 CUR C1 10.066 15.0350 2OA 1 CUR O1 1 -0.183 15.9994 3 C 1 CUR C2 10.126 12.0110 and file 2: procesed.pdb ATOM 1 H52 CUR 1

[Tutor] map one file and print it out following the sequence

2011-09-27 Thread lina
Hi, I have file 1: cur.itp 1 CH3 1 CUR C1 10.066 15.0350 2OA 1 CUR O1 1 -0.183 15.9994 3 C 1 CUR C2 10.126 12.0110 4 CR1 1 CUR C3 1 -0.020 12.0110 5HC 1 CUR