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 BCBio import GFF | |
in_file = "test.gff" | |
out_file = "test.parse.gff3" | |
limit_info = { | |
'gff_id': ["1"], # chromosome 1 | |
'gff_type': ["ncRNA"] # get non coding RNA | |
} | |
with open(out_file, "w") as out_handle, open(in_file) as in_handle: |
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 gzip | |
reads = 0 | |
bases = 0 | |
with gzip.open('your.fastq.gz', 'rb') as read: | |
for id in read: | |
seq = next(read) | |
reads += 1 | |
bases += len(seq.strip()) |
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 requests | |
import sys | |
import argparse | |
def set_args(): | |
parser = argparse.ArgumentParser() | |
group = parser.add_mutually_exclusive_group() | |
group.add_argument("-t", "--transcript", help="ensembl's transcript id") | |
group.add_argument("-l", "--list", help="file which contains list of transcript id's") |
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 sys | |
from pysam import VariantFile | |
vcf_in = VariantFile(sys.argv[1]) | |
print(str(vcf_in.header).strip()) | |
for rec in vcf_in: | |
for key, value in rec.info.items(): | |
if vcf_in.header.info[key].number not in ("A", "R", "G", ".", "0"): |
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 sys | |
def replace(text, replacement): | |
new = '' | |
for c in text: | |
try: | |
new += replacement[c] | |
except KeyError: |
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 glob | |
import sys | |
import pandas | |
def read_filenames(names): | |
for arg in names: | |
if "*" in arg: | |
for file in glob.glob(arg): | |
yield file |
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 sys | |
with open(sys.argv[1], "r") as gtf: | |
header = next(gtf) | |
last_gene = { | |
"gene": None, | |
"chr": None, | |
"end": None, | |
} |
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 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) |
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 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) |
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
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) |
OlderNewer