remove accidentally committed files

This commit is contained in:
Andrew Straw 2024-10-25 06:36:14 +02:00
parent 7886098144
commit 8760d16881
4 changed files with 0 additions and 756 deletions

View file

@ -1,126 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PM-21 Python für die Biowissenschaften / Python for the Biosciences\n",
"\n",
"- Instructors: Andrew Straw\n",
"- Tutor: Michael Harrap\n",
"\n",
"## Course content\n",
"\n",
" - Basics of Python programming\n",
" - Introduction to version control and command line\n",
" - Introduction to key data science concepts\n",
" - Introduction to biological sequence analysis"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Who am I (what do I know about programming, data science, and bioinformatics)?\n",
"\n",
"[strawlab.org](https://strawlab.org/)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Course format\n",
"\n",
"This course will be done in person but can be followed remotely. Lectures will be recorded and uploaded to Ilias shortly after class. Discussion and live particiaption will be encouraged. Friday lectures will start at 10:15. The exercises are self-paced and the tutor will available during our exercise time - Monday afternoons starting at 14:15 to 18:00 - to discuss."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Feedback\n",
"\n",
"We would like to make this course as productive as possible for you. Therefore, we encourage any feedback. This can come after the course is over as part of the official Uni Freiburg course feedback. Additionally, we would be happy to get suggestions and ideas as the course is ongoing."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Communication with instructors and tutors during the course\n",
"\n",
"We have started a forum room on Ilias. For questions, use this, or ask during the lecture. This lets other students see them and learn from the answers. Almost certainly you will not be the only one with a particular question!\n",
"\n",
"If you email us, unless the content is very personal, we may re-post the question into the forum room so everyone has a chance to benefit from the communication."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Team work\n",
"\n",
"We highly encourage teamwork during this course! You are welcome to discuss any aspect of the course with your colleagues. If you have any ideas how to better support teamwork, please let us know."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Grading\n",
"\n",
"To pass the course, you must actively participate. This will be checked by verifying that you did the exercise assignments. We have a threshold of 80% of assignments submitted to receive a pass grade."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Assignments\n",
"\n",
"Around the time of each lecture, there will be a new assignment posted on Ilias. We expect that you should be able to finish the exercise by Monday at 18:00, but the exercises will be due Wednesday at 23:55. We use https://strawlab-rp2.zoologie.uni-freiburg.de to handle distributing and collecting work. This runs software called [forgejo](https://forgejo.org) which approximates other sites such as [GitHub](https://github.com) and is widely used in the software world."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Anaconda and Python installation\n",
"\n",
"We would like to you to run Python on your own device if possible. Therefore, we recommend that you install Anaconda on your own computer. A demonstration video is available [here](https://uni-freiburg.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=1691f1da-2f9a-4cd3-acb2-b20d006d1a2f) and we can offer further help during the tutorials."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## [Ten simple rules for biologists learning to program](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005871)"
]
}
],
"metadata": {
"interpreter": {
"hash": "ccf25074823ae812a85d1e93a88d7cc1917c9d66a77f4dbdd42f55ca58b1eefe"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -1,80 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Blockly deconstructed\n",
"\n",
"Consider this [blockly program](https://blockly.games/bird?lang=en&level=2#562ubo).\n",
"\n",
"![blockly-bird](blockly-bird.png)\n",
"\n",
"This is actually a full computer program! When you succesfully complete it, you can see the automatic translation to Javascript. (Javascript is obviously a different programming language than Python, but the important points we can discuss anyway.)\n",
"\n",
"```\n",
"if (noWorm()) {\n",
" heading(0);\n",
"} else {\n",
" heading(90);\n",
"}\n",
"```\n",
"\n",
"if we would re-write this in Python, it would be:\n",
"\n",
"```\n",
"if noWorm():\n",
" heading(0)\n",
"else:\n",
" heading(90)\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's discuss what is going on here.\n",
"\n",
"(Discussion of computer program, computer, operating system, external world.)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Consider this [blockly program](https://blockly.games/music?lang=en&level=3#juok8w).\n",
"\n",
"![blockly](blockly.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The main conceptual new thing is the use of **functions**."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -1,155 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The Jupyter notebook environment (formerly IPython notebooks)\n",
"\n",
"Articles:\n",
"\n",
"- https://www.dataquest.io/blog/jupyter-notebook-tutorial/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Jupyter notebooks let you execute Python code in a browser.\n",
"\n",
"They have advantages and disadvantages compared to other ways of running Python code. We will start with them in this class to rapidly get programming.\n",
"\n",
"In this course, we encourage you to install and run [Anaconda Python](https://www.anaconda.com/products/distribution) on your own computer."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# this is a comment"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a = 4"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The result of the last line is displayed in the notebook environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a = 5"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Good practice - \"restart are run all\" in your notebooks\n",
"\n",
"It is good practice to \"Kernel -> restart and run all\" prior to finishing work on a Jupyter notebook. This ensures that your notebook can execute code from top to bottom, as it is displayed.\n",
"\n",
"## Automatic tests\n",
"\n",
"In this course, we have a number of automatic tests such as the following. These allow you to check that your answer is correct before moving on."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-2ff2ea3096b36c93",
"locked": true,
"points": 1,
"schema_version": 3,
"solution": false,
"task": false
},
"tags": []
},
"outputs": [],
"source": [
"# This is an automatic test.\n",
"\n",
"assert a==5"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Jupyter Lab\n",
"\n",
"Files side bar.\n",
"\n",
"Server runs in your computer. Your browser connects to \"Localhost\"."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Further reading - success of jupyter notebooks\n",
" \n",
"- http://nbviewer.jupyter.org/github/parente/nbestimate/blob/master/estimate.ipynb"
]
}
],
"metadata": {
"celltoolbar": "Create Assignment",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -1,395 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Python programming basics\n",
"\n",
"Here are some basic examples of concepts that we will learn in the class. We will also run these at http://pythontutor.com/visualize.html"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Built-in names\n",
"\n",
"Python has several words which are \"built in\" and do special things. When we start, we will use a lot of these. As we get further along, we will start using our own names and names we *imported* more and more."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"hello world\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Variables\n",
"\n",
"Another building block of programming are **variables**. These are names given to hold values. Each variable has a type, such as a string (like \"hello\" -- note the quotation marks) or integer (like 42)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x=\"hello world\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"x\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x=42"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(42)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(print)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type(print)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(type)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type(type)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"type(type(x))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Assignment\n",
"\n",
"The process of setting a variable is called **assignment**. This is done with the equals (`=`) symbol."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x = \"my new string\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x = -1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x = x + 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's look at these in the Python Tutor..."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Functions\n",
"\n",
"A building block of programming are **functions**. These are pieces of code that are called (also known as executed) with input and return output. They may also have side-effects.\n",
"\n",
"Let's look at a function definition:\n",
"\n",
"```python\n",
"def my_function_name(argument1, argument2):\n",
" variable1 = argument1 + argument2\n",
" print(\"hello from my function\") # this is a \"side-effect\"\n",
" return variable1\n",
"```\n",
"\n",
"Above, we created a function named `my_function_name`. This function takes two inputs (called arguments). There are several steps performed in the function. First, we add `argument1` to `argument2` and store the result in `variable1`. Then we print something. Then we return `variable1` as the output of our function.\n",
"\n",
"The indentation (spaces) at the beginning of the lines in the function tell Python which lines of code are part of the function. Everything with the same level if indentation is a \"block\".\n",
"\n",
"Above, we called the built in function `print()`.\n",
"\n",
"The `print()` function takes any number of arguments as input, returns nothing, and as a side-effect prints the arguments to the screen."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Errors (\"exceptions\")\n",
"\n",
"Python errors are called \"exceptions\". An important part of programming is figuring out why you got a particular error. Read the error message very carefully - it contains type of error, a description of the error, and a \"traceback\" that shows where the error came from."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"1/0"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x = variable_does_not_exist + 4"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"defx asdlkfj39:\n",
" adsk..{"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Doing the assignments\n",
"\n",
"We use automatic tests in this course. This way you can check most of your own work. Below is an example of how this works."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example Problem\n",
"\n",
"Assign a value of 2 to the variable named `x`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Write your answer here\n",
"x = 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-a83e7ba665c8308e",
"locked": true,
"points": 1,
"schema_version": 3,
"solution": false,
"task": false
}
},
"outputs": [],
"source": [
"assert x==2"
]
}
],
"metadata": {
"celltoolbar": "Create Assignment",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}