This file contains 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
This file contains 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
from cyvcf2 import VCF | |
import pandas as pd | |
import plotly.graph_objects as go | |
import plotly | |
import sys | |
def main(): | |
vcf = VCF(sys.argv[1]) | |
filter_counts = pd.DataFrame.from_records([list(v.gt_types) + [v.FILTER] for v in vcf], columns = vcf.samples + ['filter']) \ | |
.apply(lambda x: is_variant(x), axis=1, result_type='expand') \ |
This file contains 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
from Bio import SeqIO | |
import seaborn as sns | |
from collections import defaultdict | |
import gzip | |
import sys | |
q_per_base = defaultdict(list) | |
for record in SeqIO.parse(gzip.open(sys.argv[1], 'rt'), "fastq"): | |
for n, q in zip(record.seq, record.letter_annotations["phred_quality"]): | |
q_per_base[n].append(q) |
This file contains 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
import pysam | |
from argparse import ArgumentParser | |
def main(): | |
args = get_args() | |
samfile = pysam.AlignmentFile(args.bam) | |
ins = [get_long_ins(read.cigartuples, read.query_sequence) | |
for read in samfile.fetch() if read.query_sequence] | |
head = 1 |
This file contains 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
from argparse import ArgumentParser | |
from cyvcf2 import VCF | |
import pandas as pd | |
def main(): | |
args = get_args() | |
confusion_matrix(args.vcf) | |
This file contains 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
from argparse import ArgumentParser | |
from Bio import SeqIO | |
from collections import Counter, defaultdict | |
import gzip | |
def main(): | |
args = get_args() | |
primers = defaultdict(int) | |
for pattern in args.pattern: |
This file contains 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
import pickle | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
from math import ceil | |
df_al = pickle.load(open("alignment.pickle", "rb")) | |
df_sum = pickle.load(open("summary.pickle", "rb")) | |
df_al_sel = df_al[df_al["lengths"] > 200][["readIDs", "percentIdentity"]].set_index('readIDs') |
This file contains 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
import pandas as pd | |
import matplotlib.pyplot as plt | |
df = pd.read_csv("yield_vs_N50.txt", sep="\t") | |
df.loc[:, "yield"] = df.loc[:, "yield"] / 1e9 | |
df.plot(x="yield", y="N50", kind="scatter") | |
plt.show() |
This file contains 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
from scipy import stats | |
OR, pvalue = stats.fisher_exact([[96, 4], [82, 18]]) |
This file contains 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
import matplotlib.pyplot as plt | |
from pywaffle import Waffle | |
fig = plt.figure( | |
FigureClass=Waffle, | |
rows=5, | |
values={'AA': 82, 'AT': 18}, | |
title={'label': 'Genotypes of patients', 'loc': 'center'}, | |
legend={'loc': 'lower left', 'bbox_to_anchor': (0, -0.4), 'ncol': 2, 'framealpha': 0}, | |
icons='male', icon_size=18, |
NewerOlder