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
/*strcpy: copy t to s*/ | |
void strcpy(char *s,char *t){ | |
while((*s++=*t++)) | |
; | |
} |
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
#transfactor | |
def factorlist(filename): | |
fl=[] | |
factor={} | |
for line in open(filename,'r').readlines(): | |
if line=='XX\n':continue #Lines for split | |
if line=='//\n': | |
if len(factor)==0:continue # Have NO info | |
else: | |
fl.append(factor) #Add factor |
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
#coding:UTF-8 | |
#!/usr/bin/python | |
#使用方法: | |
#python seqcutloc.py fasta文件 序列 输出文件 | |
#./seqcutloc.py fasta文件 序列 输出文件 | |
#算法是通过将长序列按碱基切开 在拼接回原序列 | |
#eg seq:ATAATCGGCGATTAATCGAAT cut:AAT | |
#切完后得到子序列 AT CGGCGATT CG 长度为2 8 2 |
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
#coding:utf-8 | |
import sys | |
#处理permutaion的阈值 返回SNPlist | |
def promusnp(mperm,p=0.001): | |
f=open(mperm,"r") | |
res=[] | |
total=[] | |
line=f.readline() |
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
#coding:UTF-8 | |
#!/usr/bin/python | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
def cancergenes(filename="cancer_gene_census.tsv"): | |
doms,recs=[],[] | |
for line in open(filename,'r').read().split('\r'): | |
cons=line.split("\t") |
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 putin(name,other,peers): | |
if name in peers.keys(): | |
peers[name].append(other) | |
else: | |
peers[name]=[other] | |
def take_peers(filename,split_sign="\t"): | |
inters=open(filename,'r').read().splitlines() |
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 | |
import numpy as np | |
import sys | |
def get_features(gb): | |
context=open(gb,"r").read().split("FEATURES")[1].split("ORIGIN")[0].splitlines() | |
dc={} | |
for line in context: | |
if line[5]==' ': | |
continue |
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 | |
import re | |
id="id" | |
ns="namespace" | |
ia="is-a" | |
nps="node-ptrs" | |
def get_terms_namespaces(go_file): | |
terms={} |
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
# coding:utf-8 | |
""" | |
构建最大简约法进化系统发育树 | |
使用 sh: | |
python sysevatree data > eva-tree.txt | |
""" | |
import sys |
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
""" | |
7万个SNP的hw平横检验MAF的过滤 | |
纯 python ver: | |
pypy 约 20s | |
python 约 25s | |
用 ctypes 调用 c ver: | |
pypy 约 18s | |
python 约 12s <- 比pypy还要好 |
OlderNewer