Giter VIP home page Giter VIP logo

dnamatching_racket's Introduction

;; CMPU101 Spring 2011
;; HW 9 - Printing matching DNA strands
;; Due Dec 9th

(require 2htdp/universe)
(require 2htdp/image)
(load "helper.rkt")
;; NOTE: ALL THE FUNCTIONS FROM "lab12sol.rkt" CAN BE LOADED INTO THIS FILE:
;(load "lab12sol.rkt")

;; CREATE A FOLDER CALLED HW9 AND SUBMIT THE FOLDER WHEN YOU ARE DONE.


; 
;  In lab 12, you wrote the following functions:
;     lower->upper
;     invalid-bases?
;     convert-to-complement
;     find-first-matching-position
;     
;  You will use these functions in this homework assignment to create an inter- 
;  active DNA sequence matcher.
;  
;  The main function in this program will be called start-sequence and it should
;  do the following:
;  
;     1. Prompt for and read a "long" DNA sequence, checking if the sequence
;        entered contains all valid characters and converting it to all
;        upper-case.  If an invalid sequence is entered, you should tell the
;        user that the sequence is invalid and prompt them for another.
;        
;        Prompt for and read a "short" DNA sequence, checking if the sequence
;        entered contains all valid characters and converting it to all
;        upper-case.  If an invalid sequence is entered, you should tell the
;        user that the sequence is invalid and prompt them for another.
;        
;        (Note: There are enough similarities in the two paragraphs above to
;         make you think of writing a helper function for step 1.)
;        
;     2. Once both valid sequences have been entered and stored in local
;        variables, convert the short sequence to its complement and 
;        use the find-first-matching-position function to return the position
;        in the long sequence that matches the complement of the short 
;        sequence.
;        
;     3. If a match is found, you should print the two sequences as if they
;        were each attached like rungs of a ladder. 
;        
;        A few sample runs of the desired program are shown below:
;               
;        
; ; > (start-sequence)
; ; 
; ; Please enter a long DNA sequence
; ; caggttatt
; ; 
; ; Please enter a short DNA sequence
; ; aata
; ; 
; ; Long is CAGGTTATT, short is AATA
; ; 
; ; AATA matches CAGGTTAT at position 4
; ; 
; ;             ------------
; ;              |  |  |  |
; ;              A  A  T  A
; ;  C  A  G  G  T  T  A  T 
; ;  |  |  |  |  |  |  |  | 
; ; ------------------------
; 
;  
; ; > (startSequence)
; ; 
; ; Please enter a long DNA sequence
; ; rrattks
; ; 
; ; The sequence RRATTKS has some invalid base notation.
; ; 
; ; 
; ; Please enter a long DNA sequence
; ; gggggggaaattc
; ; 
; ; Please enter a short DNA sequence
; ; lkdrsgat
; ; 
; ; The sequence LKDRSGAT has some invalid base notation.
; ; 
; ; 
; ; Please enter a short DNA sequence
; ; tttt
; ; 
; ; Long is GGGGGGGAAATTC, short is TTTT
; ; 
; ; No match found.
; ;  
; 
; 
; ; > (startSequence)
; ; 
; ; Please enter a long DNA sequence
; ; GATTCTG
; ; 
; ; Please enter a short DNA sequence
; ; CTA
; ; 
; ; Long is GATTCTG, short is CTA
; ; 
; ; CTA matches GATTCTG at position 0
; ; 
; ; ---------
; ;  |  |  | 
; ;  C  T  A 
; ;  G  A  T  T  C  T  G 
; ;  |  |  |  |  |  |  | 
; ; ---------------------
; 
; 


; 
;  The most challenging part of this assignment is to print the matching dna sequences 
;  in the format shown.
;  
;  Formatting the print statements may require more than one function. For example,
;  to print the following:
;  
;           ------------
;            |  |  |  |
;            C  G  A  T
;   A  T  G  G  C  T  A  T
;   |  |  |  |  |  |  |  |
;  ------------------------
;  
;  you must use the information about the position on the longer sequence at which the
;  sequences match.  In the example above, the position is 3.  Since the short 
;  sequence should always be printed above the longer one, this requires building a 
;  string consisting of three sets of three blank spaces, followed by 4 sets of 
;  "---", followed by an end of line.  The strings that make up the second and third 
;  lines should similarly start with three sets of three blank spaces.
;  
;   



(test)

dnamatching_racket's People

Contributors

catmorgan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.