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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:07:43+00:00 2026-06-12T00:07:43+00:00

Maybe my title can be misleading, but let me clarify my question: Here’s a

  • 0

Maybe my title can be misleading, but let me clarify my question:

Here’s a list:

chr1:100-200 100 100
chr1:350-500 150 250
chr1:780-880 100 350
chr1:900-950 50  400

So basically the first column is coordinate range, second column is the interval length (substraction between the two coordinates from the first column), third column is the accumulation for the interval length.

Now I have a number, say 120. What I need to do is: since 100 < 120 < 250 (to compare my object with the key), and the key should point to the value “chr1:350-500″;
similarly, if my number is 360, since 350 < 360 < 400, the value should be :”chr1:900-950”

Hopefully I’ve made it clear. I guess I should use dictionary or hashtable to solve the problem, but here involves compare my object with keys; and I don’t know how to do it.

Many thanks

  • 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-12T00:07:45+00:00Added an answer on June 12, 2026 at 12:07 am

    Actually, no.

    >>> ranges = ['chr1:100-200', 'chr1:350-500', 'chr1:780-880', 'chr1:900-950']
    >>> accums = [100, 250, 350, 400]
    >>> ranges[bisect.bisect_left(accums, 120)]
    'chr1:350-500'
    >>> ranges[bisect.bisect_left(accums, 360)]
    'chr1:900-950'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe the title is a little misleading and question could be too, but I'm
Maybe my title is not the best but here is what I really want.I
What a crappy title. Maybe someone can edit it for me. Here's the scoop:
May be my title wording can be misleading, but this is what I'm trying
Maybe not the best title I can think of but my problem is this:
Maybe title is confusing you, but the problem is concretely here : I have
Maybe the title is not so clear. Let me clarify what I'm trying to
Maybe the question title is a little confusing, so I'll try to clarify things
Maybe this is a very simple question, but I can't find the answer: How
Maybe my question title is not the right one but ill describe whats my

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.