Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 12 pages
Summary

Samenvatting Bio-informatica commando's Python | KU Leuven | 2025/26

Document preview thumbnail
Preview 2 out of 12 pages

Dit document is een overzicht van alle gebruikte commandos voor Pyhton. Aan de hand hiervan hoef je tijdens het open boek examen niets meer op te zoeken en kan je alles kopieren en plakken uit het document.

Content preview

Python (E06E2B) kernel altijd negatieve test uitvoeren!!!

Bij Claude: comments schrijven → tonen dat je het snapt !!

geheel getal = integer - kommagetal = float - stuk tekst = string – een lijst = [..] - een dict = {tekst}

• String: niet vermenigvuldigen met elkaar
• String kan je wel x10 doen om x aantal keer achter elkaar te laten staan

→ afhankelijk van het type kan je verschillende dingen doen



Type(…) = achterhalen welk type het is

Print(…) = printen wat die variabele is



Hoofdletter maken: dna.capitalize()

Lengte bepalen: len(dna)

Opslagen in een variabele: dna_length = len(dna)

Functie maken: def + naam van de functie + naam die je aan de functie geeft

= stuk code dat we opnieuw kunnen gebruiken



Nucleotiden tellen: def count_nucleotides(dna):

"""

Count the occurrence of each nucleotide (A, C, G, T) in a DNA string.

Parameters

----------

dna : str

DNA sequence, e.g. "ACGTACGT".

Returns

-------

dict

Mapping of nucleotide to count.

"""

dna = dna.upper()

return {nucleotide: dna.count(nucleotide) for nucleotide in "ACGT"}



dna_sequence = "ACGTAGGCTTACG"

print(count_nucleotides(dna_sequence))

, Drukletters maken: dna = dna.upper()



%GC-content bepalen: Gewoon in een cel:

dna =
"AACATGTTGAGCTCTGGCATAGAAGAGGCTGGTGGCTATTTTGTCCTTGGGCTGCCTGTT"

count_a = dna.count('A')

count_g = dna.count('G')

count_c = dna.count('C')

count_t = dna.count('T')

100 * (count_c + count_g)/(count_c + count_g + count_t + count_a)


In een functie:

dna =
"AACATGTTGAGCTCTGGCATAGAAGAGGCTGGTGGCTATTTTGTCCTTGGGCTGCCTGTT"

def perc_gc(dna):

count_a = dna.count('A')

count_g = dna.count('G')

count_c = dna.count('C')

count_t = dna.count('T')

return 100 * (count_c + count_g)/(count_c + count_g + count_t + count_a)



perc_gc(dna)




Reverse complement: def reverse_complement(dna):

"""Return the reverse complement of a DNA string."""

pairs = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}

comp = ''.join(pairs[base] for base in dna)

return comp[::-1]



print(reverse_complement('ACT'))

Document information

Study
Uploaded on
July 31, 2026
Number of pages
12
Written in
2025/2026
Type
Summary
$12.03

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
4
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions