Skip to content

Instantly share code, notes, and snippets.

Radhouane Aniba radaniba

Block or report user

Report or block radaniba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@radaniba
radaniba / format_time.R
Last active Apr 18, 2016
Format Date field from excel into a timeseries into csv
View format_time.R
# If not installed please install the gdata package by using this command
#install.packages("gdata")
require(gdata)
#df = read.xls("demo.txt", sheet = 1, header = TRUE, method="tab")
df = read.csv("demo.txt", header = TRUE, sep="\t")
numberOfDays <- function(date) {
@radaniba
radaniba / express_pipeline.ipynb
Last active Sep 9, 2015
Running pipelines everywhere on any server
View express_pipeline.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@radaniba
radaniba / Rython Code Battles
Created Jul 27, 2015
Rython : Learn Data Science while fighting
View Rython Code Battles
Rython : Learn Data Science using 2 programming languages, while having fun
Data Wrangling in Python and R
- Data Structures
- Reading / Writing from/to files
- Extracting data from the web
- Transforming Data
Data Visualization
- Scatterplots
- Histograms
View my_vimrc_home
" set runtimepath+=~/.vim_runtime
" source ~/.vim_runtime/vimrcs/basic.vim
" source ~/.vim_runtime/vimrcs/filetypes.vim
" source ~/.vim_runtime/vimrcs/plugins_config.vim
" source ~/.vim_runtime/vimrcs/extended.vim
" try
" source ~/.vim_runtime/my_configs.vim
" catch
View my_vimrc
" set runtimepath+=~/.vim_runtime
" source ~/.vim_runtime/vimrcs/basic.vim
" source ~/.vim_runtime/vimrcs/filetypes.vim
" source ~/.vim_runtime/vimrcs/plugins_config.vim
" source ~/.vim_runtime/vimrcs/extended.vim
" try
" source ~/.vim_runtime/my_configs.vim
" catch
@radaniba
radaniba / report_generator.py
Created Jul 9, 2015
This small code goes over a lot of bismark results and create a summary tables based on features you want to extract
View report_generator.py
"""
This is a small python script to generate a report based on multiple analysis from bismark
It creates a single doncument (report) as a table
Rows are data parsed
Columns will be samples analyzed
The script takes as argument :
- a path where we have several bismark individual results
- an output filename
@radaniba
radaniba / create_graph.py
Last active Aug 29, 2015
using networkx to create a simple graph
View create_graph.py
import networkx as nx
import matplotlib.pyplot as plt
def draw_graph(graph, labels=None, graph_layout='shell',
node_size=1600, node_color='blue', node_alpha=0.3,
node_text_size=12,
edge_color='blue', edge_alpha=0.3, edge_tickness=1,
edge_text_pos=0.3,
text_font='sans-serif'):
@radaniba
radaniba / test_order.py
Created May 21, 2015
Read a custom order that the user provides and output a list that will be given to some functions The file should contain one sample name per line
View test_order.py
def read_custom_order(order_file):
"""
Read a custom order that the user provides and output a list that will
be given to some functions
The file should contain one sample name per line
"""
samples_order = []
with open(order_file, 'r') as f:
for line in f:
samples_order.append(line.split(" ")[0])
@radaniba
radaniba / SmithWaterman.py
Created Apr 18, 2014
Smith Waterman Implementation in Python
View SmithWaterman.py
#!/Users/Rad/anaconda/bin/python
# (c) 2013 Ryan Boehning
'''A Python implementation of the Smith-Waterman algorithm for local alignment
of nucleotide sequences.
'''
import argparse
@radaniba
radaniba / silent-output.py
Created Mar 22, 2013
The essential problem is how to not get output from a program. Let me explain: Ete2, a Python module for representing phylogenies, has a number of dependencies (MySQLdb, Numpy, PyQt, etc.) that it doesn't necessarily need and it xcan be installed without them. If you don't use the associated functionality, you won't need these dependencies. But,…
View silent-output.py
import os, sys
class SuppressAllOutput (object):
def __enter__(self):
sys.stderr.flush()
self.old_stderr = sys.stderr
sys.stderr = open('/dev/null', 'a+', 0)
sys.stdout.flush()
self.old_stdout = sys.stdout
sys.stdout = open('/dev/null', 'a+', 0)
You can’t perform that action at this time.