Skip to content

Instantly share code, notes, and snippets.

Hello Python Discord
[tool.poetry]
name = "issue"
version = "0.1.0"
description = ""
authors = ["Fin Swimmer"]
exclude = ["issue/exclude_me.py"]
[tool.poetry.dependencies]
python = "^3.6"
rule target:
input:
bam = "SRR7526729_realigned.bam",
index = "SRR7526729_realigned.bam.bai"
rule umi_extract:
input:
R1 = "../{sample}_1.fastq.gz",
R2 = "../{sample}_2.fastq.gz"
output:
kmer count
AAA 72422544
AAC 43498931
AAG 58395299
AAT 72538809
ACA 54592537
ACC 33744272
ACG 7570315
ACT 47439444
AGA 60011989
@finswimmer
finswimmer / default.py
Last active December 22, 2018 13:53
boilerplate to create new scripts, that can read and write from stream and/or filename
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from argparse import ArgumentParser
def main():
args = get_args()
configfile:
"config.json"
SAMPLES, = glob_wildcards(config['data']+"/{id}_L001_R1_001.fastq.gz")
rule move:
input:
bam = expand("{sample}.final.bam", sample=SAMPLES),
bai = expand("{sample}.final.bai", sample=SAMPLES)
params:
configfile:
"config.json"
SAMPLES, = glob_wildcards(config['data']+"/{id}_L001_R1_001.fastq.gz")
rule move:
input:
bam = expand("{sample}.final.bam", sample=SAMPLES),
bai = expand("{sample}.final.bai", sample=SAMPLES)
params:
from Bio import AlignIO
def column(alignment):
'''Generator for getting list of characters in each column in the alignment'''
for i in range(alignment.get_alignment_length()):
c = []
for record in alignment:
c.append(record.seq[i])
@finswimmer
finswimmer / prefixes.txt
Created June 30, 2018 05:35
Ensembl stable ID species prefixes
ENSPFO Poecilia formosa (Amazon molly)
ENSJJA Jaculus jaculus (Lesser Egyptian jerboa)
ENSPCO Propithecus coquereli (Coquerel's sifaka)
ENSNGA Nannospalax galili (Upper Galilee mountains blind mole rat)
ENSMFA Macaca fascicularis (Crab-eating macaque)
ENSMIC Microcebus murinus (Mouse Lemur)
MGP_CAROLIEiJ_ Mus caroli (Ryukyu mouse)
ENSFAL Ficedula albicollis (Flycatcher)
ENSCLA Chinchilla lanigera (Long-tailed chinchilla)
ENSPEM Peromyscus maniculatus bairdii (Northern American deer mouse)
import sys
from Bio import SeqIO
def mismatch(seq1, seq2):
index = []
for i, (s1, s2) in enumerate(zip(seq1, seq2)):
if s1 != s2:
index.append(i)