Esempio n. 1
0
    def run(self):
        folder = os.path.split(self.output_file)[0]
        if len(folder) and not os.path.exists(folder):
            os.makedirs(folder)

        if os.path.exists(self.output_file):
            logging.info("Results path %s already exists, delete it if you want it to be calculated again", self.output_file)
            return

        logging.info("Loading people")
        people_by_id = None
        if os.path.exists(self.selected_dosage_folder):
            samples_path = Utilities.samplesInputPath(self.selected_dosage_folder)
            if samples_path is not None:
                people = Person.Person.loadPeople(samples_path)
                people_by_id = {p.id:p for p in people}

        logging.info("Loading weights from database: %s" % (self.weight_db_path))
        weight_db_logic = WeightDBUtilities.WeightDBEntryLogic(self.weight_db_path)

        results = None
        normalization = None
        results, normalization = self.resultsFromCovarianceFile(weight_db_logic)

        self.saveEntries(self.output_file, results, normalization)
Esempio n. 2
0
    def run(self):
        folder = os.path.split(self.output_file)[0]
        if len(folder) and not os.path.exists(folder):
            os.makedirs(folder)

        if os.path.exists(self.output_file):
            logging.info(
                "Results path %s already exists, delete it if you want it to be calculated again",
                self.output_file)
            return

        people_by_id = None
        if os.path.exists(self.selected_dosage_folder):
            logging.info("Loading people")
            samples_path = Utilities.samplesInputPath(
                self.selected_dosage_folder)
            if samples_path is not None:
                people = Person.Person.loadPeople(samples_path)
                people_by_id = {p.id: p for p in people}

        logging.info("Loading weights from database: %s" %
                     (self.weight_db_path))
        weight_db_logic = WeightDBUtilities.WeightDBEntryLogic(
            self.weight_db_path)

        #Normalization is ignored at the moment. Not sure if it will return.
        results = None
        normalization = None
        results, normalization = self.resultsFromCovarianceFile(
            weight_db_logic)

        self.saveEntries(self.output_file, results)

        logging.info("Successfully ran MetaXcan analysis")
Esempio n. 3
0
    def __init__(self, args):
        self.dosage_folder = args.dosage_folder
        self.snp_list = args.snp_list
        self.output_folder = args.output_folder
        self.input_format = args.input_format
        self.output_format = args.output_format
        self.population_group_filters = args.population_group_filters
        self.individual_filters = [re.compile(x) for x in args.individual_filters]

        self.chromosome_in_name_regex = re.compile(args.file_pattern)

        self.samples_input = Utilities.samplesInputPath(self.dosage_folder)
        samples_name = os.path.split(self.samples_input)[1]
        self.samples_output = os.path.join(self.output_folder, samples_name)
Esempio n. 4
0
    def __init__(self, args):
        self.dosage_folder = args.dosage_folder
        self.snp_list = args.snp_list
        self.output_folder = args.output_folder
        self.input_format = args.input_format
        self.output_format = args.output_format
        self.population_group_filters = args.population_group_filters
        self.individual_filters = [
            re.compile(x) for x in args.individual_filters
        ]

        self.chromosome_in_name_regex = re.compile(args.file_pattern)

        self.samples_input = Utilities.samplesInputPath(self.dosage_folder)
        samples_name = os.path.split(self.samples_input)[1]
        self.samples_output = os.path.join(self.output_folder, samples_name)
Esempio n. 5
0
 def testSamplesInputPath(self):
     path = Utilities.samplesInputPath("tests/_td/dosage_set_1")
     self.assertEqual(path, "tests/_td/dosage_set_1/set.sample")
Esempio n. 6
0
 def testSamplesInputPath(self):
     path = Utilities.samplesInputPath("tests/_td/dosage_set_1")
     self.assertEqual(path, "tests/_td/dosage_set_1/set.sample")