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()