Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,62 @@
|
|||
'' Rosetta Code problem: https://rosettacode.org/wiki/Bioinformatics/Sequence_mutation
|
||||
'' by Jjuanhdez, 05/2023
|
||||
|
||||
Randomize Timer
|
||||
|
||||
Dim As Integer r, i
|
||||
r = Int(Rnd * (300))
|
||||
|
||||
Dim Shared As String dnaS
|
||||
For i = 1 To 200 + r : dnaS += Mid("ACGT", Int(Rnd * (4))+1, 1) : Next
|
||||
|
||||
Sub show()
|
||||
Dim As Integer acgt(4), i, j, x, total
|
||||
|
||||
For i = 1 To Len(dnaS)
|
||||
x = Instr("ACGT", Mid(dnaS, i, 1))
|
||||
acgt(x) += 1
|
||||
Next
|
||||
|
||||
For i = 1 To 4 : total += acgt(i) : Next
|
||||
|
||||
For i = 1 To Len(dnaS) Step 50
|
||||
Print i; ":"; !"\t";
|
||||
For j = 0 To 49 Step 10
|
||||
Print Mid(dnaS, i+j, 10); " ";
|
||||
Next
|
||||
Print
|
||||
Next
|
||||
Print !"\nBase counts: A:"; acgt(1); ", C:"; acgt(2); ", G:"; acgt(3); ", T:"; acgt(4); ", total:"; total
|
||||
End Sub
|
||||
|
||||
|
||||
Sub mutate()
|
||||
Dim As Integer i, p
|
||||
Dim As String sdiS, repS, wasS
|
||||
|
||||
Print
|
||||
For i = 1 To 10
|
||||
p = Int(Rnd * (Len(dnaS))) + 1
|
||||
sdiS = Mid("SDI", Int(Rnd * (3)) + 1, 1)
|
||||
repS = Mid("ACGT", Int(Rnd * (4)) + 1, 1)
|
||||
wasS = Mid(dnaS, p, 1)
|
||||
Select Case sdiS
|
||||
Case "S"
|
||||
Mid(dnaS, p, 1) = repS
|
||||
Print "swapped "; wasS; " at "; p; " for "; repS
|
||||
Case "D"
|
||||
dnaS = Left(dnaS, p - 1) + Right(dnaS, Len(dnaS) - p)
|
||||
Print "deleted "; wasS; " at "; p
|
||||
Case "I"
|
||||
dnaS = Left(dnaS, p - 1) + repS + Right(dnaS, (Len(dnaS) - p + 1))
|
||||
Print "inserted "; repS; " at "; p; ", before "; wasS
|
||||
End Select
|
||||
Next
|
||||
Print
|
||||
End Sub
|
||||
|
||||
show()
|
||||
mutate()
|
||||
show()
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue