Skip to content

Instantly share code, notes, and snippets.

View wdecoster's full-sized avatar
🐗
Fork me, and then just push me, until I get your, contribution

Wouter De Coster wdecoster

🐗
Fork me, and then just push me, until I get your, contribution
View GitHub Profile
#! /usr/bin/env python
import os
import sys
def main():
versionfile = [os.path.join(root, x) for root, dirs, files in os.walk(os.getcwd()) for x in files if x == "version.py"]
if len(versionfile) == 1:
with open(versionfile[0]) as versionf:
version = versionf.read().split("\"")[1]
os.system("git commit -m 'bumping version to {}' {}".format(version, versionfile[0]))
import pypandoc
long_description=pypandoc.convert(path.join(here, 'README.md'), 'rst'),
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
import pypandoc
here = path.abspath(path.dirname(__file__))
exec(open('nanoplot/version.py').read())
from nanomath import aveQual
from nanoplotter import scatter
from Bio import SeqIO
import numpy as np
import pandas as pd
import sys
import gzip
from scipy import stats
import csv
from nanoplotter import scatter
import pandas as pd
import numpy as np
import sys
from scipy import stats
import pysam
from multiprocessing import Pool
def main():
df = processBam(sys.argv[1], 24)
def aveQual(quals):
'''
Receive the integer quality scores of a read and return the average quality for that read
First convert Phred scores to probabilities, calculate average error probability and convert average back to Phred scale
'''
return -10*math.log(sum([10**(q/-10) for q in quals]) / len(quals), 10)
def aveQual(quals):
'''
Receive the integer quality scores of a read and return the average quality for that read
'''
return sum(quals) / len(quals)
from nanomath import aveQual
from nanoplotter import scatter
from Bio import SeqIO
import pandas as pd
import numpy as np
import seaborn as sns
import sys
import gzip
import matplotlib.pyplot as plt
from scipy import stats
def makeLayout():
'''
Make the layout of the MinION flowcell, based on https://bioinformatics.stackexchange.com/a/749/681
'''
layoutlist = []
for i, j in zip([33, 481, 417, 353, 289, 225, 161, 97], [8, 456, 392, 328, 264, 200, 136, 72]):
for n in range(4):
layoutlist.append(list(range(i+n*8, (i+n*8)+8, 1)) + list(range(j+n*8, (j+n*8)-8, -1)))
return np.array(layoutlist)
# wdecoster
import os
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
import argparse
import gzip
from Bio import SeqIO