Skip to content
Merged
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"python.analysis.extraPaths": [
"./rosalind_data"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Welcome to my Homework Domain!
# Domain Expansion: Python Homework Repository


Binary file added __pycache__/util.cpython-313.pyc
Binary file not shown.
7 changes: 0 additions & 7 deletions ini3.py

This file was deleted.

Binary file added rosalind_data/__pycache__/util.cpython-312.pyc
Binary file not shown.
31 changes: 31 additions & 0 deletions rosalind_data/ascii.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is the attempt at making a ASCII art drawing script

# Goal: Draw a 10 lines large triangle

# First idea: Make a loop that first adds "/""\" characters without a space between them and after the second line start adding spaces

# Maybe try a dictionary first?


# triangle_sides_dictionary = {"right": "\\", "left": "/"}

# print(triangle_sides_dictionary["left"],triangle_sides_dictionary["right"], sep= "")

# pyramid_right = {"right1": "\\", "right2": " ""\\", "right3": "____""\\"}
# pyramid_left = {"left1": " ""/", "left2": " ""/", "left3": "/"}


# print(pyramid_left["left1"]+pyramid_right["right1"],pyramid_left["left2"]+pyramid_right["right2"],pyramid_left["left3"]+pyramid_right["right3"], sep= "\n")

my_dict = {"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5}

print(my_dict)





40 changes: 40 additions & 0 deletions rosalind_data/ini5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
`Twas brillig, and the slithy toves
Some things in life are bad, they can really make you mad
Did gyre and gimble in the wabe:
Other things just make you swear and curse
All mimsy were the borogoves,
When you're chewing on life's gristle, don't grumble give a whistle
And the mome raths outgrabe.
This will help things turn out for the best
"Beware the Jabberwock, my son!
Always look on the bright side of life
The jaws that bite, the claws that catch!
Always look on the right side of life
Beware the Jubjub bird, and shun
If life seems jolly rotten, there's something you've forgotten
The frumious Bandersnatch!"
And that's to laugh and smile and dance and sing
He took his vorpal sword in hand:
When you're feeling in the dumps, don't be silly, chumps
Long time the manxome foe he sought --
Just purse your lips and whistle, that's the thing
So rested he by the Tumtum tree,
So, always look on the bright side of death
And stood awhile in thought.
Just before you draw your terminal breath
And, as in uffish thought he stood,
Life's a counterfeit and when you look at it
The Jabberwock, with eyes of flame,
Life's a laugh and death's the joke, it's true
Came whiffling through the tulgey wood,
You see, it's all a show, keep them laughing as you go
And burbled as it came!
Just remember the last laugh is on you
One, two! One, two! And through and through
Always look on the bright side of life
The vorpal blade went snicker-snack!
And always look on the right side of life
He left it dead, and with its head
Always look on the bright side of life
He went galumphing back.
And always look on the right side of life
65 changes: 65 additions & 0 deletions rosalind_data/prot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# PROT Exercise

# Given: An RNA string "rosalind_prot" corresponding to a strand of mRNA (of lenght at most 10kbp)

# Return: The protein string encoded by "rosalind_prot"

# First, lets use the read_input function from the util list

# Second, create dictionary including the RNA codon table

# Third, figure out a way to read every 3 characters in "rosalind_prot", while checking the dictionary for the corresponding key, and then replacing it with the value

# Fourth, save the new string with the values corresponding to their keys (or nucleotide triplets) in a new list "protein_string" and print it

# Thoughts: I'd like to try and seperate the string after every 3rd step. There might be a way to do it with slicing maybe?
# Findings Nr1: Ok so after some research online, I managed to get a loop together to slice the sequence into triplets, however, its not working with the read_input function?
# When I use the read_input function, print(len(sample_stringtext)) gives me the number "1", however it should be 51! Why is that happening? Is there something wrong with how
# the util file works? If this gets fixed, then I think I can continue with solving the next steps (hopefully)...


# from util import read_input

# sample_stringtext = read_input('./rosalind_prot.txt')

codon_table_dict = {"UUU": "F", "CUU": "L", "AUU": "I","GUU": "V",
"UUC": "F", "CUC": "L", "AUC": "I", "GUC": "V",
"UUA": "L", "CUA": "L", "AUA": "I", "GUA": "V",
"UUG": "L", "CUG": "L", "AUG": "M", "GUG": "V",
"UCU": "S", "CCU": "P", "ACU": "T", "GCU": "A",
"UCC": "S", "CCC": "P", "ACC": "T", "GCC": "A",
"UCA": "S", "CCA": "P", "ACA": "T", "GCA": "A",
"UCG": "S", "CCG": "P", "ACG": "T", "GCG": "A",
"UAU": "Y", "CAU": "H", "AAU": "N", "GAU": "D",
"UAC": "Y", "CAC": "H", "AAC": "N", "GAC": "D",
"UAA": "Stop", "CAA": "Q", "AAA": "K", "GAA": "E",
"UAG": "Stop", "CAG": "Q", "AAG": "K", "GAG": "E",
"UGU": "C", "CGU": "R", "AGU": "S", "GGU": "G",
"UGC": "C", "CGC": "R", "AGC": "S", "GGC": "G",
"UGA": "Stop", "CGA": "R","AGA": "R", "GGA": "G",
"UGG": "W", "CGG": "R","AGG": "R", "GGG": "G"}

# print(codon_table_dict["AAA"])

# print(sample_stringtext)

# Note: using read_input from util is not working for some reason, the lenght for the sample_stringtext appears to be "1", which is not the case (it should be 51).

# for prots in codon_table_dict:
# if prots == codon_table_dict["AUG"]:
# print(codon_table_dict.values)
# else:
# print("not found")

# I tried it with defining a new variable with the example code from Rosalind, and this worked the way it should! It counted the lenght right, and it managed to slice it into triplets.

sequence = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA"

for i in range(0, len(sequence), 3):
codon = sequence[i:i+3]
if len(codon) == 3:
print(codon)




1 change: 1 addition & 0 deletions rosalind_data/rosalind_prot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA
6 changes: 3 additions & 3 deletions rosalind_data/util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# a library of utility functions for Rosalind exercises

def read_input(filepath):
with open(filepath, "r") as infile:
lines=infile.readlines()
with open(filepath, 'r') as infile:
lines = infile.readlines()
stripped = []
for line in lines:
stripped.append(line.strip())
return stripped
return stripped