Skip to content

Instantly share code, notes, and snippets.

@scresawn
Last active April 17, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scresawn/57eaa85e71aa571f2cda2afb57b47966 to your computer and use it in GitHub Desktop.
Save scresawn/57eaa85e71aa571f2cda2afb57b47966 to your computer and use it in GitHub Desktop.
sample problems for bioinformatics class
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<h3>Here are a few practice problems. These don't involve SVG graphics, so you should open your developer console to debug them and see their output.</h3>
<script>
// Write a function called "count_purine()" that accepts a single argument (a string of A,C,G,T) and returns the number of purine bases (A or G) in a DNA sequence string. For this one, I'll get you started.
exampleInput = "CGATCGAGCTAGCTTACGTACCGGTCGTCGCGCGGGTGTATTAATGATTATATAT";
count_purine = function(dna) {
// your code here...
}
// Write a function called "percent_purine()" that accepts a single argument (a string of A,C,G,T) and returns the percentage of purine bases (A or G) in a DNA sequence string.
// Write a function called "find_purine_rich()" that accepts a single argument (an array of strings of A,C,G,T) and returns a new array that contains only those strings from the input array that contain at least 10 purines and are composed of at least 75% purine bases.
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment