Exemple #1
0
def main(inputfile, outputfile, gfffile, gffmin, gffmax, takeStop, upstream,
         downstream, verbose):
    takeStart = True
    if takeStop:
        takeStart = False
    sites = ParclipSiteContainer()
    sites.loadFromFile(inputfile)
    anno = gff.GFF(gfffile)
    anno.filterSize(gffmin, gffmax)
    anno.getChromosomePositions()
    if anno.size() < 10:
        print('Warning: Low number of annotation enries! ' + str(anno.size()))
    fsites = ParclipSiteContainer()
    percent_old = 0
    percent_new = 0
    for i in range(sites.size()):
        if anno.isAround(sites.chrs[i], sites.pos[i], sites.strand[i],
                         takeStart, upstream, downstream)[1]:
            fsites.addSite(sites.chrs[i], sites.pos[i], sites.m[i], sites.r[i],
                           sites.result[i], sites.strand[i], sites.occ[i])
        percent_new = round(i / sites.size() * 100)
        if percent_new > percent_old:
            if verbose:
                functions.showProgress(i, anno.size(), 'selecting sites')
            percent_old = percent_new
    fsites.save2File(outputfile)
Exemple #2
0
def getEntries(sites, q1, q2):
    i = 0
    lower = functions.getQuantile(sites.occ,q1)
    upper = functions.getQuantile(sites.occ,q2)
    pc = ParclipSiteContainer()
    count = 0
    size = sites.size()
    for i in range(sites.size()):
        if sites.occ[i] > lower and sites.occ[i] <= upper:
            count += 1
            pc.addSite(sites.chrs[i], sites.pos[i], sites.m[i], sites.r[i], sites.result[i], sites.strand[i], sites.occ[i])
    pc.getChromosomePositions()
    return pc