We know that the GC skew is \[\frac{G-C}{G+C}\]
What is the GC skew of “ATATATATATATAT”?
Since \(G+C\) is 0, we are in trouble
Fortunately \(G-C\) is also 0,
so we can do something
We will say that, in this case, GC skew is 0
count C and G
if G+C is 0, then
else
(G-C)/(G+C)return the results
G+C is 0?The last tool in our programming kit is
Here condition is a logic value. For example, a comparison
The code is only executed if condition is TRUE
This version has two code blocks
Only one block is executed
The first block is executed only when cond is true
The second block is executed only when cond is false
calculate_GC_skewThis version works in all cases
[1] 0
[1] 1
[1] -1
How do we find the smallest of two numbers?
Can you give some examples?
The contract of the function is:
a and ba and bAnswer now in Google Documents
a is smaller than b
aa is greater than b)
b
Please finish the code and write a complete R function
The contract is this:
a, b, and ca, b, and cLet’s write a function for this
Answer now
The contract is this:
xxLet’s write a function for this
Answer now
The only stupid question is the question not asked