Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:07:50+00:00 2026-06-17T13:07:50+00:00

I have a very long string containing DNA sequence data, which is usually about

  • 0

I have a very long string containing DNA sequence data, which is usually about 500k to 5m characters long.
I want to cut of the first n characters from the beginning and add them to the end of that string.

I need to run that method for approx. 2000 DNA sequences – that’s why i am worried about speed. I don’t want to block my computer for all week.

What is the most efficient way to do that in ruby?

A side-question would be the memory-efficiency. Since i only need to run this task once per sequence, it is not that much important for me, but usually fast does not mean less memory, right? My computer has 2 gigs RAM available(hopefully it is enough).

If you are interested why i need to do this:

The reason why i’d like to do this is, that my source material is analysed for a specific point in the DNA. This point needs to be somewhere in the middle of the DNA for more convenience in later analysis. If this point is to close to the end or to the beginning, i need to split and concat the DNA sequence string.The sequences are circular and the point is the top BLAST hit for dnaA in the bacterial genome (from NCBI database). Since most annotations tend to use the location of the dnaA gene as start, this is pretty annoying if you want to work with the area around that gene.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:07:52+00:00Added an answer on June 17, 2026 at 1:07 pm

    Sounds interesting!

    You can run the rubinius benchmarks and see which method is the most efficient: https://github.com/rubinius/rubinius/tree/master/benchmark/core/string

    You don’t have to install rubinius for that but it will give you multithreaded ruby, just like jruby, which might be faster if you have multiple cores on your computer.

    To learn how to run the benchmarks check this here: http://rubini.us/doc/en/how-to/write-benchmarks/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very long String and I want to read character by character
I have a very long string which includes many new lines ( it's a
I have a variable x to which I want to assign a very long
I have this code: String s = A very long string containing + many
I have a very long string ( 60MB in size) in which I need
I have a very long string that I want to split into 2 pieces.
I have a very long string variable(2000+ characters) in JavaScript and I need to
If I have a very long string (without spaces!). Can I force the browser
I have a complex situation where I need to parse a very long string.
i have a very long hex string in a byte array and I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.