Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3624

Re: File position and buffers

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail
From Cee Joe <cyril_jose@ymail.com>
Newsgroups comp.lang.ruby
Subject Re: File position and buffers
Date Thu, 28 Apr 2011 09:06:53 -0500
Organization Service de news de lacave.net
Lines 39
Message-ID <0af64604aa1f5420f16889a3f19dbd0b@ruby-forum.com> (permalink)
References <10d8ae57765e21626a7c64873dcba807@ruby-forum.com>
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1303999629 30371 65.111.164.187 (28 Apr 2011 14:07:09 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Thu, 28 Apr 2011 14:07:09 +0000 (UTC)
In-Reply-To <10d8ae57765e21626a7c64873dcba807@ruby-forum.com>
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 382302
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <0af64604aa1f5420f16889a3f19dbd0b@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:3624

Show key headers only | View raw


Thanks guys for your helpful comments. I will be more descriptive. I am 
an intern and my mentor wants me to use the IO.pos to read the 
characters of the file until the character reaches the ">" symbol. SO 
upon the cursor reaching the ">" symbol(which is the start of a new 
entry), he wants me to place that previous entry in a buffer. Here is 
the actual test file I am working with:

>gi|329295464|ref|NM_2005745.3Acc1| Def1 zgc:65895 (zgc:65895), mRNA\n
AGCTCGGGGGCTCTAGCGATTTAAGGAGCGATGCGATCGAGCTGACCGTCGCG\n
\n
>gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895), mRNA\n
GTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATG\n
CGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG\n
\n
>gi|3542945647|ref|NM_7453343.5Acc3| Def3 zgc:65895 (zgc:65895), mRNA\n
CGTGCGGGGABCCGTACGTGCCGTGGGGGTTTAATAGCGCGCCATCTGAGCAG\n
TTAGTCGCTGACGCATGCACG\n
\n

7stud, you are right there are two consecutive newlines which I failed 
to mention. This should be the output of a buffer for one entry:

>gi|456299107|ref|NM_2342343.3Acc2| Def2 zgc:65895 (zgc:65895), mRNA\n
GTCGCTGGGTCGAAAAGTGGTGCTATATCGCGGCTCGCGTCGATGTCGCGATG <-- no "\n"
CGTGCGCGCGAGAGCGCGCTATGATGAAAGGATGAGAGAG <-- no "\n"


Notice how the newlines are gone. So with the exception of the header in 
each entry, the newlines should be gone and be placed in a buffer. I am 
lost on how to use the IO.pos and a file iterator to make sure each 
respective entry goes into a buffer without the file being indexed into 
memory.

Thanks in advance, I'm new to the language and trying to wrap my head 
around it.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web