Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laros
lectures
Commits
b25e6e74
Commit
b25e6e74
authored
Sep 20, 2017
by
Laros
Browse files
Added lecture for Python course.
parent
d49f2af0
Changes
13
Show whitespace changes
Inline
Side-by-side
lectures/putting_together/Makefile
0 → 120000
View file @
b25e6e74
../../submodules/presentation/Makefile
\ No newline at end of file
lectures/putting_together/beamerthemelumc.sty
0 → 120000
View file @
b25e6e74
../../submodules/presentation/beamerthemelumc.sty
\ No newline at end of file
lectures/putting_together/bin_parser_hld.dia
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/bin_parser_hld.dia
\ No newline at end of file
lectures/putting_together/cyrillic_1.png
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/cyrillic_1.png
\ No newline at end of file
lectures/putting_together/cyrillic_2.png
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/cyrillic_2.png
\ No newline at end of file
lectures/putting_together/fam_re.ps
0 → 120000
View file @
b25e6e74
..
/../submodules/presentation-pics/pics
/fam_re.ps
\ No newline at end of file
lectures/putting_together/logos
0 → 120000
View file @
b25e6e74
../../submodules/presentation/logos
\ No newline at end of file
lectures/putting_together/mutalyzer_disambiguation.xcf
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/mutalyzer_disambiguation.xcf
\ No newline at end of file
lectures/putting_together/mutalyzer_disambiguation_result.xcf
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/mutalyzer_disambiguation_result.xcf
\ No newline at end of file
lectures/putting_together/nested.png
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/nested.png
\ No newline at end of file
lectures/putting_together/putting_together.tex
0 → 100644
View file @
b25e6e74
\documentclass
[slidestop]
{
beamer
}
\author
{
Jeroen F.J. Laros
}
\title
{
Scientific programming using Python
}
\providecommand
{
\mySubTitle
}{
Putting everything together
}
\providecommand
{
\myConference
}{
Scientific programming using Python
}
\providecommand
{
\myDate
}{
21-09-2017
}
\providecommand
{
\myGroup
}{}
\providecommand
{
\myDepartment
}{
Department of Human Genetics
}
\providecommand
{
\myCenter
}{
Center for Human and Clinical Genetics
}
\usetheme
{
lumc
}
\begin{document}
% This disables the \pause command, handy in the editing phase.
%\renewcommand{\pause}{}
% Make the title slide.
\makeTitleSlide
{
\includegraphics
[width=3.0cm]
{
python
_
logo
}}
% First page of the presentation.
\section
{
Introduction
}
\makeTableOfContents
\section
{
General tips
}
\subsection
{
Packaging
}
\begin{pframe}
PyPI, the Python Package Index.
\bigskip
Repository of software for Python.
\begin{itemize}
\item
$
117
\!
,
423
$
packages (september 2017).
\end{itemize}
\bigskip
\begin{lstlisting}
[language=bash, caption=Software installation with
\lstinline
{
pip
}
.]
pip install tssv
\end{lstlisting}
Download and install the package including its dependencies.
\vfill
\permfoot
{
\url
{
https://pypi.python.org/pypi
}}
\end{pframe}
\begin{pframe}
Making a package yourself is relatively easy.
\bigskip
Adding just a few files to your project:
\begin{itemize}
\item
Installation script (a few lines):
\lstinline
{
setup.py
}
.
\item
Package metadata (optional):
\lstinline
{
setup.cfg
}
.
\end{itemize}
\bigskip
Metadata contains:
\begin{itemize}
\item
Name, version, description, keywords, classifiers,
\ldots
\item
List of additional files to be packaged.
\item
Dependencies.
\end{itemize}
\vfill
\permfoot
{
\url
{
https://setuptools.readthedocs.io/en/latest/
}}
\end{pframe}
\subsection
{
Automated tests
}
\begin{pframe}
Write tests for your code:
\begin{itemize}
\item
Adding a feature can break functionality elsewhere.
\item
Porting your code is easier when tests are in place.
\end{itemize}
\bigskip
\begin{lstlisting}
[language=python, caption=pytest example.]
def inc(x):
return x + 1
def test
_
inc():
assert inc(8) == 9
\end{lstlisting}
\bigskip
\vfill
\permfoot
{
\url
{
https://docs.pytest.org/en/latest/
}}
\permfoot
{
\url
{
https://tox.readthedocs.io/en/latest/
}}
\end{pframe}
\subsection
{
API documentation
}
\begin{pframe}
Have your code and its documentation in one place.
\bigskip
\begin{lstlisting}
[language=python, caption=Docstring example.]
def inc(x):
"""Increase a number by one.
:arg int x: Any number.
:returns int: x + 1
"""
return x + 1
\end{lstlisting}
\bigskip
Output in
\color
{
LUMCDonkerblauw
}
\href
{
https://docs.python.org/3/library/datetime.html
}{
HTML
}
\color
{
black
}
,
PDF, Manual pages,
\ldots
\vfill
\permfoot
{
\url
{
http://www.sphinx-doc.org/en/stable/
}}
\end{pframe}
\subsection
{
PEP 8
}
\begin{pframe}
Style guide for Python code.
\bigskip
Extensive set of recommendations about:
\begin{itemize}
\item
Naming variables, functions, classes,
\ldots
\item
Writing comments.
\item
Using whitespace and newlines.
\item
Maximum line length and wrapping guidelines.
\item
\ldots
\end{itemize}
\vfill
\permfoot
{
\url
{
https://www.python.org/dev/peps/pep-0008/
}}
\end{pframe}
\subsection
{
Licensing
}
\begin{pframe}
Open Source software is software with source code that anyone can inspect,
modify, and enhance.
\bigskip
All of the tools (and Python itself) discussed here are Open Source.
\bigskip
Put a license on your code to enable other people to use it.
\begin{itemize}
\item
Code without a license is
\emph
{
closed
}
.
\item
Well known licenses include Apache, BSD, GPL, MIT,
\ldots
\item
Do not make your own license, it will be incompatible with other
licenses.
\end{itemize}
\vfill
\permfoot
{
\url
{
https://opensource.org/licenses
}}
\end{pframe}
\section
{
Example packages
}
\subsection
{
Mutalyzer
}
\begin{pframe}
A curational tool for Locus Specific Mutation Databases.
\bigskip
Variant nomenclature checker applying the HGVS guidelines:
\begin{itemize}
\item
Is the syntax of the variant description valid?
\item
Does the reference sequence exist?
\item
Is the variant possible on this reference sequence?
\item
Is this variant description the recommended one?
\end{itemize}
\bigskip
Basic effect prediction.
\begin{itemize}
\item
Is the description of the transcript product as expected?
\item
Is the predicted protein as expected?
\end{itemize}
\vfill
\permfoot
{
\url
{
https://mutalyzer.nl
}}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[width=\textwidth]
{
mutalyzer
_
disambiguation
}
\end{center}
\caption
{
\bt
{
NM
\_
002001.2:c.9
\_
10delinsTGC
}
.
}
\end{figure}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[width=\textwidth]
{
mutalyzer
_
disambiguation
_
result
}
\end{center}
\caption
{
\bt
{
NM
\_
002001.2:c.12dup
}
.
}
\end{figure}
\end{pframe}
\begin{pframe}
Mutalyzer is free:
\begin{itemize}
\item
Open source (AGPL license).
\item
Available via GitHub.
\end{itemize}
\bigskip
Available via the web:
\begin{itemize}
\item
Interactive user interface.
\item
Batch interface:
\begin{itemize}
\item
CSV, XLS, ODS.
\end{itemize}
\item
Webservices (to integrate in a pipeline):
\begin{itemize}
\item
SOAP.
\item
HTTP/RPC+JSON.
\end{itemize}
\end{itemize}
\vfill
\permfoot
{
\url
{
https://mutalyzer.nl
}}
\\
\permfoot
{
\url
{
https://github.com/mutalyzer/mutalyzer
}}
\end{pframe}
\subsection
{
Nested
}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[width=\textwidth]
{
nested
}
\end{center}
\caption
{
Nested online editor.
}
\end{figure}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[height=0.7\textheight]
{
fam
_
re
}
\end{center}
\caption
{
A Cyrillic FAM file.
}
\end{figure}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[height=0.3\textheight]
{
bin
_
parser
_
hld
}
\end{center}
\caption
{
High level design of a general binary parser.
}
\end{figure}
Specification separate from implementation.
\begin{itemize}
\item
Specification of the basic types.
\item
Specification of the global file structure.
\end{itemize}
\end{pframe}
\begin{pframe}
Structure:
$
259
$
lines, types:
$
183
$
lines.
\begin{lstlisting}
[language=none, caption=
{
Structure snippet.
}
]
- name: members
for: number
_
of
_
members
structure:
- name: surname
- name: forenames
- name: address
type: comment
- name: spouses
for: number
_
of
_
spouses
structure:
- name: id
type: int
- name: flags
type: relationship
- name: name
\end{lstlisting}
\end{pframe}
\begin{pframe}
Resulting output in YAML format.
\begin{lstlisting}
[language=none, caption=
{
Output snippet.
}
]
members:
- surname: 'Gambolputty'
forenames: 'Johann'
address: 'Ulm'
spouses:
- flags:
consanguineous: false
divorced: false
informal: false
separated: false
id: 2
name: ''
\end{lstlisting}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[height=0.7\textheight]
{
cyrillic
_
1
}
\end{center}
\caption
{
Original pedigree.
}
\end{figure}
\end{pframe}
\begin{pframe}
We can edit the YAML file and convert it back to FAM format.
\begin{lstlisting}
[language=none, caption=
{
Updating date of death field.
}
]
date
_
of
_
birth: unknown
date
_
of
_
death: defined
father
_
id: 0
flags:
blood: false
cells: false
committed
_
suicide: false
dna: false
hide
_
info: false
loop
_
breakpoint: false
\end{lstlisting}
\end{pframe}
\begin{pframe}
\begin{figure}
[]
\begin{center}
\includegraphics
[height=0.7\textheight]
{
cyrillic
_
2
}
\end{center}
\caption
{
Edited pedigree.
}
\end{figure}
\end{pframe}
% Make the acknowledgements slide.
\makeAcknowledgementsSlide
{
\begin{tabular}
{
l
}
Guy Allard
\\
Jonathan Vis
\\
Mark Santcroos
\\
Mihai Lefter
\\
\end{tabular}
}
\end{document}
lectures/putting_together/python_logo.svg
0 → 120000
View file @
b25e6e74
../../submodules/presentation-pics/pics/python_logo.svg
\ No newline at end of file
presentation-pics
@
0fdfa620
Compare
49bd4b89
...
0fdfa620
Subproject commit
49bd4b899df12078e4c9e93e766960bb0d5bf951
Subproject commit
0fdfa62033731733222d41c46513cfaa74e0aa88
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment