[ADD] functions & types
This commit is contained in:
parent
2c2b635a45
commit
55320921d7
|
@ -0,0 +1,23 @@
|
|||
s = "GTCA"
|
||||
t = "TGAC"
|
||||
|
||||
println(reverse("abc"))
|
||||
|
||||
const complement = Dict('A' => 'T', 'C' => 'G', 'T' => 'A', 'G' => 'C')
|
||||
|
||||
println(complement['T'])
|
||||
|
||||
println([complement[c] for c in reverse(s)] |> join)
|
||||
|
||||
println("ABCD" |> lowercase |> reverse)
|
||||
|
||||
reverse_complement(s) = [complement[c] for c in reverse(s)] |> join
|
||||
|
||||
s = readstring("text.txt")
|
||||
|
||||
println(reverse_complement(s))
|
||||
|
||||
"Find portion of DNA string containing C or G"
|
||||
cgcontent(dna::AbstractString) = count(x -> x in "CG",dna) / length(dna)
|
||||
|
||||
println(cgcontent(s))
|
|
@ -0,0 +1,48 @@
|
|||
println(typeof(8))
|
||||
|
||||
a = typeof(8)
|
||||
|
||||
println(typeof(a))
|
||||
|
||||
b = supertype(a)
|
||||
|
||||
println(b)
|
||||
|
||||
b = supertype(UInt64)
|
||||
println(b)
|
||||
|
||||
c = supertype(b)
|
||||
println(c)
|
||||
|
||||
println(subtypes(c))
|
||||
a = typeof(4)
|
||||
|
||||
for i in 1:10
|
||||
a =supertype(a)
|
||||
println(a)
|
||||
end
|
||||
|
||||
println(subtypes(Int64))
|
||||
|
||||
println("A"^2)
|
||||
|
||||
function showtypetree(T, level=0)
|
||||
println("\t" ^ level, T)
|
||||
for t in subtypes(T)
|
||||
if t != Any
|
||||
showtypetree(t, level+1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
println(fieldnames(5:2:8))
|
||||
println(typeof(5:2:8))
|
||||
|
||||
d = Dict("one" => 1, "two" => 2, "three" => 3)
|
||||
println(typeof(d))
|
||||
|
||||
println(fieldnames(d))
|
||||
|
||||
println(d.count)
|
||||
println(d.vals)
|
||||
println(d.keys)
|
Loading…
Reference in New Issue