Skip to content

Instantly share code, notes, and snippets.

@hmartiniano
hmartiniano / king.py
Created March 17, 2024 20:04 — forked from johnbowes/king.py
Select related individuals for exclusion based on output from KING
#!/usr/bin/python
# Run KING to generate sample QC and IBD summary stats
# ./king_1.9 -b <data>.bed --bysample --prefix <prefix_for_output>
# ./king_1.9 -b <data>.bed --kinship --related --degree 2 --prefix <prefix_for_output>
#
# Run this script to create a list of exclusions (member of pair with least data will be excluded)
# python king.py --prefix <prefix_for_output> --out <output_file_name>
# Add error if no samples in kinship file.
import subprocess
from goatools.semantic import get_info_content
from goatools.base import get_godag
from goatools.semantic import TermCounts
from goatools.anno.factory import get_objanno
godag = get_godag("go-basic.obo")
return_code = subprocess.call("wget https://ftp.ebi.ac.uk/pub/databases/GO/goa/HUMAN/goa_human.gpa.gz && gunzip goa_human.gpa.gz", shell=True)
anno = get_objanno('goa_human.gpa', 'gpad', godag=godag)
from pybiomart import Dataset
dataset = Dataset(name='hsapiens_gene_ensembl', host='http://www.ensembl.org')
df = dataset.query(attributes=['ensembl_gene_id', 'external_gene_name', 'ensembl_transcript_id', 'transcript_is_canonical'])
#!/usr/bin/env python
# Author: Guillaume Bouvier -- guillaume.bouvier@pasteur.fr
# https://research.pasteur.fr/en/member/guillaume-bouvier/
# 2016-08-26 13:20:35 (UTC+0200)
# DSSP_SECONCARY.PY
# Trajectories of Secondary Structure by DSSP
# The keys [" ","B","E","G","H","I","T","S"]
#!/bin/bash
cd /opt
export VERSION=1.14.12 OS=linux ARCH=amd64 && \
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \
sudo tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \
rm go$VERSION.$OS-$ARCH.tar.gz
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
@hmartiniano
hmartiniano / users.yml
Last active March 3, 2020 13:03
Ansible playbook to create or remove users. Place SSH public keys in pub_keys/<username>.pub.
---
- hosts: all
user: root
vars:
users:
- username: data
groups: ""
shell: /bin/true
- username: "test"
groups: sudo, data, docker
@hmartiniano
hmartiniano / docker.yml
Created March 3, 2020 12:59
Ansible playbook to install docker CE
---
- hosts: all
user: root
tasks:
- name: Install prerequisites
apt:
name: ['apt-transport-https', 'ca-certificates', 'curl', 'gnupg2' ,'software-properties-common']
update_cache: yes
- name: Add Docker GPG key
---
- hosts: compute
vars:
singularity_version: 3.5.2
become: yes
tasks:
- name: install prerequisites
apt:
update_cache: yes
autoclean: yes
' Adapted from https://stackoverflow.com/questions/34280088/ms-word-macro-for-converting-track-changes-markup-into-text
Sub TrackChangesToMarkup()
Dim chgAdd As Word.Revision
If ActiveDocument.Revisions.Count = 0 Then
MsgBox "There are no revisions in this document", vbOKOnly
Else
ActiveDocument.TrackRevisions = False
For Each chgAdd In ActiveDocument.Revisions
#!/bin/bash
# script to transfer the contents of a remote directory to a local machine
# the script use a brute force approach where the transfer is repeated if
# the return code of the rsync command is anything other than 0 (e.g. if an error occurs)
USERNAME=root
REMOTE_HOST=192.168.1.1
REMOTE_DIR=/home/example
LOCAL_DIR=.