def load_human_shape(hg38_parseTrans, shape_name='low_shape.out', rev_hist=False): icSHAPE_ROOT_DIR = '/Share/home/zhangqf8/lipan/DYNAMIC/shape_score/%s/' + shape_name ch_icshape_file = icSHAPE_ROOT_DIR % ("hek_ch_vivo", ) np_icshape_file = icSHAPE_ROOT_DIR % ("hek_np_vivo", ) cy_icshape_file = icSHAPE_ROOT_DIR % ("hek_cy_vivo", ) wc_icshape_file = icSHAPE_ROOT_DIR % ("hek_wc_vivo", ) ch_icshape = tools.loadicSHAPE(ch_icshape_file) np_icshape = tools.loadicSHAPE(np_icshape_file) cy_icshape = tools.loadicSHAPE(cy_icshape_file) wc_icshape = tools.loadicSHAPE(wc_icshape_file) if rev_hist: remove_hist_genes(ch_icshape, hg38_parseTrans) remove_hist_genes(np_icshape, hg38_parseTrans) remove_hist_genes(cy_icshape, hg38_parseTrans) remove_hist_genes(wc_icshape, hg38_parseTrans) human_shape = { 'ch': ch_icshape, 'np': np_icshape, 'cy': cy_icshape, 'wc': wc_icshape } return human_shape
def load_mouse_shape(mm10_parseTrans, rev_hist=False): icSHAPE_ROOT_DIR = '/Share/home/zhangqf8/lipan/DYNAMIC/shape_score/%s/shape.out' ch_icshape_file = icSHAPE_ROOT_DIR % ("mes_ch_vivo", ) np_icshape_file = icSHAPE_ROOT_DIR % ("mes_np_vivo", ) cy_icshape_file = icSHAPE_ROOT_DIR % ("mes_cy_vivo", ) wc_icshape_file = icSHAPE_ROOT_DIR % ("mes_wc_vivo", ) ch_icshape = tools.loadicSHAPE(ch_icshape_file) np_icshape = tools.loadicSHAPE(np_icshape_file) cy_icshape = tools.loadicSHAPE(cy_icshape_file) wc_icshape = tools.loadicSHAPE(wc_icshape_file) if rev_hist: remove_hist_genes(ch_icshape, mm10_parseTrans) remove_hist_genes(np_icshape, mm10_parseTrans) remove_hist_genes(cy_icshape, mm10_parseTrans) remove_hist_genes(wc_icshape, mm10_parseTrans) mouse_shape = { 'ch': ch_icshape, 'np': np_icshape, 'cy': cy_icshape, 'wc': wc_icshape } return mouse_shape
###### Load Human Transcriptome human_seq = tools.readSeq( "/Share/home/zhangqf8/lipan/DYNAMIC/GTF/transcriptome.fa") human_gtf = icSHAPE.loadGTFBed( "/Share/home/zhangqf8/lipan/DYNAMIC/GTF/Homo_sapiens.transCoordinate.bed") ###### Load Human icSHAPE Data icSHAPE_ROOT_DIR = '/Share/home/zhangqf8/lipan/DYNAMIC/shape_score/%s/shape.out' ch_icshape_file = icSHAPE_ROOT_DIR % ("hek_ch_vivo", ) np_icshape_file = icSHAPE_ROOT_DIR % ("hek_np_vivo", ) cy_icshape_file = icSHAPE_ROOT_DIR % ("hek_cy_vivo", ) ch_icshape = tools.loadicSHAPE(ch_icshape_file) np_icshape = tools.loadicSHAPE(np_icshape_file) cy_icshape = tools.loadicSHAPE(cy_icshape_file) Shape = {'ch': ch_icshape, 'np': np_icshape, 'cy': cy_icshape} ###### Load RBP Data clip_file = '/Share/home/zhangqf8/lipan/DYNAMIC/modification/HEK293/m6A/choose_good_protein/clipDB.merged.transCoor.bed' pbr_ensembl = read_pbr(clip_file, human_seq) # Filter out 10-50 regions filt_pbr_ensembl = filterPBR(pbr_ensembl, minLen=10, maxLen=50,
for s, e in raw_geneRBP[gid]: new_geneRBP[gid].append([max(s - extend, 0), e + extend]) return new_geneRBP ######### ### Load data ######### hg38_parser = ParseTrans.ParseTransClass( "/Share/home/zhangqf8/lipan/DYNAMIC/GTF/hg38.genomeCoor.bed") mm10_parser = ParseTrans.ParseTransClass( "/Share/home/zhangqf8/lipan/DYNAMIC/GTF/mm10.genomeCoor.bed") input_path = "/Share/home/zhangqf8/lipan/DYNAMIC/shape_score/%s/shape.out" hg_ch_vivo = tools.loadicSHAPE(input_path % ("hek_gene_ch_vivo", )) hg_ch_vitro = tools.loadicSHAPE(input_path % ("hek_gene_ch_vitro", )) mm_ch_vivo = tools.loadicSHAPE(input_path % ("mes_gene_ch_vivo", )) mm_ch_vitro = tools.loadicSHAPE(input_path % ("mes_gene_ch_vitro", )) ######### ### Calc Mouse GINI ######### mm_vivo_intron, mm_vivo_exon = calcIntronExonGINI(mm_ch_vivo, mm10_parser) print numpy.mean(mm_vivo_intron), numpy.mean(mm_vivo_exon) mm_vitro_intron, mm_vitro_exon = calcIntronExonGINI(mm_ch_vitro, mm10_parser) print numpy.mean(mm_vitro_intron), numpy.mean(mm_vitro_exon) writeFile("/tmp/mm_gini.txt", mm_vivo_exon, mm_vivo_intron, mm_vitro_exon,
if mutation_num <= max_mutation: neighbor_strain_ids.append(trans_id) return neighbor_strain_ids, sorted(mutation_num_list) ################################################################ # 尝试计数窗口中突变个数来判定变化区域 ################################################################ ######### MAC key59, key766 = ['KU501215.1', 'AY632535.2'] Sequence = tools.readSeq( "/Users/lee/Desktop/Projects/Virus/Virus_Genome/final_virus_genome.fa") Shape = tools.loadicSHAPE( "/Users/lee/Desktop/Projects/Virus/Virus_Genome/final_virus_icSHAPE.out") del Shape[key59 + '_vitro'] del Shape[key766 + '_vitro'] Align = tools.readSeq( "/Users/lee/pCloud Drive/Virus_Structure/Covariation/Zika_358.afa") #Align = tools.readSeq("/tmp/dengue.afa") CodonTable = tools.loadCodon( "/Users/lee/Desktop/Projects/Virus/Virus_Genome/Sequence/Codon_Table.txt") ######### Linux key59, key766 = ['KU501215.1', 'AY632535.2'] Sequence = tools.readSeq( "/Share/home/zhangqf8/lipan/virus/final_virus_genome.fa")