コード例 #1
0
ファイル: make_patterns.py プロジェクト: IDR/idr-metadata
base += "20150501-original/Restored GW screen/"
plates = "idr-metadata/idr0010-doil-dnadamage/screenA/plates/"
dirs = glob(base + "/*")


def iglob(pattern):
    def either(c):
        return '[%s%s]' % (c.lower(), c.upper()) if c.isalpha() else c
    return glob(''.join(map(either, pattern)))


for dir in dirs:
    try:
        dapi, = [x for x in iglob(dir + "/*dapi*") if "spot" not in x]
        try:
            bp, = [x for x in iglob(dir + "/*bp*") if "spot" not in x]
        except Exception:  # Try BB
            bp, = [x for x in iglob(dir + "/*bb*") if "spot" not in x]
    except Exception:
        raise Exception(dir)

    plate = basename(dir)
    bp = bp.replace("bp", "bxxx")
    rv = fp.find_pattern_2seq(dapi, bp)
    rv = rv.replace("bxxx", "bp")
    print plate, " ".join(rv.split("/")[-1].split(" ")[1:])
    with open("%s/%s" % (plates, plate), "w") as screen_file:
        screen_file.write("%s/%s.pattern\n" % (plates, plate))
    with open("%s/%s.pattern" % (plates, plate), "w") as pattern_file:
        pattern_file.write(rv)
コード例 #2
0
plates = "idr-metadata/idr0010-doil-dnadamage/screenA/plates/"
dirs = glob(base + "/*")


def iglob(pattern):
    def either(c):
        return '[%s%s]' % (c.lower(), c.upper()) if c.isalpha() else c

    return glob(''.join(map(either, pattern)))


for dir in dirs:
    try:
        dapi, = [x for x in iglob(dir + "/*dapi*") if "spot" not in x]
        try:
            bp, = [x for x in iglob(dir + "/*bp*") if "spot" not in x]
        except Exception:  # Try BB
            bp, = [x for x in iglob(dir + "/*bb*") if "spot" not in x]
    except Exception:
        raise Exception(dir)

    plate = basename(dir)
    bp = bp.replace("bp", "bxxx")
    rv = fp.find_pattern_2seq(dapi, bp)
    rv = rv.replace("bxxx", "bp")
    print(plate, " ".join(rv.split("/")[-1].split(" ")[1:]))
    with open("%s/%s" % (plates, plate), "w") as screen_file:
        screen_file.write("%s/%s.pattern\n" % (plates, plate))
    with open("%s/%s.pattern" % (plates, plate), "w") as pattern_file:
        pattern_file.write(rv)
コード例 #3
0
 def runTest(self):
     for (s1, s2), exp_p in self.data:
         p = fp.find_pattern_2seq(s1, s2)
         self.assertEqual(p, exp_p)
         self.assertEqual(set(fp.FilePattern(p).filenames()), set((s1, s2)))