def updateContext(fN, fF, wigDir, chrom, strand, switchStrand = False): NX = Nexus(fN, fF) NX.load(['tcc', 'context']) if switchStrand: strand = str(-int(strand)) else: strand = str(strand) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = bioLibCG.dominantSpotter(['C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER']) while NX.nextID(): oChrom, oStrand, start, end = bioLibCG.tccSplit(NX.tcc) #deg wigs is AS to actual clipping site if switchStrand: oStrand = str(-int(strand)) else: oStrand = str(oStrand) if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') NX.context = ds.spotItem(contexts) NX.save()
def updateContext(oFN, wigDir, chrom, strand, rn = None, tn = None): oNX = cgNexusFlat.Nexus(oFN, degPeak.degPeak) oNX.load(['context', 'tcc'], [rn, tn]) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = bioLibCG.dominantSpotter(['C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER']) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') oNX.context[oID] = ds.spotItem(contexts) oNX.save()
def updateContext(oFN, wigDir, chrom, strand, rn=None, tn=None): oNX = cgNexusFlat.Nexus(oFN, degPeak.degPeak) oNX.load(['context', 'tcc'], [rn, tn]) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = bioLibCG.dominantSpotter([ 'C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER' ]) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') oNX.context[oID] = ds.spotItem(contexts) oNX.save()
def updateContext(oFN, wigDir, chrom, strand, switchStrand = False): oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'context']) if switchStrand: strand = str(-int(strand)) else: strand = str(strand) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = bioLibCG.dominantSpotter(['C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER']) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if switchStrand: oStrand = str(-int(strand)) else: oStrand = str(oStrand) if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') oNX.context[oID] = ds.spotItem(contexts) oNX.save()
def updateIContext(oFN, wigDir, chrom, strand, rn = None, tn = None): oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'iContexts'], [rn, tn]) if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'iContext') print 'done loading' for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, '-1').split(',') contexts = [int(x) for x in contexts] oNX.iContexts[oID] = contexts oNX.save()
def updateTypeAlignment(oFN, wigDir, chrom, strand, rn = None, tn = None): '''This is for ALIGNMENTS...NOT DEG PEAKS!''' oNX = cgNexusFlat.Nexus(oFN, cgAlignmentFlat.cgAlignment) oNX.load(['tTcc', 'type'], [rn, tn]) if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_types = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'tType') print 'done loading' domOrder = ['microRNA_noncoding', 'lincRNA_noncoding', 'longNC_noncoding', 'miRNA_pseudogene_noncoding', 'Mt_rRNA_noncoding', 'Mt_tRNA_noncoding', 'Mt_tRNA_pseudogene_noncoding', 'rRNA_noncoding', 'rRNA_pseudogene_noncoding', 'scRNA_pseudogene_noncoding', 'snoRNA_noncoding', 'snoRNA_pseudogene_noncoding', 'snRNA_noncoding', 'snRNA_pseudogene_noncoding', 'tRNA_pseudogene_noncoding', 'pseudogene_noncoding', 'protein_coding', 'None'] ds = bioLibCG.dominantSpotter(domOrder) for oID in oNX.tTcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tTcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: tranTypes = coord_types.get(start, 'None').split(',') types = [x.split(':')[1] if x != 'None' else 'None' for x in tranTypes] types = list(set(types)) oNX.type[oID] = ds.spotItem(types) oNX.save()
def updateType(oFN, wigDir, chrom, strand, rn = None, tn = None): oNX = cgNexusFlat.Nexus(oFN, cgOriginRNAFlat.OriginRNA) oNX.load(['tcc', 'transcriptType', 'transcriptTypes'], [rn, tn]) print 'loading wig' coord_types = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'tType') print 'done loading' domOrder = ['microRNA_noncoding', 'lincRNA_noncoding', 'longNC_noncoding', 'miRNA_pseudogene_noncoding', 'Mt_rRNA_noncoding', 'Mt_tRNA_noncoding', 'Mt_tRNA_pseudogene_noncoding', 'rRNA_noncoding', 'rRNA_pseudogene_noncoding', 'scRNA_pseudogene_noncoding', 'snoRNA_noncoding', 'snoRNA_pseudogene_noncoding', 'snRNA_noncoding', 'snRNA_pseudogene_noncoding', 'tRNA_pseudogene_noncoding', 'pseudogene_noncoding', 'protein_coding', 'None'] ds = cg.dominantSpotter(domOrder) for oID in oNX.tcc: oChrom, oStrand, start, end = cg.tccSplit(oNX.tcc[oID]) if oChrom == chrom and oStrand == strand: tranTypes = coord_types.get(start, 'None').split(',') types = [x.split(':')[1] if x != 'None' else 'None' for x in tranTypes] types = list(set(types)) oNX.transcriptTypes[oID] = types oNX.transcriptType[oID] = ds.spotItem(types) oNX.save()
def updateType(oFN, wigDir, chrom, strand, rn=None, tn=None): oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'type'], [rn, tn]) if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_types = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'tType') print 'done loading' domOrder = [ 'protein_coding', 'miRNA', 'rRNA', 'snoRNA', 'snRNA', 'lincRNA', 'longNC', 'misc_RNA', 'Mt_rRNA', 'Mt_tRNA', 'misc_RNA_pseudogene', 'Mt_tRNA_pseudogene', 'polymorphic_pseudogene', 'processed_transcript', 'miRNA_pseudogene', 'rRNA_pseudogene', 'scRNA_pseudogene', 'snoRNA_pseudogene', 'snRNA_pseudogene', 'tRNA_pseudogene', 'pseudogene', 'TR_C_gene', 'TR_J_gene', 'TR_V_gene', 'TR_V_pseudogene', 'IG_C_gene', 'IG_C_pseudogene', 'IG_D_gene', 'IG_J_gene', 'IG_J_pseudogene', 'IG_V_gene', 'IG_V_pseudogene', 'unknown', 'None' ] ds = bioLibCG.dominantSpotter(domOrder) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: tranTypes = coord_types.get(start, 'None').split(',') print tranTypes types = [ x.split(':')[1] if x != 'None' else ['None'] for x in tranTypes ] oNX.type = oNX.transcriptType = ds.spotItem(types) oNX.save()
def updateTypeAlignment(oFN, wigDir, chrom, strand, rn=None, tn=None): '''This is for ALIGNMENTS...NOT DEG PEAKS!''' oNX = cgNexusFlat.Nexus(oFN, cgAlignmentFlat.cgAlignment) oNX.load(['tTcc', 'type'], [rn, tn]) if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_types = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'tType') print 'done loading' domOrder = [ 'microRNA_noncoding', 'lincRNA_noncoding', 'longNC_noncoding', 'miRNA_pseudogene_noncoding', 'Mt_rRNA_noncoding', 'Mt_tRNA_noncoding', 'Mt_tRNA_pseudogene_noncoding', 'rRNA_noncoding', 'rRNA_pseudogene_noncoding', 'scRNA_pseudogene_noncoding', 'snoRNA_noncoding', 'snoRNA_pseudogene_noncoding', 'snRNA_noncoding', 'snRNA_pseudogene_noncoding', 'tRNA_pseudogene_noncoding', 'pseudogene_noncoding', 'protein_coding', 'None' ] ds = bioLibCG.dominantSpotter(domOrder) for oID in oNX.tTcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tTcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: tranTypes = coord_types.get(start, 'None').split(',') types = [ x.split(':')[1] if x != 'None' else 'None' for x in tranTypes ] types = list(set(types)) oNX.type[oID] = ds.spotItem(types) oNX.save()
def updateType(oFN, wigDir, chrom, strand, rn = None, tn = None): oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'type'], [rn, tn]) if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_types = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'tType') print 'done loading' domOrder = ['protein_coding', 'miRNA', 'rRNA', 'snoRNA', 'snRNA', 'lincRNA', 'longNC', 'misc_RNA', 'Mt_rRNA', 'Mt_tRNA', 'misc_RNA_pseudogene', 'Mt_tRNA_pseudogene', 'polymorphic_pseudogene', 'processed_transcript', 'miRNA_pseudogene', 'rRNA_pseudogene', 'scRNA_pseudogene', 'snoRNA_pseudogene', 'snRNA_pseudogene', 'tRNA_pseudogene', 'pseudogene', 'TR_C_gene', 'TR_J_gene', 'TR_V_gene', 'TR_V_pseudogene', 'IG_C_gene', 'IG_C_pseudogene', 'IG_D_gene', 'IG_J_gene', 'IG_J_pseudogene', 'IG_V_gene', 'IG_V_pseudogene', 'unknown', 'None'] ds = bioLibCG.dominantSpotter(domOrder) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: tranTypes = coord_types.get(start, 'None').split(',') print tranTypes types = [x.split(':')[1] if x != 'None' else ['None'] for x in tranTypes] oNX.type = oNX.transcriptType = ds.spotItem(types) oNX.save()
def updateContext(oFN, wigDir, chrom, strand, rn = None, tn = None): oNX = cgNexusFlat.Nexus(oFN, cgOriginRNAFlat.OriginRNA) oNX.load(['tcc', 'context'], [rn, tn]) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = cg.dominantSpotter(['C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER']) for oID in oNX.tcc: oChrom, oStrand, start, end = cg.tccSplit(oNX.tcc[oID]) if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') oNX.context[oID] = ds.spotItem(contexts) oNX.save()
def updateIContext(oFN, wigDir, chrom, strand, switchStrand=True): strand = str(strand) oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'iContexts']) if switchStrand: if strand == '1': strand = '-1' else: strand = '1' print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'iContext') print 'done loading' for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if switchStrand: if oStrand == '1': oStrand = '-1' else: oStrand = '1' if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, '-1').split(',') contexts = [int(x) for x in contexts] oNX.iContexts[oID] = contexts oNX.save()
def updateContext(oFN, wigDir, chrom, strand, switchStrand=False): oNX = cgNexusFlat.Nexus(oFN, cgDegPeak.Peak) oNX.load(['tcc', 'context']) if switchStrand: strand = str(-int(strand)) else: strand = str(strand) print 'loading wig' coord_contexts = cgWig.loadSingleWigContext(wigDir, chrom, strand, 'context') print 'done loading' ds = bioLibCG.dominantSpotter([ 'C_EXON', 'C_3UTR', 'C_5UTR', 'NC_EXON', 'NC_3UTR', 'NC_5UTR', 'C_INTRON', 'NC_INTRON', 'INTER' ]) for oID in oNX.tcc: oChrom, oStrand, start, end = bioLibCG.tccSplit(oNX.tcc[oID]) #deg wigs is AS to actual clipping site if switchStrand: oStrand = str(-int(strand)) else: oStrand = str(oStrand) if oChrom == chrom and oStrand == strand: contexts = coord_contexts.get(start, 'INTER').split(',') oNX.context[oID] = ds.spotItem(contexts) oNX.save()