Skip to Content
Bioinformatics with Python Cookbook - Second Edition
book

Bioinformatics with Python Cookbook - Second Edition

by Tiago Antao
November 2018
Intermediate to advanced
360 pages
9h 36m
English
Packt Publishing
Content preview from Bioinformatics with Python Cookbook - Second Edition

How to do it...

Let's take a look at the following steps:

  1. The first thing that we do is select an individual per family at most. This step is not strictly necessary (as opposed to many other recipes where having related individuals will bias the analysis), but we will do it anyway:
from collections import defaultdictimport gzipimport scipyimport scipy.stats as statsgermline_file = 'good.match.gz'sample_file = 'integrated_call_samples.20101123.ped'inds = set()ind_pop = {}selected_inds = {}pop_inds = defaultdict(list)with gzip.open(germline_file, 'rt', encoding='utf-8') as f:    for l in f:        toks = l.rstrip().split()        inds.add(toks[1])        inds.add(toks[3])with open(sample_file, 'rt', encoding='utf-8') as f:    f.readline()  # header    for l in f: toks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Bioinformatics with Python Cookbook

Bioinformatics with Python Cookbook

Tiago Antao

Publisher Resources

ISBN: 9781789344691Supplemental Content