Posts

Summoning Singletons with plink

Singletons are variants private to individuals, a personal mutation. Sometimes these variants can carry disease risk when passed to offspring. Especially when the risk is additive and multiple disease variants are transmitted to an affected child. Summoning singletons is easy with plink . Here's a basic guideline of how to do it. 1. Convert the VCF into a plink bfile 2. Run plink --freq counts That's it. I included a test case you can download from GitHub $ git clone --recursive https://github.com/biosigil/plink_singletons.git All following commands are assuming you installed plink and changed directory to plink_singletons/ The VCF is located in input/1kgp.vcf.gz and consists of three trios (child and parents). These data are a sampling from the 1000 Genome Project .  Convert the VCF $ plink --vcf input/1kgp.chr21.vcf.gz --make-bed --out 1kgp plink will now make three files, 1kgp.bed, 1kgp.bim, 1kgp.fam The fam file is not correct, the relation inform...

Custom Usage Message for Python

Spellcrafting in Python is approachable and enjoyable. The library argparse facilitates the parsing of arguments for code destined for wide distribution. Below is an example of basic argparse usage #!/usr/bin/env python3 """ in this example get input from the user and manlipulate it """ from argparse import RawTextHelpFormatter import argparse,sys def get_args (): parser = argparse.ArgumentParser(formatter_class = RawTextHelpFormatter) arg_grp = parser.add_argument_group( 'arguments' ) # add an argument to take an int # set the default to None to check for errors, required arg_grp.add_argument( '-n' ,type = int,default = None) # add a required argument for a string # set the required option to True # this argument has two flags, -s --string arg_grp.add_argument( '-s' , '--string' ,type = str,required = True) # this command loads the args # object with user ...

Push to GitHub with the Terminal

Push to GitHub with the Terminal GitHub is an online version control repository for code. It facilitates sharing and improvement of code. GitHub uses the Git platform to update code from a terminal. However, setting up a server to push changes to GitHub can be quite a pain. Below is a guide on one way to set up such a server. 1. Generate a deploy key Deploy keys allow a server to push changes to a GitHub repository. Open a terminal window and type the following command. $ ssh-keygen -t rsa -C "deploy key for repo" You will be given a prompt to change the file name. Change it to reflect the name of your repository. For this example, the name will be "repo". Generating public/private rsa key pair. Enter file in which to save the key (/home/usr/.ssh/id_rsa): /home/usr/.ssh/repo_rsa # change the file name to match your repo Enter passphrase (empty for no passphrase): # hit enter for no passphrase Enter same passphrase again: # hit enter for no pa...