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_skew
This 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 b
a
and b
Answer now in Google Documents
a
is smaller than b
a
a
is greater than b
)
b
Please finish the code and write a complete R function
The contract is this:
a
, b
, and c
a
, b
, and c
Let’s write a function for this
Answer now
The contract is this:
x
x
Let’s write a function for this
Answer now
The only stupid question is the question not asked