generate_And_Wrap_Pseudorandom_DNA_Sequence   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/fasta_lang_shootout.xtm

Implementation

(bind-func generate_And_Wrap_Pseudorandom_DNA_Sequence
  (let ((line:|61,i8|* (alloc))
        (cumulative_Probability 0.0:f) (i 0)
        (line_Length 0) (column 0) (r 0.0:f)
        (count 0))
    (lambda (nucleotides_Information:nucleotide_info* number_Of_Nucleotides:i64 number_Of_Characters_To_Create:i64)
      (set! cumulative_Probability 0.0:f)
      (let ((cumulative_Probabilities:float* (salloc number_Of_Nucleotides))
            (current_Number_Of_Characters_To_Create number_Of_Characters_To_Create)
            (IMf (i32tof IM)))
        (dotimes (i number_Of_Nucleotides)
          (set! cumulative_Probability (+ cumulative_Probability (tref (pref-ptr nucleotides_Information i) 1)))
          (pset! cumulative_Probabilities i (* IMf cumulative_Probability)))
        (aset! line MAXIMUM_LINE_WIDTH #o012)
        (while (> current_Number_Of_Characters_To_Create 0)
          (set! line_Length MAXIMUM_LINE_WIDTH)
          (if (< current_Number_Of_Characters_To_Create MAXIMUM_LINE_WIDTH)
              (begin
                (set! line_Length current_Number_Of_Characters_To_Create)
                (aset! line line_Length #o012)))
          (dotimes (column line_Length)
            (set! r (get_LCG_Pseudorandom_Number IMf))
            (set! count 0)
            (dotimes (i number_Of_Nucleotides)
              (if (<= (pref cumulative_Probabilities i) r)
                  (set! count (+ count 1))))
            (aset! line column (tref (pref-ptr nucleotides_Information count) 0)))
          (fwrite (cast line) (+ line_Length 1) 1 stdout)
          (set! current_Number_Of_Characters_To_Create (- current_Number_Of_Characters_To_Create line_Length))))
      void)))


Back to Index

Similar Entries

  • PARAM_RANDOM    scheme
  • PARAM_RANDOM    scheme
  • VAO_bind_and_draw_arrays    xtlang
  • aiProcess_FindDegenerates    scheme
  • aiProcess_MakeLeftHanded    scheme
  • bind-wrapper    macro
  • bindfunc_with_zone_size_and_docstring    xtlang
  • cas_expand_term    xtlang
  • cl:and?    scheme
  • cond-eval-and    scheme
  • cond-expand    macro
  • cond-expand-runtime    scheme
  • constructor-name-and-type    scheme
  • cpBBExpand    xtlang
  • cpBBWrapVect    xtlang
  • cpTransformWrap    xtlang
  • cpTransformWrapInverse    xtlang
  • deconstructor-name-and-type    scheme
  • divide-and-conquer    xtlang
  • draw_color_body_frame_with_hands    xtlang
  • dsp_randn    xtlang
  • dsp_randn    xtlang
  • env-wrap    xtlang
  • expand    macro
  • generate_random_vao    xtlang
  • generate_tri_normals    xtlang
  • generate_tri_uvws    xtlang
  • get_LCG_Pseudorandom_Number    xtlang
  • get_browser_process_handler    xtlang
  • get_context_menu_handler    xtlang
  • get_dialog_handler    xtlang
  • get_display_handler    xtlang
  • get_download_handler    xtlang
  • get_drag_handler    xtlang
  • get_find_handler    xtlang
  • get_focus_handler    xtlang
  • get_geolocation_handler    xtlang
  • get_hand_data    xtlang
  • get_jsdialog_handler    xtlang
  • get_keyboard_handler    xtlang
  • get_life_span_handler    xtlang
  • get_load_handler    xtlang
  • get_render_handler    xtlang
  • get_render_process_handler    xtlang
  • get_request_handler    xtlang
  • get_resource_bundle_handler    xtlang
  • glfw_init_and_create_compatibility_window    xtlang
  • glfw_init_and_create_fullscreen_compatibility_window    xtlang
  • glfw_init_and_create_fullscreen_interaction_compatibility_window    xtlang
  • glfw_init_and_create_fullscreen_interaction_window    xtlang
  • glfw_init_and_create_fullscreen_interaction_window    xtlang
  • glfw_init_and_create_fullscreen_window    xtlang
  • glfw_init_and_create_fullscreen_window    xtlang
  • glfw_init_and_create_interaction_compatibility_window    xtlang
  • glfw_init_and_create_interaction_window    xtlang
  • glfw_init_and_create_window    xtlang
  • glwrapper-arg-list-symbols    scheme
  • glwrapper-arg-list-symbols    scheme
  • impc:aot:do-and-emit    macro
  • impc:compiler:print-cannot-expand-non-generic-error    scheme
  • impc:ir:get-type-expand-poly    scheme
  • impc:ir:split-and-decode-poly-adhoc-name    scheme
  • impc:ti:adhoc-scheme-wrapper    scheme
  • impc:ti:and    scheme
  • impc:ti:completely-unwrap-named-type    scheme
  • impc:ti:create-scheme-wrapper    scheme
  • impc:ti:create-scm-wrapper?    scheme
  • impc:ti:expand-generic-type    scheme
  • impc:ti:expand-generic-type-func-gpoly-arity    scheme
  • impc:ti:expand-generic-types    scheme
  • impc:ti:generate-generic-type-cname    scheme
  • impc:ti:get-generictype-candidate-types    scheme
  • impc:ti:get-polyfunc-candidate    scheme
  • impc:ti:get-polyfunc-candidate-list    scheme
  • impc:ti:get-polyfunc-candidate-names    scheme
  • impc:ti:get-polyfunc-candidate-pretty-types    scheme
  • impc:ti:get-polyfunc-candidate-types    scheme
  • impc:ti:get-polytype-candidate    scheme
  • impc:ti:get-polytype-candidate-list    scheme
  • impc:ti:get-polytype-candidate-names    scheme
  • impc:ti:get-polytype-candidate-pretty-types    scheme
  • impc:ti:get-polytype-candidate-types    scheme
  • impc:ti:handle-forced-types    scheme
  • impc:ti:reify-generic-type-expand    scheme
  • impc:ti:remove-polyfunc-candidate    scheme
  • impc:ti:unique-polyfunc-candidate    scheme
  • ivl:expand/contract    scheme
  • kinect_get_hand_left    xtlang
  • kinect_get_hand_right    xtlang
  • light-and-shade-frag    scheme
  • light-and-shade-vert-xtm    scheme
  • llvm:compile-ir-and-print    scheme
  • macro-expand    scheme
  • make_static_scheme_wrapper_ir    scheme
  • more-handlers?    scheme
  • my-inc-maker-wrapper    xtlang
  • on_before_command_line_processing    xtlang
  • pc:expand/contract    scheme
  • pc:random    scheme
  • pcg32_boundedrand_r    xtlang
  • pop-handler    scheme
  • push-handler    scheme
  • random    scheme
  • random    xtlang
  • random-next    scheme
  • read_and_write_frame    xtlang
  • repeat_And_Wrap_String    xtlang
  • set_width_and_height    xtlang
  • xt_pcg32_random    xtlang
  • xt_pcg32_random_r    xtlang
  • xt_pcg32_srandom    xtlang
  • xt_pcg32_srandom_r    xtlang
  • xtm-setup-and-start-gl-loop    scheme
  • xtm_scale_and_draw_vgimage    xtlang
  • xtm_scale_and_draw_vgimaged    xtlang
  • xtmdoc-builtin-handler    scheme
  • xtmdoc-closure-handler    scheme
  • xtmdoc-genericfunc-handler    scheme
  • xtmdoc-generictype-handler    scheme
  • xtmdoc-globalvar-handler    scheme
  • xtmdoc-namedtype-handler    scheme
  • xtmdoc-nativefunc-handler    scheme
  • xtmdoc-polyfunc-handler    scheme
  • xtmdoc-polytype-handler    scheme
  • xtmdoc-scheme-function-handler    scheme
  • xtmdoc-scheme-macro-handler    scheme
  • xtmdoc-typealias-handler    scheme