Пример #1
0
    def run(self):
        system("mkdir -p %s" % self.outdir)
        clone2sams = read_clone_file(self.clone_file, True)
        if os.path.isdir(self.model):
            model = rcommon.get_median_model(self.model)
        else:
            model = pickle.load(gzip.open(self.model, "rb"))
        sam2total, group2sams = read_clonesize(self.numclone_file)
        len2llh = read_llh(self.lenllh, intkey=True)
        clone2llh = read_llh(self.clonellh)

        global_dir = self.getGlobalTempDir()
        lencount_dir = os.path.join(global_dir, "sam2len2count")
        system("mkdir -p %s" % lencount_dir)
        for s in os.listdir(self.db_dir):
            samdir = os.path.join(self.db_dir, s)
            lencount_file = os.path.join(lencount_dir, s)
            self.addChildTarget(GetLencount(samdir, lencount_file))
        self.setFollowOnTarget(
            GetLlhs(
                clone2sams,
                self.outdir,
                model,
                lencount_dir,
                group2sams,
                self.ingroup,
                self.outgroup,
                len2llh,
                clone2llh,
            )
        )
Пример #2
0
 def run(self):
     model = rcommon.get_median_model(self.model_dir)
     self.logToMaster("Done computing median model.\n")
    
     lens = get_lens(self.db_dir)
     self.logToMaster("Done getting lengths: %s\n" %
                                          ",".join([str(l) for l in lens]))
     self.addChildTarget(GetLenLlhs(self.db_dir, lens, model, self.outfile))
Пример #3
0
def main():
    clone_file = sys.argv[1]
    model_dir = sys.argv[2]
    db_dir = sys.argv[3]
    numclone_file = sys.argv[4]
    outfile = sys.argv[5]
    ingroup = sys.argv[6]
    outgroup = sys.argv[7]

    clone2sams = read_clone_file(clone_file)
    model = rcommon.get_median_model(model_dir)
    sam2total, group2sams = read_clonesize(numclone_file)
    aaclones_likelihood(clone2sams, model, db_dir, sam2total, group2sams,
                        outfile, ingroup, outgroup)
Пример #4
0
    def run(self):
        self.logToMaster("Setting up...\n")
        if not os.path.exists(self.outdir):
            system("mkdir -p %s" % self.outdir)

        #global_dir = self.getGlobalTempDir()
        clones = lcommon.read_list(self.clonefile)
        v2seq = lcommon.read_dict(self.vfile, cap=True)
        j2seq = lcommon.read_dict(self.jfile, cap=True)
        d2seq = lcommon.read_dict(self.dfile, cap=True)
         
        #get the median model
        model = rcommon.get_median_model(self.modeldir)
        modelfile = os.path.join(self.outdir, "recomb_median_model.pickle")
        pickle.dump(model, gzip.open(modelfile, 'wb'))

        self.logToMaster("Done processing the input files.\n")

        for clone in clones:
            items = clone.split('_')
            v = items[0]
            seq = items[1]
            j = items[2]

            vdels = []
            for vdel, vdelfreq in model.v2del[v].iteritems():
                if vdelfreq > 0:
                    vdels.append(vdel)
            jdels = []
            for jdel, jdelfreq in model.j2del[j].iteritems():
                if jdelfreq > 0:
                    jdels.append(jdel)

            vseq = v2seq[v]
            jseq = j2seq[j]
            outdir = os.path.join(self.outdir, clone)
            system("mkdir -p %s" % outdir)
            self.addChildTarget(GetCloneEvents(clone, seq, vseq, jseq, d2seq,
                                               outdir, modelfile, vdels, jdels))
        self.setFollowOnTarget(CloneEventsAgg(self.outdir))