Skip to content

Instantly share code, notes, and snippets.

View parashardhapola's full-sized avatar
🧣

Parashar parashardhapola

🧣
View GitHub Profile
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>umap_progress_bar</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script><script>
(function() {
function addWidgetsRenderer() {
var mimeElement = document.querySelector('script[type="application/vnd.jupyter.widget-view+json"]');
var scriptElement = document.createElement('script');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@parashardhapola
parashardhapola / scRNA_Seq_fix_var.py
Created April 19, 2018 09:04
Remove mean variance trend in single cell RNA-Seq data
import numpy as np
import pandas as pd
from statsmodels.nonparametric.smoothers_lowess import lowess
def fix_var(gene_stats, n_bins = 200, lowess_frac = 0.4):
# gene_stats is a dataframe with gene names as index (rownames) and two
# columns:
# 'm': mean value of each gene
# 'v': variance of each gene
@parashardhapola
parashardhapola / quadFinder.py
Created August 10, 2016 12:27
Class for searching G-quadruplex motifs. (Part of QuadBase2 webserver)
import re
from itertools import groupby
import os
"""
MIT License
Copyright (c) [2016] [Parashar Dhapola]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@parashardhapola
parashardhapola / GeneImage.py
Last active May 10, 2024 15:23
A pure python code to draw gene diagrams with introns and exons and draw markers ('lollipops') at random positions on the gene
import matplotlib.pyplot as plt
"""
MIT License
Copyright (c) [2016] [Parashar Dhapola]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@parashardhapola
parashardhapola / chrom_vis.py
Created July 18, 2016 06:19
A class for creating annotated chromosome maps (akin to ideograms sans bands) in pure python. Not fully tested but works for me.
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd # Not used here but will be required for creating dataframe
import re
import seaborn.apionly as sns
"""
MIT License
import sys
import numpy as np
class CuffDiff(object):
def __init__(self, filename, up_log_fc_cutoff=1, down_log_fc_cutoff=-1, alpha=0.05):
self.filename = filename
self.upLogFCcutoff = up_log_fc_cutoff
self.downLogFCcutoff = down_log_fc_cutoff
self.alpha = alpha
import sys
from warnings import warn
import os
__author__ = "Parashar Dhapola"
__email__ = ""
__desc__ = """
This script converts whole gene coordinates into TSS coordinates.
Ideally this script should work on any table downloaded form UCSC
@parashardhapola
parashardhapola / GTFparser.py
Created February 20, 2016 17:32
a small piece of code to easily hack into GTF files. Some features not optimized for large genomes so may hog on memory
import sys
from itertools import groupby
def read_fasta(fasta_name):
fh = open(fasta_name)
faiter = (f[1] for f in groupby(fh, lambda line: line[0] == ">"))
for head in faiter:
head = head.next()[1:].strip()
s = "".join(s.strip() for s in faiter.next())
yield head, s
@parashardhapola
parashardhapola / flask_boilerplate_setup.bash
Created September 15, 2015 05:36
A small bash script to create skeleton of a FLASK based webserver and get running
project="Awesome"
mkdir "${project}_project"
cd "${project}_project/"
mkdir $project
virtualenv venv
source venv/bin/activate
pip install flask flask-wtf
cd $project
mkdir static templates data
touch forms.py