Esempio n. 1
0
    def simple_kp(self, run=False):
        sub_directory = os.getcwd()

        for ligand_directory in self.ligand_directories:
            if ligand_directory == "Ls":
                kp_ligand = KPParameterTest(arguments=self.arguments)
                self.self_file_list.append("{0}/".format(ligand_directory))
            else:
                kp_ligand = KPParameterTest(self_foreign=True,
                                            arguments=self.arguments)
                self.foreign_file_list.append("{0}/".format(ligand_directory))

            self.file_list = self.foreign_file_list + self.self_file_list
            make_and_cd(ligand_directory)

            kp_ligand.ligand.add_step_0()
            self.add_steps(kp_ligand)

            kp_ligand.generate(kp_ligand.ligand.simulation_name,
                               kp_ligand.set_time_step())

            if run:
                (stdout,
                 stderr) = subprocess.Popen(["qsub {0}".format("qsub.sh")],
                                            shell=True,
                                            stdout=subprocess.PIPE,
                                            cwd=os.getcwd()).communicate()

            os.chdir(sub_directory)

        if run:
            self.wait_for_simulations()
            self.compute_hopfield_error()
Esempio n. 2
0
    def create_submit(self, count, param_grid):
        file_path = "{0}_step_{1}".format(self.steps, count)
        self.paths.append(file_path)
        print("param_grid " + str(param_grid))
        self.parameters.append(str(param_grid))

        make_and_cd(file_path)
        self.make_launch_simulations(param_grid)
        os.chdir(self.home_directory)
Esempio n. 3
0
    def make_launch_simulations(self, set):
        home = os.getcwd()
        for directory in self.sub_directories:
            make_and_cd(directory)
            pickle_out = open("parameters.pickle", "wb")
            pickle.dump(set, pickle_out)
            pickle_out.close()

            if directory == "Ls_Lf_{0}".format(self.lf):
                self.generate_qsub(self_foreign=True)
            else:
                self.generate_qsub()

            if args.run:
                self.launch()
            os.chdir(home)
Esempio n. 4
0
    def p_test(self):
        # make_and_cd(self.sub_directory)
        home_directory = os.getcwd()
        for d_zap in self.zap_diffusion:
            make_and_cd("d_zap_{0}".format(d_zap))

            if self.sub_directory == "Ls":
                kp = KpMembraneSpecies(arguments=args)
            else:
                kp = KpMembraneSpecies(self_foreign=True, arguments=args)

            kp.ligand.diffusion_constants.d_zap = d_zap

            kp.main_script(run=args.run)

            os.chdir(home_directory)
Esempio n. 5
0
    def parameter_testing(self, run=False):
        home_directory = os.getcwd()
        for i in range(len(self.parameter_list)):
            dir_name = "parameter_{0}".format(i)
            make_and_cd(dir_name)
            sub_directory = os.getcwd()

            for ligand_directory in self.ligand_directories:
                if ligand_directory == "Ls":
                    kp_ligand = KPParameterTest(arguments=self.arguments)
                    self.self_file_list.append("{0}/{1}/".format(
                        dir_name, ligand_directory))
                else:
                    kp_ligand = KPParameterTest(self_foreign=True,
                                                arguments=self.arguments)
                    self.foreign_file_list.append("{0}/{1}/".format(
                        dir_name, ligand_directory))

                self.file_list = self.foreign_file_list + self.self_file_list
                make_and_cd(ligand_directory)

                self.change_parameter(kp_ligand, self.parameter_list[i])
                # kp_ligand.ligand.rate_constants.k_lck_off_zap_R = self.parameter_list[i]
                kp_ligand.ligand.add_step_0()

                self.add_steps(kp_ligand)

                kp_ligand.generate(kp_ligand.ligand.simulation_name,
                                   kp_ligand.set_time_step())

                if run:
                    (stdout,
                     stderr) = subprocess.Popen(["qsub {0}".format("qsub.sh")],
                                                shell=True,
                                                stdout=subprocess.PIPE,
                                                cwd=os.getcwd()).communicate()

                os.chdir(sub_directory)

            os.chdir(home_directory)

        np.savetxt("rates", self.parameter_list, fmt='%f')

        if run:
            self.wait_for_simulations()
            self.compute_hopfield_error(parameter_test=True)
                        default=0,
                        help="number of KP steps.")
    parser.add_argument('--ls',
                        action='store_true',
                        default=False,
                        help="flag for submitting Ls calculations.")
    parser.add_argument('--ls_lf',
                        dest='ls_lf',
                        action='store',
                        type=int,
                        default=3,
                        help="number of foreign ligands.")
    args = parser.parse_args()

    directory_name = "{0}_step".format(args.steps)
    make_and_cd(directory_name)

    if args.ls:
        sub_directory = "Ls"
        make_and_cd(sub_directory)
        kp = KPRealisticSingleMolecule(arguments=args)

    elif args.ls_lf:
        sub_directory = "Ls_Lf"
        # make_and_cd(sub_directory)
        kp = KPRealisticSingleMolecule(self_foreign=True, arguments=args)
    else:
        raise Exception("Need to specify Ls or Ls_Lf")

    kp.main_script(run=args.run)
Esempio n. 7
0
        q.write("python ~/SSC_python_modules/pysb_sos_fb.py --run\n")
        q.close()

    def launch(self):
        (stdout, stderr) = subprocess.Popen(["qsub {0}".format("qsub.sh")],
                                            shell=True,
                                            stdout=subprocess.PIPE,
                                            cwd=os.getcwd()).communicate()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Submitting ode calculations as function of steps",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--run',
                        action='store_true',
                        default=False,
                        help='Flag for submitting simulations.')

    args = parser.parse_args()

    if not args.run:
        make_and_cd("Ras_SoS_Fb_200")
        qsub = LaunchQsub()
        qsub.generate_qsub()
        qsub.launch()
    else:
        sos = SoSFeedback()
        sos.main()
                        default=False,
                        help="flag for early positive feedback loop.")
    parser.add_argument('--latpp_ext',
                        dest='latpp_ext',
                        action='store_true',
                        default=False,
                        help="flag for building latpp bound tcr network.")
    parser.add_argument('--toy_model',
                        dest='toy_model',
                        action='store_true',
                        default=False,
                        help="flag for running toy model calculations.")

    args = parser.parse_args()

    make_and_cd("{0}_step".format(args.steps))

    sub_directories = ["Ls", "Ls_Lf_{0}".format(args.lf)]
    home_directory = os.getcwd()

    for directory in sub_directories:
        if directory in os.listdir(".."):
            continue

        make_and_cd(directory)
        if directory == "Ls_Lf_{0}".format(args.lf):
            if args.early_pos:
                qsub = LaunchQsub(args.steps,
                                  lf=args.lf,
                                  self_foreign=True,
                                  early_pos=True)