Skip to content

Instantly share code, notes, and snippets.

<config lang="json">
{
"name": "mi-core",
"type": "web-python",
"tags": [],
"flags": [],
"ui": "",
"version": "0.1.0",
"cover": "",
"description": "Connect to the bioengine server, and execute operations.",
@Nanguage
Nanguage / panel.imjoy.html
Last active July 6, 2023 08:19
Image viewer ImJoy plugin
<docs lang="markdown">
The panel for upload the image file.
</docs>
<config lang="json">
{
"name": "upload-panel",
"type": "window",
"tags": [],
"ui": "",
@Nanguage
Nanguage / fetch-genecard.py
Last active March 28, 2023 03:47
crawl genecard, fetch gene infos.
# -*- coding: utf-8 -*-
"""
crawl genecard, fetch gene infos.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usage: fetch-genecard.py [-h] [--xpath XPATH] [--base-url BASE_URL]
[--num NUM] [--timeout TIMEOUT]
id_list
library(GenomicRanges)
library(ggbio)
pairs.df <- read.table("D:/tmp/ggbio_demo/ZQL-49_final.txt",header=FALSE, sep="\t")[,1:7]
colnames(pairs.df) <- c("read", "chr1", "pos1", "chr2", "pos2", "strand1", "strand2")
chromsize.df <- read.csv("D:/tmp/ggbio_demo/susScr11_ASFV_noun.fa.csv")
chromsize.gr <- GRanges(
seqnames = chromsize.df$seqnames,
from nd2reader import ND2Reader
import matplotlib.pyplot as plt
from pathlib import Path
import numpy as np
import scipy.ndimage as ndi
import skimage.filters as F
import skimage.morphology as M
import skimage.measure as Ms
import skimage.exposure as E
from skimage.morphology.selem import disk
@Nanguage
Nanguage / crawl_nature.py
Created August 25, 2021 08:17
crawl nature's open access articles html and peer review file links
import typing as t
from pathlib import Path
import fire
import mechanicalsoup
from bs4 import BeautifulSoup
from tqdm import tqdm
browser = mechanicalsoup.StatefulBrowser()
base_urls = {
@Nanguage
Nanguage / process_bigwig.py
Last active August 30, 2019 13:55
code for processing(coarsen, normalize_use_control) bigwig file
import os
import re
from typing import Iterable, Tuple, Optional, Union, Callable, TypeVar
from functools import partial
from contextlib import ContextDecorator
from tqdm.auto import tqdm
Bin = Tuple[str, int, int]
Bigwig = "pyBigWig.bigWigFile"
BinValue = Tuple[Bin, float]
@Nanguage
Nanguage / fetch_douban_album.py
Last active July 5, 2019 06:26
Fetch pictures in Douban Album
"""
Fetch pictures in Douban Album
via Douban API V2(https://douban-api-docs.zce.me/photo.html)
"""
import os
import sys
import json
from typing import Dict, List, Iterator, Tuple
import shutil
from concurrent.futures import ThreadPoolExecutor
import attr
import typing
from collections import defaultdict
@attr.s(auto_attribs=True)
class GFF3Record:
seq_id : str = ""
source : str = ""
type_ : str = ""
start : int = 0
@Nanguage
Nanguage / fetch_kegg_pathway_seqs.py
Created May 30, 2019 10:32
Fetch KEGG pathway's all gene's sequences via KEGG Restful API
import requests
import re
import os
from concurrent.futures import ThreadPoolExecutor
import pandas as pd
from tqdm import tqdm
def fetch_page(base_url):