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

  • Home
  • SEARCH
  • 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 7828261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:16:40+00:00 2026-06-02T10:16:40+00:00

I’m trying to come up with a good algorithm to create an representation of

  • 0

I’m trying to come up with a good algorithm to create an representation of a right handed DNA string with major and minor grooves using the dash character, for an arbitrary number of characters.

This is what I currently have, using 776 #‘s:

  #########                 ##########
    #########                ##########
      #########              ##########
        #########          ##########
          ##########     ##########
            ########## ##########
              ###### ##########
                ## ##########
                 ########## #
               ########## #####
             ########## #########
           ##########    ##########
         ##########        ##########
       ##########           ##########
     ##########             ##########
   ##########               ##########
  ##########               ##########
  ##########             ##########
  ##########           ##########
   ##########        ##########
     ###########   ##########
       ######### ##########
         ##### ##########
           # ##########
           ########## ###
         ########## #######
       ##########  ##########
     ##########      ##########
   ##########          ##########
  ##########             ##########
  ##########               ##########
  ##########                 ##########
   ##########                 ##########
     ##########               ##########
       ##########             ##########
         ##########          ##########
           ##########      ##########
             ##########  ##########
               ####### ##########
                 #### #########
                    ######### #
                  ########## ###
                ########### #######

but the helix doesn’t align perfectly when I manually try to repeat the helix via copy/pasting.

A solution that has has the same width as the example above but also has the basepair crossbonds (like in this image or in the scarf pattern below), is also acceptable.

scarf pattern

  • 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-02T10:16:41+00:00Added an answer on June 2, 2026 at 10:16 am

    The key to this question is to recognize that you can represent each strand on the helix as a combination of sine waves – one for the periodic portion, and one for the “depth” into the page. Once you’ve parameterized the problem this way, you can control every aspect of your helix. The example below uses * and # to show the different strands to illustrate the point. If you choose values for the wavelength that do not commensurate with integer values you’ll get less then optimal results – but now you can play with inputs to find what you consider the most aesthetically pleasing representation.

    from numpy import *
    
    amp = 10
    length = 100
    wavelength = 20
    
    omega = (2*pi)/wavelength
    phi   = wavelength*(0.5)
    X = arange(1,length)
    Y1 = round_(amp*(sin(omega*X) + 1))
    Y2 = round_(amp*(sin(omega*X+phi) + 1))
    
    offset = phi/2
    Z1 = sin(omega*X + offset)
    Z2 = sin(omega*X + phi + offset)
    
    T1 = " ######### "
    T2 = " ********* "
    clen = len(T1)
    
    H = zeros((length,amp*2+clen),dtype='str')
    H[:,:] = " "
    
    for n,(y1,y2,z1,z2) in enumerate(zip(Y1,Y2,Z1,Z2)):
        H[n,y1:y1+clen] = list(T1)
        H[n,y2:y2+clen] = list(T2)
    
        # Overwrite if first helix is on top
        if z1>z2: H[n,y1:y1+clen] = list(T1)
    
    for line in H:
        print "".join(line)
    

    These values give:

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.