Course number: 20253491
- Direct link to course information
- Feinberg Moodle
- Day 1 2024.11.03 9:15-12:00
- Day 2 2024.11.10 9:15-12:00
- Day 3 2024.11.17 9:15-12:00
- Day 4 2024.11.24 9:15-12:00
- Day 5 2024.12.01 9:15-12:00
- Day 6 2024.12.08 9:15-12:00
- Day 7 2024.12.15 9:15-12:00
- Day 8 2024.12.22 9:15-12:00
- Hanukkah
- Day 9 2025.01.05 9:15-12:00
- Day 10 2025.01.12 9:15-12:00
There will be assignments after every lecture. You will submit them via GitHub. I'll explain the details during the lectures.
Towards the end of the course you'll be asked to do a project. First you will need to submit a proposal for the project and when it is accepted then implement it. The project should be something that is useful for your studies or at least it is fun for you to make. Ask in the lab where you work what needs are there that you might implement as your final project. You can get inspiration from the projects listed here and the projects of the 2023 autumn semester or those of 2024 spring semester.
The idea of the project is that you write something that is going to be useful for you beyond the course. e.g. There is some manual work in your lab and this project will automate it. It can be also a tool to help you with your research. etc. It can also be useful in your private life. e.g. we had projects trying to register for visa applications at the USA embasy and also games.
You can even take an existing project and make some valuable improvements to that project. (e.g. one project from one of the previous courses).
How to submit your proposal?
-
Create a separate repository for the project. Its name should reflect the project: (e.g. Gene-Amplification-and-SNP-Analysis) and not the the course. If someone looks at this repository they should see it as a real application and not "some stuff you wrote just to get the grade".
-
The proposal should be the README.md file of the repository. If you need to include images or data files, those should be also included in the repository. It should be a description that will help any future visitor of the project to understand
- What does this project do?
- What kind of input data it expects and what kind out output the user might expect.
- The technicalities: How to download it, install the dependencies, run the tests, and run the project?
It would be nice if at the end of the README you mention that this was written as part of the course and link to the course repository.
We understand that the project and thus the description might evolve during the implementation. That's fine. You can update the README with the new information. In the proposal we would like to see your understanding of the project before you start implementing it.
Before you submit it for approval it is recommended that you send it to another student and ask if the description is clear. If that student has any questions then you probably will need to update the README to answer those questions so the next person won't need to ask.
Once you are ready, open an issue on our repository linking to you project to get it approved.
Once the project is approved you will implement it in the same repository. Open a new issue when you'd like the project to be graded.
In addition to the lectures you will spend about 2-4 hours / week on the assignments and 20-40 hours on the project.
The actual time spent will greatly depend on your previous experience with programming in general and Python in particular.
The time you spend on the project will also depend on the availability of the data you work on. If you pick a project that you would want to do anyway then this is basically time you would spend anyway.
-
Each assignment counts as 5% (we will have 10 of them).
-
The project proposal is 15%.
-
The project is 35%.
-
The project is a requirement. Without that you won't get a passing grade.
During the course I'll use some of the slides that can be found here. These slides are publicly available and will remain on the web site after the course is over.
There are recording of this course from 3 years ago.
There are also recordings from the 2023 autumn semester.
There are also recordings from the 2024 spring semester.
You can watch those, but be also warned, this semester the order of the material will be different.
There are many more videos in my English-language YouTube channel. You are invited to check them out and to follow the channel.
Some of the material is also available in Hebrew. You can find them on my website and in my Hebrew-language YouTube channel. You are invited to follow that channel as well.
The default teaching language of WIS and of this course is English.
In writing please stick to English.
If and when we have one-on-one conversions I'd be happy to speak in Hebrew, Hungarian, Spanish, or Ladino as well.
You are expected to bring your own computer to the lectures.
There is no need to install anything up front. We'll do that during the lectures.
GitHub, GitHub Pages
-
Self introduction
-
Overview of the course
-
Programming
-
Version control
-
GitHub pages
-
Parts of a computer
- memory(RAM) vs Hard disk (or SSD)
- CPU (speed, number of cores)
- GPU
-
Webiste moved to github-pages-wis-2024-11 - source
-
If you don't have one yet create an account on GitHub.
-
Upload a picture of you or some avatar to your account.
-
Create a nice page based on GitHub pages. Include information about yourself, your studies, your hobbies. Link to the institution and to my home page https://szabgab.com/ .
-
Open an issue on our repository, the title should be "1st assignment of YOUR NAME" (put your name instead of YOUR NAME) and in the issue link to your web site and to your repository.
-
The TAs will respond to the issue and I'll add a link to your site to the README of the repository of the course.
-
Dead-line: 2024.11.06 24:00
-
Install VS Code
-
Mention other IDEs (PyCharm, Spyder)
-
Write Hello World
-
Install Python
-
Run Python program
-
Mention Anaconda
-
Install Jupyter labs
-
Create first Notebook
-
Install Git client
-
Start a repo locally
-
Local setup
-
Add some files.
-
We ran out of time and I could not show how to connect the local repo and the one in GitHub. I should have done this and delay the Jupyter labs demo for the next session.
-
Star our repo.
-
Pick two participinats of the course who you don't know (preferably people who who don't yet have 2 issues opened on their repo), look at their web site, star their repo and open a constructive issue on how to improve the site.
-
Handle the issues you receive. (Comment on them and when both of you are satified with the changes then close the issue.
-
Write a python program that has two variables
widthandlengthof a rectangle. Print out the area and the circumference of the rectangle. (rectangle.py) -
Write a python program that has one variable
radiusof a circle. Print out the area and the circumference of the circle. (cricle.py) -
Create a Jupyter Notebook that has 3 variables
widthandlengthof a rectangle and theradiusof a circle. Print out the area and circumference of both. (day2.ipynb) -
Create a new repository for the assignments (e.g. call it python-assignments) create a folder called day02 and upload the 3 files to that folder.
-
Add a README.md file to the root of the repository with some information explaining what is in the repository.
Open an issue on our repository "day 2 by YOUR NAME" and a link to the new repository.
- Dead-line: 2024.11.14 13:00
-
Mention that in the course we only learn 0.01% of "programming in Python", the rest they will have to learn alone.
-
Mention the tension that about 30% of the students have no programming background and the other have.
-
Resize image: #43
-
Clone web site
-
Make some changes to the web site
-
Commit and push
-
Create a new repository for the assignments. Clone it. Add some files and push it out.
-
Clone the repository of your assignments
-
Add a new folder called day03
-
Copy the
rectangle.pyfrom day02 and change it to useinputto get the values from the user. -
Copy the
circle.pyfrom day02 and change it to use the command line to get values from the user. (argparse) -
Copy the Jupyter notebook from day02 and change it to get the parameters using
input. -
Copy the
day03/dilution_calculation.ipynbfrom this repository (you can clone this repository as well to your computer) and solve it. -
Dead-line: 2024.11.26 22:00
Using Jupyter notebook
-
input() -
scalar values (e.g. a number)
-
defdefine functions -
return single value
-
return multiple values and accept them as a tuple
-
move the function to a separate file and
importit from there. -
lists
-
forloop to double numbers -
mapto double numbers -
list -
range -
random -
if -
break -
continue -
divide 100 by numbers in a list
-
two lists (vectors) - add them pair-wise using a for loop and using zip
-
Show how to search for help - Stackoverflow
- Create a folder called
day04.
We did not go over the while loops but for this assignment you will need it. It is used when we don't have anything to iterate overknow or we don't know up front how many iteration we will have.
You can use break and continue in the while loops as well:
You car write it like this:
while True:
if some_condition:
break
...
- Write a Python program that is a number guessing game:
-
The computer "thinks" a about a whole number between 1 and 20
-
The user guesses
-
The computer tells if the guess was too small, too big or exact.
-
If exact the user wins, the program ends. Otherwise the user can guess again.
-
At the end of the game print out how many guesses the user needed.
-
Allow the user to play several games: once one game ends ask her if she wants to play again, generate a new random number and play again.
-
If the user enters "x" any time, exit the program.
-
If the user enters "n" any time, leave the current game and ask if she wants to play a new game?
-
If the user enters "s" any time, show the hidden number (cheating).
-
Move the code in a function called
mainand split up the code into several function that make sense.
-
There is a file called day04/assignment-t-test.ipynb copy it and follow the instructions in the file.
- Dead-line: 2024.12.02 22:00
-
whileloop vsforloop -
count digits in a string
-
count digits in a file
-
testing you first need to
pip install pytestto be able to run the tests
- Sequences and stats
- Write a program that given one or more files with a sequence in it will display some basic statistics about the sequences.
- Write a few tests that will verify the results.
e.g. python seq.py day05/a_seq.txt day05/b_seq.txt
day05/a_seq.txt
A: 2 7.4%
C: 5 18.5%
G: 6 22.2%
T: 7 25.9%
Unknown: 7 25.9%
Total: 27
day05/b_seq.txt
A: 1 10.0%
C: 2 20.0%
G: 3 30.0%
T: 4 40.0%
Unknown: 0 0%
Total: 10
All
A: 3 8.1%
C: 7 18.9%
G: 9 24.3%
T: 11 29.7%
Unknown: 7 18.9%
Total: 37
- Patients
There is a file called day05/Datasets.ipynb copy it and follow the instructions in the file.
There is also a data file called day05/patient_data.csv.
- Dead-line: 2024.12.09 22:00
count words in a list count words in a file
__pycache__ .gitigrnore
Opening files:
- plain text file
with open(filename, "r") as fh:
fh.read()
fh.readline()-
Image using PIL and cv2
-
CSV file using csv and pandas
-
Excel file using openpyxl and pandas https://slides.code-maven.com/python/excel.html
-
JSON
Create a folder called day06.
Write a command line tool that can download data from NCBI. You can download from the nucleotide database as we did in the lecture, but it would be much more interesting if you used some of the other databases available on NCBI. e.g.:
python ncbi.py --database nucleotide --term TERM --number NUMBER
The database can default to "nucleotide", ther number can default to 10.
Search for the TERM and download up to NUMBER items. Save each item in its own file. Print the names of the files. Also save the date, the database, the search term, the number asked for and the total number of items found in a csv file. So if you run the command twice:
python ncbi.py --database genome --term Orchid --number 3
python ncbi.py -cauliflower
you'd get something like this:
date,term,max,total
2024-05-30 17:20:21,genome,Orchid,3,527341
2024-05-30 18:12:34,nucleotide,cauliflower,10,32781
Copy the file day06/Assignment06.ipynb and follow the instructions there.
- Dead-line: 2024.12.16 22:00
-
Open Weathermap API
-
YAML
-
Fasta file format
-
GeneBank file format
-
Fixing the typo on the Biopython web site search term
-
The requirements.txt file docs
-
Color wheel - one of many such things on the Internet.
Jupyter notebook file selector
There was no assignment.
- Take one of the previous programs you wrote and create either a GUI for it using Tk or a Web interface for it using Flask.
For example you can take the number guessing game and convert it to work in either GUI or web. You could also take some interesting biological process or computation, implement it and add GUI or web interface to it.
-
Dead-line: 2025.01.06 22:00
-
Project proposal dead-line: 2025.01.13 22:00
We saw one example analyzing sequences: find the longest sub-sequence that repeates itself. In the day09 folder create a program that will receive the path to a file in Fasta or GeneBank format, and use the above analyzis to print out the longest sub-sequence that appears twice.
Then come up with some other "interesting feature" of sequences and add that analyzis too. Make both analyzis optional
and let the user control which one is done: (assuming this second analyzis is called blabla you could use the program like this:
python analyze.py FILE --duplicate --blabla
What is an "interesting feature" is up to you. It can be a real, scientifically valuable feature, but if that's too difficult it can be some simpe feature like the repetition we have.
Include a README.md file and the requirements.txt file if necessary.
- Dead-line 2025.01.12 22:00
- video
- PyData Tel Aviv
- Functions
- Presentation of Liron and Hadar
- Project dead-line: 2025.02.03 22:00