This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#getting the insert size from a BAM file | |
samtools view -F 0x4 accepted_hits.bam | awk '{if ($9 >0) {sum+=$9;sumsq+=$9*$9;N+=1}} END {print "mean = " sum/N " SD=" sqrt(sumsq/N - (sum/N)**2)}' | |
#slicing a BAM file | |
samtools view aln.sorted.bam chr2:20100000-20200000 | |
# extract a subsequence from a FASTA file | |
# 1) Index the Fasta file | |
samtools faidx hs37d5.ch20.fa | |
# 2) Fetch the sequence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HAPS/SAMPLE format | |
Explanation of format can be found at https://mathgen.stats.ox.ac.uk/genetics_software/shapeit/shapeit.html#hapsample |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Environment variables: | |
CPLUS_INCLUDE_PATH=/opt/gdbm-1.8.3/includ | |
export CPLUS_INCLUDE_PATH | |
/ Link path: | |
LIBRARY_PATH=/opt/gdbm-1.8.3/lib | |
export LIBRARY_PATH | |
# C-style guide | |
http://archive.oreilly.com/oreillyschool/courses/cplusplus1/style.html#functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
In CMake we use # for adding comments | |
// | |
On the top level of a CMake file we have: | |
project(MyProject VERSION 1.0 | |
DESCRIPTION "Very nice project" | |
LANGUAGES CXX) | |
// | |
Making an executable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One can insert images in jupyter nb in different ways: | |
a) Insert this in a Code type cell | |
%%html | |
<img src="img/folder_str1.png",width=100,height=100> | |
Where you have a folder named img at the same level of your notebook | |
b) Insert this in a Markdown type cell: | |
 | |
# | |
# Enabling Table of Contents (TOC) extention in jupyter: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) conda install -c anaconda boost | |
2) Boost libraries will be placed within /path/to/installation/miniconda3/include/ | |
3) Then,modify CMakeList for Clion to point to your Boost folder: | |
cmake_minimum_required(VERSION 3.15) | |
project(test) | |
set(CMAKE_CXX_STANDARD 14) | |
add_executable(test main.cpp gzip.h) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <boost/algorithm/string.hpp> | |
using namespace std; | |
int main() | |
{ | |
//split tab-separated string into vector of strs | |
string line("test\ttest2\ttest3"); | |
vector<string> strs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# how to make iterm to move cursor back and forwards one work at a time | |
Follow instructions at: | |
https://medium.com/@jonnyhaynes/jump-forwards-backwards-and-delete-a-word-in-iterm2-on-mac-os-43821511f0a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command lsid | |
View LSF version, cluster name, and current master host | |
# Command lsclusters | |
Run lsclusters to find out who your cluster administrator is and see a summary of your cluster: | |
# bparams | |
Run bparams to display the generic configuration parameters of LSF. These include default queues, job dispatch interval, job checking interval, and job accepting interval. | |
# modifyng limits for a certain job group |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reading multiple .csv files | |
# files/input.cova | |
# files/input.covb | |
# ..... | |
import dask.dataframe as dd | |
df = dd.read_csv('files/input.cov*', names=['chr','pos','cov'], sep='\t') | |
print("Descriptors: {0}".format(df['cov'].describe().compute())) |