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 1104353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:28:16+00:00 2026-05-17T01:28:16+00:00

I want to store some genomic positions (chromosome,position) using MongoDB. something like: { chrom:chr2,

  • 0

I want to store some genomic positions (chromosome,position) using MongoDB.

something like:

{
chrom:"chr2",
position:100,
name:"rs25"
}

I want to be able to quickly find all the records in a given segment (chrom , [posStart – posEnd]). What would be the best key/_id to be used ?

a chrom , position object ?

db.snps.save({_id:{chrom:"chr2",position:100},name:"rs25"})

a padded string ?

db.snps.save({_id:"chr02:00000000100",chrom:"chr2",position:100,name:"rs25"})

an auto-generated id with an index on chrom and position ?

db.snps.save({chrom:"chr2",position:100,name:"rs25"})

other ?

???

thanks for your suggestion(s)

Pierre

PS: (this question was cross posted on biostar: http://biostar.stackexchange.com/questions/2519 )

  • 1 1 Answer
  • 4 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-05-17T01:28:17+00:00Added an answer on May 17, 2026 at 1:28 am

    I believe the two-column index will offer the fastest access path, because it will be the most compact index.

    However, it will be an additonal index (since you already have the _id index, which you are not using), so the first two options are nice in that they eliminate the extra index.

    The padded string is shorter than the complex object solution, shorter means less memory use, hence faster the scan. I’d only go for complex object, if flattening/padding is not possible.
    Also, since the complex object keys need to be encoded into the index (not the case with other indexes), choose shorter key names (c and p).

    So, I’d go for two-column index (if you do not mind “wasting” the id index) or padded string. You could even go padded binary (saving a few bytes on encoding the integer), but that is probably not worth the hassle.

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

Sidebar

Related Questions

I want to use Context.Items to store some info of a User Control like:
I want to store some information about my rails application, like a version number.
I want to store some data from structures like this: class Project { ChildA
I want to store some values in browser using cookies but i don't do
I want to store some values in a balanced binary search tree using C#.
i want to store some element String.XML's array. Values are given bellow <string-array name=values>
I want to store some basic data like players_name,levels_completed,fastest_speed,fastest_time and bring it up each
I want to store some data during my site viewing. Sometime i need to
I want to store some value from SQLite database in my buffer, but the
I want to use session object in my web app.I want to store some

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.