Beispiel #1
0
    def __init__(self, name, get_samplelist=True, group_name=None):

        assert name, "Need a name"
        self.name = name
        self.id = None
        self.shortname = None
        self.fullname = None
        self.type = None
        self.data_scale = None  #ZS: For example log2

        self.setup()

        if self.type == "Temp":  #Need to supply group name as input if temp trait
            self.group = DatasetGroup(
                self, name=group_name
            )  # sets self.group and self.group_id and gets genotype
        else:
            self.check_confidentiality()
            self.retrieve_other_names()
            self.group = DatasetGroup(
                self)  # sets self.group and self.group_id and gets genotype
            self.accession_id = self.get_accession_id()
        if get_samplelist == True:
            self.group.get_samplelist()
        self.species = species.TheSpecies(self)
Beispiel #2
0
    def __init__(self, name, get_samplelist = True):

        assert name, "Need a name"
        self.name = name
        self.id = None
        self.shortname = None
        self.fullname = None
        self.type = None
        self.data_scale = None #ZS: For example log2

        self.setup()

        self.check_confidentiality()

        self.retrieve_other_names()

        self.group = DatasetGroup(self)   # sets self.group and self.group_id and gets genotype
        if get_samplelist == True:
             self.group.get_samplelist()
        self.species = species.TheSpecies(self)
Beispiel #3
0
    def __init__(self, start_vars, temp_uuid):
        trait_db_list = [trait.strip()
                         for trait in start_vars['trait_list'].split(',')]
        helper_functions.get_trait_db_obs(self, trait_db_list)

        self.temp_uuid = temp_uuid
        self.num_permutations = 5000
        self.dataset = self.trait_list[0][1]

        self.json_data = {}  # The dictionary that will be used to create the json object that contains all the data needed to create the figure

        self.all_sample_list = []
        self.traits = []

        chrnames = []
        self.species = species.TheSpecies(dataset=self.trait_list[0][1])
        for key in list(self.species.chromosomes.chromosomes.keys()):
            chrnames.append([self.species.chromosomes.chromosomes[key].name,
                             self.species.chromosomes.chromosomes[key].mb_length])

        for trait_db in self.trait_list:

            this_trait = trait_db[0]
            self.traits.append(this_trait.name)
            this_sample_data = this_trait.data

            for sample in this_sample_data:
                if sample not in self.all_sample_list:
                    self.all_sample_list.append(sample)

        self.sample_data = []
        for trait_db in self.trait_list:
            this_trait = trait_db[0]
            this_sample_data = this_trait.data

            this_trait_vals = []
            for sample in self.all_sample_list:
                if sample in this_sample_data:
                    this_trait_vals.append(this_sample_data[sample].value)
                else:
                    this_trait_vals.append('')
            self.sample_data.append(this_trait_vals)

        self.gen_reaper_results()

        lodnames = []
        chr_pos = []
        pos = []
        markernames = []

        for trait in list(self.trait_results.keys()):
            lodnames.append(trait)

        self.dataset.group.get_markers()
        for marker in self.dataset.group.markers.markers:
            chr_pos.append(marker['chr'])
            pos.append(marker['Mb'])
            markernames.append(marker['name'])

        self.json_data['chrnames'] = chrnames
        self.json_data['lodnames'] = lodnames
        self.json_data['chr'] = chr_pos
        self.json_data['pos'] = pos
        self.json_data['markernames'] = markernames

        for trait in self.trait_results:
            self.json_data[trait] = self.trait_results[trait]

        self.js_data = dict(
            json_data=self.json_data
        )
    def initialize_parameters(self, start_vars):
        if 'first_run' in start_vars:
            self.first_run = "false"
        else:
            self.first_run = "true"
        self.allele_list = []

        self.variant_type = "SNP"
        if 'variant' in start_vars:
            self.variant_type = start_vars['variant']

        self.species_name = "Mouse"
        self.species_id = 1
        if 'species' in start_vars:
            self.species_name = start_vars['species']
            if self.species_name.capitalize() == "Rat":
                self.species_id = 2

        self.mouse_chr_list = []
        self.rat_chr_list = []
        mouse_species_ob = species.TheSpecies(species_name="Mouse")
        for key in mouse_species_ob.chromosomes.chromosomes:
            self.mouse_chr_list.append(
                mouse_species_ob.chromosomes.chromosomes[key].name)
        rat_species_ob = species.TheSpecies(species_name="Rat")
        for key in rat_species_ob.chromosomes.chromosomes:
            self.rat_chr_list.append(
                rat_species_ob.chromosomes.chromosomes[key].name)

        if self.species_id == 1:
            self.this_chr_list = self.mouse_chr_list
        else:
            self.this_chr_list = self.rat_chr_list

        if self.first_run == "true":
            self.chr = "19"
            self.start_mb = 30.1
            self.end_mb = 30.12
        else:
            if 'gene_name' in start_vars:
                if start_vars['gene_name'] != "":
                    self.gene_name = start_vars['gene_name']
                else:
                    self.gene_name = ""
                    self.chr = start_vars['chr']
                    try:
                        self.start_mb = float(start_vars['start_mb'])
                        self.end_mb = float(start_vars['end_mb'])
                    except:
                        self.start_mb = 0.0
                        self.end_mb = 0.0
            else:
                try:
                    self.chr = start_vars['chr']
                    self.start_mb = float(start_vars['start_mb'])
                    self.end_mb = float(start_vars['end_mb'])
                except:
                    self.chr = "1"
                    self.start_mb = 0.0
                    self.end_mb = 0.0

        self.limit_strains = "true"
        if self.first_run == "false":
            if 'limit_strains' not in start_vars:
                self.limit_strains = "false"
            else:
                if start_vars['limit_strains'] == "false":
                    self.limit_strains = "false"

        self.chosen_strains_mouse = [
            "C57BL/6J", "DBA/2J", "A/J", "129S1/SvImJ", "NOD/ShiLtJ",
            "NZO/HlLtJ", "WSB/EiJ", "PWK/PhJ", "CAST/EiJ"
        ]
        self.chosen_strains_rat = ["BN", "F344", "WLI", "WMI"]
        if 'chosen_strains_mouse' in start_vars:
            self.chosen_strains_mouse = start_vars[
                'chosen_strains_mouse'].split(",")
        if 'chosen_strains_rat' in start_vars:
            self.chosen_strains_rat = start_vars['chosen_strains_rat'].split(
                ",")

        if self.species_id == 1:
            self.chosen_strains = self.chosen_strains_mouse
        else:
            self.chosen_strains = self.chosen_strains_rat

        self.domain = "All"
        if 'domain' in start_vars:
            self.domain = start_vars['domain']
        self.function = "All"
        if 'function' in start_vars:
            self.function = start_vars['function']
        self.source = "All"
        if 'source' in start_vars:
            self.source = start_vars['source']
        self.criteria = ">="
        if 'criteria' in start_vars:
            self.criteria = start_vars['criteria']
        self.score = 0.0
        if 'score' in start_vars:
            self.score = start_vars['score']

        self.redundant = "false"
        if self.first_run == "false" and 'redundant' in start_vars:
            self.redundant = "true"
        self.diff_alleles = "true"
        if self.first_run == "false":
            if 'diff_alleles' not in start_vars:
                self.diff_alleles = "false"
            else:
                if start_vars['diff_alleles'] == "false":
                    self.diff_alleles = "false"