Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #3574 > unrolled thread
| Started by | Cee Joe <cyril_jose@ymail.com> |
|---|---|
| First post | 2011-04-27 15:02 -0500 |
| Last post | 2011-04-29 16:10 -0500 |
| Articles | 2 on this page of 22 — 5 participants |
Back to article view | Back to comp.lang.ruby
File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-27 15:02 -0500
Re: File position and buffers Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-04-27 16:47 -0500
Re: File position and buffers jake kaiden <jakekaiden@yahoo.com> - 2011-04-27 17:33 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-27 19:08 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-27 19:50 -0500
Re: File position and buffers Robert Klemme <shortcutter@googlemail.com> - 2011-04-28 02:54 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 13:06 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 13:25 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-28 13:29 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-28 09:06 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 12:47 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-28 13:27 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 18:31 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-28 20:05 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-28 21:58 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-29 10:20 -0500
Re: File position and buffers jake kaiden <jakekaiden@yahoo.com> - 2011-04-28 22:36 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-29 12:50 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-29 13:32 -0500
Re: File position and buffers 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-29 17:45 -0500
Re: File position and buffers jake kaiden <jakekaiden@yahoo.com> - 2011-04-29 15:38 -0500
Re: File position and buffers Cee Joe <cyril_jose@ymail.com> - 2011-04-29 16:10 -0500
Page 2 of 2 — ← Prev page 1 [2]
| From | jake kaiden <jakekaiden@yahoo.com> |
|---|---|
| Date | 2011-04-29 15:38 -0500 |
| Message-ID | <a48e3036b96252193f485c2d5c546087@ruby-forum.com> |
| In reply to | #3574 |
hi Cee -
hmm, i'm getting a bit confused as to what exactly you're trying to do
- but if you want to load all this stuff into a buffer without the
newlines, and regardless of how many newlines you have between each
entry (assuming that an "entry" is something that starts with ">") - i
don't see why this wouldn't work:
f = "0text.txt"
file = File.open(f)
buffer = []
bufferindex = 0
file.each(sep = ">"){|line|
buffer[bufferindex] = line
bufferindex += 1
}
## here you would do something more interesting
buffer.collect{|line|
line = line.delete("\n")
p ">#{line}"
}
which will return...
">>"
">gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895),
mRNAAGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG>"
">gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895),
mRNAGTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATGCGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG>"
">gi|3542945647|ref|NM_7453343.5Acc3| Def3 zgc:65895 (zgc:65895),
mRNACGTGCGGGGABCCGTACGTGCCGTGGGGGTTTAATAGCGCGCCATCTGAGCAGTTAGTCGCTGACGCATGCACG"
...whether you have 0 or 100,000 newlines between each entry. is this
not what you're looking for?
-j
--
Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [next] | [standalone]
| From | Cee Joe <cyril_jose@ymail.com> |
|---|---|
| Date | 2011-04-29 16:10 -0500 |
| Message-ID | <090da92f89a453132178ba5faadfcc2c@ruby-forum.com> |
| In reply to | #3574 |
Hi Jake, I would still need the header intact, which should be away from the rest of the entry: >gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895), mRNA AGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG instead of: ">gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895), mRNAAGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG>" Still need the header line so I can extract information from that and the lines after that in each entry. Your delete() will delete all the newlines, which would not be beneficial in this scenario. Thanks for the input, appreciate it. -Cee -- Posted via http://www.ruby-forum.com/.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.ruby
csiph-web