diff options
48 files changed, 8174 insertions, 18 deletions
diff --git a/default_settings.py b/default_settings.py new file mode 100644 index 0000000..9cdc665 --- /dev/null +++ b/default_settings.py @@ -0,0 +1,18 @@ +"""module contains default settings for genenetwork""" +import os + + +USE_REDIS = True + +GN2_BASE_URL = "https://genenetwork.org/" + + +HOME = os.environ['HOME'] + +# SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s" + +SQL_URI = os.environ.get("SQL_URI","mysql+pymysql://kabui:1234@localhost/db_webqtl") + +SECRET_HMAC_CODE = '\x08\xdf\xfa\x93N\x80\xd9\\H@\\\x9f`\x98d^\xb4a;\xc6OM\x946a\xbc\xfc\x80:*\xebc' + +GENENETWORK_FILES = os.environ.get("GENENETWORK_FILES",HOME+"/data/genotype_files") diff --git a/docs/correlation.md b/docs/correlation.md new file mode 100644 index 0000000..bd1b278 --- /dev/null +++ b/docs/correlation.md @@ -0,0 +1,42 @@ +### endpoint for correlation endpoint + +- The endpoint for correlation is +```python + + /api/correlation/compute/corr_compute +``` + + +**To be noted before spinning the server for correlation computation\which can be set for example env +SQL_URI=mysql://user:password@localhost/db_webqtl and also to GENENETWORK_FILES default is HOME+"/data/genotype_files** + +(required input data *should be in json format*) +- "primary_samples": "", +- "trait_id" +- "dataset" +- "sample_vals" +- "corr_type" +- "corr_dataset" +- "corr_return_results" +- "corr_samples_group" +- "corr_sample_method" +- "min_expr" +- "location_type" +- "loc_chr" +- "min_loc_mb" +- "max_loc_mb" +- "p_range_lower" +- "p_range_upper" + +- example + +```bash +curl -X POST -H "Content-Type: application/json" \ + -d '{"primary_samles":"",trait_id:"","dataset":"","sample_vals":"","corr_type":"",corr_sample_group:"",corr_sample_method:""}' \ + localhost:5000/api/correlation/correlation_compute + + ``` + + +- output data is correlation_json + diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py new file mode 100644 index 0000000..4e3e07e --- /dev/null +++ b/gn3/api/correlation.py @@ -0,0 +1,68 @@ +"""Endpoints for computing correlation""" +import pickle +import time +from flask import Blueprint +from flask import jsonify +from flask import request +from flask import g +from flask import after_this_request +from default_settings import SQL_URI + +# import pymysql + +from sqlalchemy import create_engine +from gn3.correlation.correlation_computations import compute_correlation + + +correlation = Blueprint("correlation", __name__) + + + +# xtodo implement neat db setup +@correlation.before_request +def connect_db(): + """add connection to db method""" + print("@app.before_request connect_db") + db_connection = getattr(g, '_database', None) + if db_connection is None: + print("Get new database connector") + g.db = g._database = create_engine(SQL_URI, encoding="latin1") + + g.initial_time = time.time() + + +@correlation.after_request +def after_request_func(response): + final_time = time.time() - g.initial_time + print(f"This request for Correlation took {final_time} Seconds") + + g.initial_time = None + + return response + + + + +@correlation.route("/corr_compute", methods=["POST"]) +def corr_compute_page(): + """api for doing correlation""" + + # todo accepts both form and json data + + correlation_input = request.json + + if correlation_input is None: + return jsonify({"error": str("Bad request")}),400 + + + + try: + corr_results = compute_correlation(correlation_input_data=correlation_input) + + + except Exception as error: # pylint: disable=broad-except + return jsonify({"error": str(error)}) + + return { + "correlation_results":corr_results + }
\ No newline at end of file @@ -4,9 +4,10 @@ import os from typing import Dict from typing import Union from flask import Flask - +from gn3.config import get_config from gn3.api.gemma import gemma from gn3.api.general import general +from gn3.api.correlation import correlation def create_app(config: Union[Dict, str, None] = None) -> Flask: @@ -15,6 +16,10 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: # Load default configuration app.config.from_object("gn3.settings") + my_config = get_config() + + app.config.from_object(my_config["dev"]) + # Load environment configuration if "GN3_CONF" in os.environ: app.config.from_envvar('GN3_CONF') @@ -27,4 +32,5 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: app.config.from_pyfile(config) app.register_blueprint(general, url_prefix="/api/") app.register_blueprint(gemma, url_prefix="/api/gemma") + app.register_blueprint(correlation,url_prefix="/api/correlation") return app diff --git a/gn3/base/__init__.py b/gn3/base/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gn3/base/__init__.py diff --git a/gn3/base/data_set.py b/gn3/base/data_set.py new file mode 100644 index 0000000..e61e4eb --- /dev/null +++ b/gn3/base/data_set.py @@ -0,0 +1,886 @@ + +import json +import math +import collections +import requests +from redis import Redis +from flask import g +from gn3.utility.db_tools import escape +from gn3.utility.db_tools import mescape +from gn3.utility.db_tools import create_in_clause +from gn3.utility.tools import locate_ignore_error +from gn3.db.calls import fetch1 +from gn3.db.calls import fetchone +from gn3.db.webqtlDatabaseFunction import retrieve_species +from gn3.utility import chunks + +from gn3.utility import get_group_samplelists +from gn3.base.species import TheSpecies +r = Redis() + +# should probably move this to its own configuration files + +USE_REDIS = True + +# todo move to config file +GN2_BASE_URL = "https://genenetwork.org/" + +DS_NAME_MAP = {} + +# pylint: disable-all +#todo file not linted +# pylint: disable=C0103 + + + +def create_dataset(dataset_name, dataset_type=None, get_samplelist=True, group_name=None): + + if dataset_name == "Temp": + dataset_type = "Temp" + + if dataset_type is None: + dataset_type = Dataset_Getter(dataset_name) + dataset_ob = DS_NAME_MAP[dataset_type] + dataset_class = globals()[dataset_ob] + + if dataset_type == "Temp": + results = dataset_class(dataset_name, get_samplelist, group_name) + + else: + results = dataset_class(dataset_name, get_samplelist) + + return results + + +class DatasetType: + def __init__(self, redis_instance): + self.redis_instance = redis_instance + self.datasets = {} + + data = self.redis_instance.get("dataset_structure") + if data: + self.datasets = json.loads(data) + + else: + + try: + + data = json.loads(requests.get( + GN2_BASE_URL + "/api/v_pre1/gen_dropdown", timeout=5).content) + + # todo:Refactor code below n^4 loop + + for species in data["datasets"]: + for group in data["datasets"][species]: + for dataset_type in data['datasets'][species][group]: + for dataset in data['datasets'][species][group][dataset_type]: + + short_dataset_name = dataset[1] + if dataset_type == "Phenotypes": + new_type = "Publish" + + elif dataset_type == "Genotypes": + new_type = "Geno" + else: + new_type = "ProbeSet" + + self.datasets[short_dataset_name] = new_type + + except Exception as e: + raise e + + self.redis_instance.set( + "dataset_structure", json.dumps(self.datasets)) + + def set_dataset_key(self, t, name): + """If name is not in the object's dataset dictionary, set it, and update + dataset_structure in Redis + + args: + t: Type of dataset structure which can be: 'mrna_expr', 'pheno', + 'other_pheno', 'geno' + name: The name of the key to inserted in the datasets dictionary + + """ + + sql_query_mapping = { + 'mrna_expr': ("""SELECT ProbeSetFreeze.Id FROM """ + + """ProbeSetFreeze WHERE ProbeSetFreeze.Name = "{}" """), + 'pheno': ("""SELECT InfoFiles.GN_AccesionId """ + + """FROM InfoFiles, PublishFreeze, InbredSet """ + + """WHERE InbredSet.Name = '{}' AND """ + + """PublishFreeze.InbredSetId = InbredSet.Id AND """ + + """InfoFiles.InfoPageName = PublishFreeze.Name"""), + 'other_pheno': ("""SELECT PublishFreeze.Name """ + + """FROM PublishFreeze, InbredSet """ + + """WHERE InbredSet.Name = '{}' AND """ + + """PublishFreeze.InbredSetId = InbredSet.Id"""), + 'geno': ("""SELECT GenoFreeze.Id FROM GenoFreeze WHERE """ + + """GenoFreeze.Name = "{}" """) + } + + dataset_name_mapping = { + "mrna_expr": "ProbeSet", + "pheno": "Publish", + "other_pheno": "Publish", + "geno": "Geno", + } + + group_name = name + if t in ['pheno', 'other_pheno']: + group_name = name.replace("Publish", "") + + results = g.db.execute( + sql_query_mapping[t].format(group_name)).fetchone() + if results: + self.datasets[name] = dataset_name_mapping[t] + self.redis_instance.set( + "dataset_structure", json.dumps(self.datasets)) + + return True + + return None + + def __call__(self, name): + if name not in self.datasets: + for t in ["mrna_expr", "pheno", "other_pheno", "geno"]: + + if(self.set_dataset_key(t, name)): + # This has side-effects, with the end result being a truth-y value + break + + return self.datasets.get(name, None) + + +# Do the intensive work at startup one time only +# could replace the code below +Dataset_Getter = DatasetType(r) + + +class DatasetGroup: + """ + Each group has multiple datasets; each species has multiple groups. + + For example, Mouse has multiple groups (BXD, BXA, etc), and each group + has multiple datasets associated with it. + + """ + + def __init__(self, dataset, name=None): + """This sets self.group and self.group_id""" + if name == None: + self.name, self.id, self.genetic_type = fetchone( + dataset.query_for_group) + + else: + self.name, self.id, self.genetic_type = fetchone( + "SELECT InbredSet.Name, InbredSet.Id, InbredSet.GeneticType FROM InbredSet where Name='%s'" % name) + + if self.name == 'BXD300': + self.name = "BXD" + + self.f1list = None + + self.parlist = None + + self.get_f1_parent_strains() + + # remove below not used in correlation + + self.mapping_id, self.mapping_names = self.get_mapping_methods() + + self.species = retrieve_species(self.name) + + def get_f1_parent_strains(self): + try: + # should import ParInfo + raise e + # NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py; + f1, f12, maternal, paternal = webqtlUtil.ParInfo[self.name] + except Exception as e: + f1 = f12 = maternal = paternal = None + + if f1 and f12: + self.f1list = [f1, f12] + + if maternal and paternal: + self.parlist = [maternal, paternal] + + def get_mapping_methods(self): + mapping_id = g.db.execute( + "select MappingMethodId from InbredSet where Name= '%s'" % self.name).fetchone()[0] + + if mapping_id == "1": + mapping_names = ["GEMMA", "QTLReaper", "R/qtl"] + elif mapping_id == "2": + mapping_names = ["GEMMA"] + + elif mapping_id == "3": + mapping_names = ["R/qtl"] + + elif mapping_id == "4": + mapping_names = ["GEMMA", "PLINK"] + + else: + mapping_names = [] + + return mapping_id, mapping_names + + def get_samplelist(self): + result = None + key = "samplelist:v3:" + self.name + if USE_REDIS: + result = r.get(key) + + if result is not None: + + self.samplelist = json.loads(result) + + else: + # logger.debug("Cache not hit") + # should enable logger + genotype_fn = locate_ignore_error(self.name+".geno", 'genotype') + if genotype_fn: + self.samplelist = get_group_samplelists.get_samplelist( + "geno", genotype_fn) + + else: + self.samplelist = None + + if USE_REDIS: + r.set(key, json.dumps(self.samplelist)) + r.expire(key, 60*5) + + +class DataSet: + """ + DataSet class defines a dataset in webqtl, can be either Microarray, + Published phenotype, genotype, or user input dataset(temp) + + """ + + 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 + # sets self.group and self.group_id and gets genotype + self.group = DatasetGroup(self, name=group_name) + else: + self.check_confidentiality() + self.retrieve_other_names() + # sets self.group and self.group_id and gets genotype + self.group = DatasetGroup(self) + self.accession_id = self.get_accession_id() + if get_samplelist == True: + self.group.get_samplelist() + self.species = TheSpecies(self) + + def get_desc(self): + """Gets overridden later, at least for Temp...used by trait's get_given_name""" + return None + + # Delete this eventually + @property + def riset(): + Weve_Renamed_This_As_Group + + def get_accession_id(self): + if self.type == "Publish": + results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where + InbredSet.Name = %s and + PublishFreeze.InbredSetId = InbredSet.Id and + InfoFiles.InfoPageName = PublishFreeze.Name and + PublishFreeze.public > 0 and + PublishFreeze.confidentiality < 1 order by + PublishFreeze.CreateTime desc""", (self.group.name)).fetchone() + elif self.type == "Geno": + results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where + InbredSet.Name = %s and + GenoFreeze.InbredSetId = InbredSet.Id and + InfoFiles.InfoPageName = GenoFreeze.ShortName and + GenoFreeze.public > 0 and + GenoFreeze.confidentiality < 1 order by + GenoFreeze.CreateTime desc""", (self.group.name)).fetchone() + else: + results = None + + if results != None: + return str(results[0]) + else: + return "None" + + def retrieve_other_names(self): + """This method fetches the the dataset names in search_result. + + If the data set name parameter is not found in the 'Name' field of + the data set table, check if it is actually the FullName or + ShortName instead. + + This is not meant to retrieve the data set info if no name at + all is passed. + + """ + + try: + if self.type == "ProbeSet": + query_args = tuple(escape(x) for x in ( + self.name, + self.name, + self.name)) + + self.id, self.name, self.fullname, self.shortname, self.data_scale, self.tissue = fetch1(""" + SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName, ProbeSetFreeze.ShortName, ProbeSetFreeze.DataScale, Tissue.Name + FROM ProbeSetFreeze, ProbeFreeze, Tissue + WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id + AND ProbeFreeze.TissueId = Tissue.Id + AND (ProbeSetFreeze.Name = '%s' OR ProbeSetFreeze.FullName = '%s' OR ProbeSetFreeze.ShortName = '%s') + """ % (query_args), "/dataset/"+self.name+".json", + lambda r: (r["id"], r["name"], r["full_name"], + r["short_name"], r["data_scale"], r["tissue"]) + ) + else: + query_args = tuple(escape(x) for x in ( + (self.type + "Freeze"), + self.name, + self.name, + self.name)) + + self.tissue = "N/A" + self.id, self.name, self.fullname, self.shortname = fetchone(""" + SELECT Id, Name, FullName, ShortName + FROM %s + WHERE (Name = '%s' OR FullName = '%s' OR ShortName = '%s') + """ % (query_args)) + + except TypeError as e: + logger.debug( + "Dataset {} is not yet available in GeneNetwork.".format(self.name)) + pass + + def get_trait_data(self, sample_list=None): + if sample_list: + self.samplelist = sample_list + else: + self.samplelist = self.group.samplelist + + if self.group.parlist != None and self.group.f1list != None: + if (self.group.parlist + self.group.f1list) in self.samplelist: + self.samplelist += self.group.parlist + self.group.f1list + + query = """ + SELECT Strain.Name, Strain.Id FROM Strain, Species + WHERE Strain.Name IN {} + and Strain.SpeciesId=Species.Id + and Species.name = '{}' + """.format(create_in_clause(self.samplelist), *mescape(self.group.species)) + # logger.sql(query) + results = dict(g.db.execute(query).fetchall()) + sample_ids = [results[item] for item in self.samplelist] + + # MySQL limits the number of tables that can be used in a join to 61, + # so we break the sample ids into smaller chunks + # Postgres doesn't have that limit, so we can get rid of this after we transition + chunk_size = 50 + number_chunks = int(math.ceil(len(sample_ids) / chunk_size)) + trait_sample_data = [] + for sample_ids_step in chunks.divide_into_chunks(sample_ids, number_chunks): + if self.type == "Publish": + dataset_type = "Phenotype" + else: + dataset_type = self.type + temp = ['T%s.value' % item for item in sample_ids_step] + if self.type == "Publish": + query = "SELECT {}XRef.Id,".format(escape(self.type)) + else: + query = "SELECT {}.Name,".format(escape(dataset_type)) + data_start_pos = 1 + query += ', '.join(temp) + query += ' FROM ({}, {}XRef, {}Freeze) '.format(*mescape(dataset_type, + self.type, + self.type)) + + for item in sample_ids_step: + query += """ + left join {}Data as T{} on T{}.Id = {}XRef.DataId + and T{}.StrainId={}\n + """.format(*mescape(self.type, item, item, self.type, item, item)) + + if self.type == "Publish": + query += """ + WHERE {}XRef.InbredSetId = {}Freeze.InbredSetId + and {}Freeze.Name = '{}' + and {}.Id = {}XRef.{}Id + order by {}.Id + """.format(*mescape(self.type, self.type, self.type, self.name, + dataset_type, self.type, dataset_type, dataset_type)) + else: + query += """ + WHERE {}XRef.{}FreezeId = {}Freeze.Id + and {}Freeze.Name = '{}' + and {}.Id = {}XRef.{}Id + order by {}.Id + """.format(*mescape(self.type, self.type, self.type, self.type, + self.name, dataset_type, self.type, self.type, dataset_type)) + + results = g.db.execute(query).fetchall() + trait_sample_data.append(results) + + trait_count = len(trait_sample_data[0]) + self.trait_data = collections.defaultdict(list) + + # put all of the separate data together into a dictionary where the keys are + # trait names and values are lists of sample values + for trait_counter in range(trait_count): + trait_name = trait_sample_data[0][trait_counter][0] + for chunk_counter in range(int(number_chunks)): + self.trait_data[trait_name] += ( + trait_sample_data[chunk_counter][trait_counter][data_start_pos:]) + + +class MrnaAssayDataSet(DataSet): + ''' + An mRNA Assay is a quantitative assessment (assay) associated with an mRNA trait + + This used to be called ProbeSet, but that term only refers specifically to the Affymetrix + platform and is far too specific. + + ''' + DS_NAME_MAP['ProbeSet'] = 'MrnaAssayDataSet' + + def setup(self): + # Fields in the database table + self.search_fields = ['Name', + 'Description', + 'Probe_Target_Description', + 'Symbol', + 'Alias', + 'GenbankId', + 'UniGeneId', + 'RefSeq_TranscriptId'] + + # Find out what display_fields is + self.display_fields = ['name', 'symbol', + 'description', 'probe_target_description', + 'chr', 'mb', + 'alias', 'geneid', + 'genbankid', 'unigeneid', + 'omim', 'refseq_transcriptid', + 'blatseq', 'targetseq', + 'chipid', 'comments', + 'strand_probe', 'strand_gene', + 'proteinid', 'uniprotid', + 'probe_set_target_region', + 'probe_set_specificity', + 'probe_set_blat_score', + 'probe_set_blat_mb_start', + 'probe_set_blat_mb_end', + 'probe_set_strand', + 'probe_set_note_by_rw', + 'flag'] + + # Fields displayed in the search results table header + self.header_fields = ['Index', + 'Record', + 'Symbol', + 'Description', + 'Location', + 'Mean', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + # Todo: Obsolete or rename this field + self.type = 'ProbeSet' + + self.query_for_group = ''' + SELECT + InbredSet.Name, InbredSet.Id, InbredSet.GeneticType + FROM + InbredSet, ProbeSetFreeze, ProbeFreeze + WHERE + ProbeFreeze.InbredSetId = InbredSet.Id AND + ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND + ProbeSetFreeze.Name = "%s" + ''' % escape(self.name) + + def check_confidentiality(self): + return geno_mrna_confidentiality(self) + + def get_trait_info(self, trait_list=None, species=''): + + # Note: setting trait_list to [] is probably not a great idea. + if not trait_list: + trait_list = [] + + for this_trait in trait_list: + + if not this_trait.haveinfo: + this_trait.retrieveInfo(QTL=1) + + if not this_trait.symbol: + this_trait.symbol = "N/A" + + # XZ, 12/08/2008: description + # XZ, 06/05/2009: Rob asked to add probe target description + description_string = str( + str(this_trait.description).strip(codecs.BOM_UTF8), 'utf-8') + target_string = str( + str(this_trait.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8') + + if len(description_string) > 1 and description_string != 'None': + description_display = description_string + else: + description_display = this_trait.symbol + + if (len(description_display) > 1 and description_display != 'N/A' and + len(target_string) > 1 and target_string != 'None'): + description_display = description_display + '; ' + target_string.strip() + + # Save it for the jinja2 template + this_trait.description_display = description_display + + if this_trait.chr and this_trait.mb: + this_trait.location_repr = 'Chr%s: %.6f' % ( + this_trait.chr, float(this_trait.mb)) + + # Get mean expression value + query = ( + """select ProbeSetXRef.mean from ProbeSetXRef, ProbeSet + where ProbeSetXRef.ProbeSetFreezeId = %s and + ProbeSet.Id = ProbeSetXRef.ProbeSetId and + ProbeSet.Name = '%s' + """ % (escape(str(this_trait.dataset.id)), + escape(this_trait.name))) + + #logger.debug("query is:", pf(query)) + logger.sql(query) + result = g.db.execute(query).fetchone() + + mean = result[0] if result else 0 + + if mean: + this_trait.mean = "%2.3f" % mean + + # LRS and its location + this_trait.LRS_score_repr = 'N/A' + this_trait.LRS_location_repr = 'N/A' + + # Max LRS and its Locus location + if this_trait.lrs and this_trait.locus: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '{}' and + Geno.Name = '{}' and + Geno.SpeciesId = Species.Id + """.format(species, this_trait.locus) + logger.sql(query) + result = g.db.execute(query).fetchone() + + if result: + lrs_chr, lrs_mb = result + this_trait.LRS_score_repr = '%3.1f' % this_trait.lrs + this_trait.LRS_location_repr = 'Chr%s: %.6f' % ( + lrs_chr, float(lrs_mb)) + + return trait_list + + def retrieve_sample_data(self, trait): + query = """ + SELECT + Strain.Name, ProbeSetData.value, ProbeSetSE.error, NStrain.count, Strain.Name2 + FROM + (ProbeSetData, ProbeSetFreeze, Strain, ProbeSet, ProbeSetXRef) + left join ProbeSetSE on + (ProbeSetSE.DataId = ProbeSetData.Id AND ProbeSetSE.StrainId = ProbeSetData.StrainId) + left join NStrain on + (NStrain.DataId = ProbeSetData.Id AND + NStrain.StrainId = ProbeSetData.StrainId) + WHERE + ProbeSet.Name = '%s' AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND + ProbeSetFreeze.Name = '%s' AND + ProbeSetXRef.DataId = ProbeSetData.Id AND + ProbeSetData.StrainId = Strain.Id + Order BY + Strain.Name + """ % (escape(trait), escape(self.name)) + # logger.sql(query) + results = g.db.execute(query).fetchall() + #logger.debug("RETRIEVED RESULTS HERE:", results) + return results + + def retrieve_genes(self, column_name): + query = """ + select ProbeSet.Name, ProbeSet.%s + from ProbeSet,ProbeSetXRef + where ProbeSetXRef.ProbeSetFreezeId = %s and + ProbeSetXRef.ProbeSetId=ProbeSet.Id; + """ % (column_name, escape(str(self.id))) + # logger.sql(query) + results = g.db.execute(query).fetchall() + + return dict(results) + + +class TempDataSet(DataSet): + '''Temporary user-generated data set''' + + DS_NAME_MAP['Temp'] = 'TempDataSet' + + def setup(self): + self.search_fields = ['name', + 'description'] + + self.display_fields = ['name', + 'description'] + + self.header_fields = ['Name', + 'Description'] + + self.type = 'Temp' + + # Need to double check later how these are used + self.id = 1 + self.fullname = 'Temporary Storage' + self.shortname = 'Temp' + + +class PhenotypeDataSet(DataSet): + DS_NAME_MAP['Publish'] = 'PhenotypeDataSet' + + def setup(self): + + #logger.debug("IS A PHENOTYPEDATASET") + + # Fields in the database table + self.search_fields = ['Phenotype.Post_publication_description', + 'Phenotype.Pre_publication_description', + 'Phenotype.Pre_publication_abbreviation', + 'Phenotype.Post_publication_abbreviation', + 'PublishXRef.mean', + 'Phenotype.Lab_code', + 'Publication.PubMed_ID', + 'Publication.Abstract', + 'Publication.Title', + 'Publication.Authors', + 'PublishXRef.Id'] + + # Figure out what display_fields is + self.display_fields = ['name', 'group_code', + 'pubmed_id', + 'pre_publication_description', + 'post_publication_description', + 'original_description', + 'pre_publication_abbreviation', + 'post_publication_abbreviation', + 'mean', + 'lab_code', + 'submitter', 'owner', + 'authorized_users', + 'authors', 'title', + 'abstract', 'journal', + 'volume', 'pages', + 'month', 'year', + 'sequence', 'units', 'comments'] + + # Fields displayed in the search results table header + self.header_fields = ['Index', + 'Record', + 'Description', + 'Authors', + 'Year', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + self.type = 'Publish' + + self.query_for_group = ''' + SELECT + InbredSet.Name, InbredSet.Id, InbredSet.GeneticType + FROM + InbredSet, PublishFreeze + WHERE + PublishFreeze.InbredSetId = InbredSet.Id AND + PublishFreeze.Name = "%s" + ''' % escape(self.name) + + def check_confidentiality(self): + # (Urgently?) Need to write this + pass + + def get_trait_info(self, trait_list, species=''): + for this_trait in trait_list: + + if not this_trait.haveinfo: + this_trait.retrieve_info(get_qtl_info=True) + + description = this_trait.post_publication_description + + # If the dataset is confidential and the user has access to confidential + # phenotype traits, then display the pre-publication description instead + # of the post-publication description + if this_trait.confidential: + this_trait.description_display = "" + continue # todo for now, because no authorization features + + if not webqtlUtil.has_access_to_confidentail_phenotype_trait( + privilege=self.privilege, + userName=self.userName, + authorized_users=this_trait.authorized_users): + + description = this_trait.pre_publication_description + + if len(description) > 0: + this_trait.description_display = description.strip() + else: + this_trait.description_display = "" + + if not this_trait.year.isdigit(): + this_trait.pubmed_text = "N/A" + else: + this_trait.pubmed_text = this_trait.year + + if this_trait.pubmed_id: + this_trait.pubmed_link = webqtlConfig.PUBMEDLINK_URL % this_trait.pubmed_id + + # LRS and its location + this_trait.LRS_score_repr = "N/A" + this_trait.LRS_location_repr = "N/A" + + if this_trait.lrs: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '%s' and + Geno.Name = '%s' and + Geno.SpeciesId = Species.Id + """ % (species, this_trait.locus) + + result = g.db.execute(query).fetchone() + + if result: + if result[0] and result[1]: + LRS_Chr = result[0] + LRS_Mb = result[1] + + this_trait.LRS_score_repr = LRS_score_repr = '%3.1f' % this_trait.lrs + this_trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % ( + LRS_Chr, float(LRS_Mb)) + + def retrieve_sample_data(self, trait): + query = """ + SELECT + Strain.Name, PublishData.value, PublishSE.error, NStrain.count, Strain.Name2 + FROM + (PublishData, Strain, PublishXRef, PublishFreeze) + left join PublishSE on + (PublishSE.DataId = PublishData.Id AND PublishSE.StrainId = PublishData.StrainId) + left join NStrain on + (NStrain.DataId = PublishData.Id AND + NStrain.StrainId = PublishData.StrainId) + WHERE + PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND + PublishData.Id = PublishXRef.DataId AND PublishXRef.Id = %s AND + PublishFreeze.Id = %s AND PublishData.StrainId = Strain.Id + Order BY + Strain.Name + """ + + results = g.db.execute(query, (trait, self.id)).fetchall() + return results + + +class GenotypeDataSet(DataSet): + DS_NAME_MAP['Geno'] = 'GenotypeDataSet' + + def setup(self): + # Fields in the database table + self.search_fields = ['Name', + 'Chr'] + + # Find out what display_fields is + self.display_fields = ['name', + 'chr', + 'mb', + 'source2', + 'sequence'] + + # Fields displayed in the search results table header + self.header_fields = ['Index', + 'ID', + 'Location'] + + # Todo: Obsolete or rename this field + self.type = 'Geno' + + self.query_for_group = ''' + SELECT + InbredSet.Name, InbredSet.Id, InbredSet.GeneticType + FROM + InbredSet, GenoFreeze + WHERE + GenoFreeze.InbredSetId = InbredSet.Id AND + GenoFreeze.Name = "%s" + ''' % escape(self.name) + + def check_confidentiality(self): + return geno_mrna_confidentiality(self) + + def get_trait_info(self, trait_list, species=None): + for this_trait in trait_list: + if not this_trait.haveinfo: + this_trait.retrieveInfo() + + if this_trait.chr and this_trait.mb: + this_trait.location_repr = 'Chr%s: %.6f' % ( + this_trait.chr, float(this_trait.mb)) + + def retrieve_sample_data(self, trait): + query = """ + SELECT + Strain.Name, GenoData.value, GenoSE.error, "N/A", Strain.Name2 + FROM + (GenoData, GenoFreeze, Strain, Geno, GenoXRef) + left join GenoSE on + (GenoSE.DataId = GenoData.Id AND GenoSE.StrainId = GenoData.StrainId) + WHERE + Geno.SpeciesId = %s AND Geno.Name = %s AND GenoXRef.GenoId = Geno.Id AND + GenoXRef.GenoFreezeId = GenoFreeze.Id AND + GenoFreeze.Name = %s AND + GenoXRef.DataId = GenoData.Id AND + GenoData.StrainId = Strain.Id + Order BY + Strain.Name + """ + results = g.db.execute(query, + (webqtlDatabaseFunction.retrieve_species_id(self.group.name), + trait, self.name)).fetchall() + return results + + +def geno_mrna_confidentiality(ob): + dataset_table = ob.type + "Freeze" + #logger.debug("dataset_table [%s]: %s" % (type(dataset_table), dataset_table)) + + query = '''SELECT Id, Name, FullName, confidentiality, + AuthorisedUsers FROM %s WHERE Name = "%s"''' % (dataset_table, ob.name) + # + result = g.db.execute(query) + + (_dataset_id, + _name, + _full_name, + confidential, + _authorized_users) = result.fetchall()[0] + + if confidential: + return True diff --git a/gn3/base/mrna_assay_tissue_data.py b/gn3/base/mrna_assay_tissue_data.py new file mode 100644 index 0000000..0f51ade --- /dev/null +++ b/gn3/base/mrna_assay_tissue_data.py @@ -0,0 +1,94 @@ + +# pylint: disable-all +import collections + +from flask import g + +from gn3.utility.db_tools import create_in_clause +from gn3.utility.db_tools import escape +from gn3.utility.bunch import Bunch + + +# from utility.logger import getLogger +# logger = getLogger(__name__ ) + +class MrnaAssayTissueData(object): + + def __init__(self, gene_symbols=None): + self.gene_symbols = gene_symbols + if self.gene_symbols == None: + self.gene_symbols = [] + + self.data = collections.defaultdict(Bunch) + + query = '''select t.Symbol, t.GeneId, t.DataId, t.Chr, t.Mb, t.description, t.Probe_Target_Description + from ( + select Symbol, max(Mean) as maxmean + from TissueProbeSetXRef + where TissueProbeSetFreezeId=1 and ''' + + # Note that inner join is necessary in this query to get distinct record in one symbol group + # with highest mean value + # Due to the limit size of TissueProbeSetFreezeId table in DB, + # performance of inner join is acceptable.MrnaAssayTissueData(gene_symbols=symbol_list) + if len(gene_symbols) == 0: + query += '''Symbol!='' and Symbol Is Not Null group by Symbol) + as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol + and t.Mean = x.maxmean; + ''' + else: + in_clause = create_in_clause(gene_symbols) + + # ZS: This was in the query, not sure why: http://docs.python.org/2/library/string.html?highlight=lower#string.lower + query += ''' Symbol in {} group by Symbol) + as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol + and t.Mean = x.maxmean; + '''.format(in_clause) + + results = g.db.execute(query).fetchall() + + lower_symbols = [] + for gene_symbol in gene_symbols: + if gene_symbol != None: + lower_symbols.append(gene_symbol.lower()) + + for result in results: + symbol = result[0] + if symbol.lower() in lower_symbols: + symbol = symbol.lower() + + self.data[symbol].gene_id = result.GeneId + self.data[symbol].data_id = result.DataId + self.data[symbol].chr = result.Chr + self.data[symbol].mb = result.Mb + self.data[symbol].description = result.description + self.data[symbol].probe_target_description = result.Probe_Target_Description + + ########################################################################### + # Input: cursor, symbolList (list), dataIdDict(Dict) + # output: symbolValuepairDict (dictionary):one dictionary of Symbol and Value Pair, + # key is symbol, value is one list of expression values of one probeSet; + # function: get one dictionary whose key is gene symbol and value is tissue expression data (list type). + # Attention! All keys are lower case! + ########################################################################### + + def get_symbol_values_pairs(self): + id_list = [self.data[symbol].data_id for symbol in self.data] + + symbol_values_dict = {} + + if len(id_list) > 0: + query = """SELECT TissueProbeSetXRef.Symbol, TissueProbeSetData.value + FROM TissueProbeSetXRef, TissueProbeSetData + WHERE TissueProbeSetData.Id IN {} and + TissueProbeSetXRef.DataId = TissueProbeSetData.Id""".format(create_in_clause(id_list)) + + results = g.db.execute(query).fetchall() + for result in results: + if result.Symbol.lower() not in symbol_values_dict: + symbol_values_dict[result.Symbol.lower()] = [result.value] + else: + symbol_values_dict[result.Symbol.lower()].append( + result.value) + + return symbol_values_dict diff --git a/gn3/base/species.py b/gn3/base/species.py new file mode 100644 index 0000000..9fb08fb --- /dev/null +++ b/gn3/base/species.py @@ -0,0 +1,64 @@ + +# pylint: disable-all +import collections +from flask import g +from dataclasses import dataclass + +class TheSpecies: + def __init__(self, dataset=None, species_name=None): + if species_name is not None: + self.name = species_name + + self.chromosomes = Chromosomes(species=self.name) + + else: + self.dataset = dataset + self.chromosomes = Chromosomes(dataset=self.dataset) + + +class Chromosomes: + def __init__(self, dataset=None, species=None): + self.chromosomes = collections.OrderedDict() + + if species is not None: + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, Species + where + Chr_Length.SpeciesId = Species.SpeciesId AND + Species.Name = '%s' + Order by OrderId + """ % species.capitalize() + + else: + self.dataset = dataset + + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, InbredSet + where + Chr_Length.SpeciesId = InbredSet.SpeciesId AND + InbredSet.Name = '%s' + Order by OrderId + """ % self.dataset.group.name + + # logger.sql(query) + + results = g.db.execute(query).fetchall() + + for item in results: + self.chromosomes[item.OrderId] = IndChromosome( + item.Name, item.Length) + + +# @dataclass +class IndChromosome: + def __init__(self,name,length): + self.name= name + self.length = length + + @property + def mb_length(self): + """Chromosome length in megabases""" + return self.length/ 1000000 + diff --git a/gn3/base/trait.py b/gn3/base/trait.py new file mode 100644 index 0000000..f4be61c --- /dev/null +++ b/gn3/base/trait.py @@ -0,0 +1,366 @@ + +# pylint: disable-all +from flask import g +from redis import Redis +from gn3.utility.db_tools import escape +from gn3.base.webqtlCaseData import webqtlCaseData + + +def check_resource_availability(dataset, name=None): + + # todo add code for this + # should probably work on this has to do with authentication + return {'data': ['no-access', 'view'], 'metadata': ['no-access', 'view'], 'admin': ['not-admin']} + + +def create_trait(**kw): + # work on check resource availability deals with authentication + assert bool(kw.get("dataset")) != bool( + kw.get('dataset_name')), "Needs dataset ob. or name" + + assert bool(kw.get("name")), "Need trait name" + + if kw.get('dataset_name'): + if kw.get('dataset_name') != "Temp": + dataset = create_dataset(kw.get('dataset_name')) + else: + dataset = kw.get('dataset') + + if dataset.type == 'Publish': + permissions = check_resource_availability( + dataset, kw.get('name')) + else: + permissions = check_resource_availability(dataset) + + if "view" in permissions['data']: + the_trait = GeneralTrait(**kw) + if the_trait.dataset.type != "Temp": + the_trait = retrieve_trait_info( + the_trait, + the_trait.dataset, + get_qtl_info=kw.get('get_qtl_info')) + + + return the_trait + + return None + + +class GeneralTrait: + def __init__(self, get_qtl_info=False, get_sample_info=True, **kw): + assert bool(kw.get('dataset')) != bool( + kw.get('dataset_name')), "Needs dataset ob. or name" + # Trait ID, ProbeSet ID, Published ID, etc. + self.name = kw.get('name') + if kw.get('dataset_name'): + if kw.get('dataset_name') == "Temp": + temp_group = self.name.split("_")[2] + self.dataset = create_dataset( + dataset_name="Temp", + dataset_type="Temp", + group_name=temp_group) + + else: + self.dataset = create_dataset(kw.get('dataset_name')) + + else: + self.dataset = kw.get("dataset") + + self.cellid = kw.get('cellid') + self.identification = kw.get('identification', 'un-named trait') + self.haveinfo = kw.get('haveinfo', False) + self.sequence = kw.get('sequence') + self.data = kw.get('data', {}) + self.view = True + + # Sets defaults + self.locus = None + self.lrs = None + self.pvalue = None + self.mean = None + self.additive = None + self.num_overlap = None + self.strand_probe = None + self.symbol = None + self.display_name = self.name + self.LRS_score_repr = "N/A" + self.LRS_location_repr = "N/A" + + if kw.get('fullname'): + name2 = value.split("::") + if len(name2) == 2: + self.dataset, self.name = name2 + + elif len(name2) == 3: + self.dataset, self.name, self.cellid = name2 + + # Todo: These two lines are necessary most of the time, but + # perhaps not all of the time So we could add a simple if + # statement to short-circuit this if necessary + if get_sample_info is not False: + self = retrieve_sample_data(self, self.dataset) + + +def retrieve_sample_data(trait, dataset, samplelist=None): + if samplelist is None: + samplelist = [] + + if dataset.type == "Temp": + results = Redis.get(trait.name).split() + + else: + results = dataset.retrieve_sample_data(trait.name) + + # Todo: is this necessary? If not remove + trait.data.clear() + + if results: + if dataset.type == "Temp": + all_samples_ordered = dataset.group.all_samples_ordered() + for i, item in enumerate(results): + try: + trait.data[all_samples_ordered[i]] = webqtlCaseData( + all_samples_ordered[i], float(item)) + + except Exception as e: + pass + + + else: + for item in results: + name, value, variance, num_cases, name2 = item + if not samplelist or (samplelist and name in samplelist): + trait.data[name] = webqtlCaseData(*item) + + return trait + +def retrieve_trait_info(trait, dataset, get_qtl_info=False): + assert dataset, "Dataset doesn't exist" + + the_url = None + # some code should be added added here + + try: + response = requests.get(the_url).content + trait_info = json.loads(response) + except: # ZS: I'm assuming the trait is viewable if the try fails for some reason; it should never reach this point unless the user has privileges, since that's dealt with in create_trait + if dataset.type == 'Publish': + query = """ + SELECT + PublishXRef.Id, InbredSet.InbredSetCode, Publication.PubMed_ID, + CAST(Phenotype.Pre_publication_description AS BINARY), + CAST(Phenotype.Post_publication_description AS BINARY), + CAST(Phenotype.Original_description AS BINARY), + CAST(Phenotype.Pre_publication_abbreviation AS BINARY), + CAST(Phenotype.Post_publication_abbreviation AS BINARY), PublishXRef.mean, + Phenotype.Lab_code, Phenotype.Submitter, Phenotype.Owner, Phenotype.Authorized_Users, + CAST(Publication.Authors AS BINARY), CAST(Publication.Title AS BINARY), CAST(Publication.Abstract AS BINARY), + CAST(Publication.Journal AS BINARY), Publication.Volume, Publication.Pages, + Publication.Month, Publication.Year, PublishXRef.Sequence, + Phenotype.Units, PublishXRef.comments + FROM + PublishXRef, Publication, Phenotype, PublishFreeze, InbredSet + WHERE + PublishXRef.Id = %s AND + Phenotype.Id = PublishXRef.PhenotypeId AND + Publication.Id = PublishXRef.PublicationId AND + PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND + PublishXRef.InbredSetId = InbredSet.Id AND + PublishFreeze.Id = %s + """ % (trait.name, dataset.id) + + trait_info = g.db.execute(query).fetchone() + + # XZ, 05/08/2009: Xiaodong add this block to use ProbeSet.Id to find the probeset instead of just using ProbeSet.Name + # XZ, 05/08/2009: to avoid the problem of same probeset name from different platforms. + elif dataset.type == 'ProbeSet': + display_fields_string = ', ProbeSet.'.join(dataset.display_fields) + display_fields_string = 'ProbeSet.' + display_fields_string + query = """ + SELECT %s + FROM ProbeSet, ProbeSetFreeze, ProbeSetXRef + WHERE + ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND + ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSetFreeze.Name = '%s' AND + ProbeSet.Name = '%s' + """ % (escape(display_fields_string), + escape(dataset.name), + escape(str(trait.name))) + + trait_info = g.db.execute(query).fetchone() + # XZ, 05/08/2009: We also should use Geno.Id to find marker instead of just using Geno.Name + # to avoid the problem of same marker name from different species. + elif dataset.type == 'Geno': + display_fields_string = ',Geno.'.join(dataset.display_fields) + display_fields_string = 'Geno.' + display_fields_string + query = """ + SELECT %s + FROM Geno, GenoFreeze, GenoXRef + WHERE + GenoXRef.GenoFreezeId = GenoFreeze.Id AND + GenoXRef.GenoId = Geno.Id AND + GenoFreeze.Name = '%s' AND + Geno.Name = '%s' + """ % (escape(display_fields_string), + escape(dataset.name), + escape(trait.name)) + + trait_info = g.db.execute(query).fetchone() + else: # Temp type + query = """SELECT %s FROM %s WHERE Name = %s""" + + trait_info = g.db.execute(query, + ','.join(dataset.display_fields), + dataset.type, trait.name).fetchone() + + if trait_info: + trait.haveinfo = True + for i, field in enumerate(dataset.display_fields): + holder = trait_info[i] + if isinstance(holder, bytes): + holder = holder.decode("utf-8", errors="ignore") + setattr(trait, field, holder) + + if dataset.type == 'Publish': + if trait.group_code: + trait.display_name = trait.group_code + "_" + str(trait.name) + + trait.confidential = 0 + if trait.pre_publication_description and not trait.pubmed_id: + trait.confidential = 1 + + description = trait.post_publication_description + + # If the dataset is confidential and the user has access to confidential + # phenotype traits, then display the pre-publication description instead + # of the post-publication description + trait.description_display = "" + if not trait.pubmed_id: + trait.abbreviation = trait.pre_publication_abbreviation + trait.description_display = trait.pre_publication_description + else: + trait.abbreviation = trait.post_publication_abbreviation + if description: + trait.description_display = description.strip() + + if not trait.year.isdigit(): + trait.pubmed_text = "N/A" + else: + trait.pubmed_text = trait.year + + # moved to config + + PUBMEDLINK_URL = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=%s&dopt=Abstract" + + if trait.pubmed_id: + trait.pubmed_link = PUBMEDLINK_URL % trait.pubmed_id + + if dataset.type == 'ProbeSet' and dataset.group: + description_string = trait.description + target_string = trait.probe_target_description + + if str(description_string or "") != "" and description_string != 'None': + description_display = description_string + else: + description_display = trait.symbol + + if (str(description_display or "") != "" and + description_display != 'N/A' and + str(target_string or "") != "" and target_string != 'None'): + description_display = description_display + '; ' + target_string.strip() + + # Save it for the jinja2 template + trait.description_display = description_display + + trait.location_repr = 'N/A' + if trait.chr and trait.mb: + trait.location_repr = 'Chr%s: %.6f' % ( + trait.chr, float(trait.mb)) + + elif dataset.type == "Geno": + trait.location_repr = 'N/A' + if trait.chr and trait.mb: + trait.location_repr = 'Chr%s: %.6f' % ( + trait.chr, float(trait.mb)) + + if get_qtl_info: + # LRS and its location + trait.LRS_score_repr = "N/A" + trait.LRS_location_repr = "N/A" + trait.locus = trait.locus_chr = trait.locus_mb = trait.lrs = trait.pvalue = trait.additive = "" + if dataset.type == 'ProbeSet' and not trait.cellid: + trait.mean = "" + query = """ + SELECT + ProbeSetXRef.Locus, ProbeSetXRef.LRS, ProbeSetXRef.pValue, ProbeSetXRef.mean, ProbeSetXRef.additive + FROM + ProbeSetXRef, ProbeSet + WHERE + ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSet.Name = "{}" AND + ProbeSetXRef.ProbeSetFreezeId ={} + """.format(trait.name, dataset.id) + + trait_qtl = g.db.execute(query).fetchone() + if trait_qtl: + trait.locus, trait.lrs, trait.pvalue, trait.mean, trait.additive = trait_qtl + if trait.locus: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '{}' and + Geno.Name = '{}' and + Geno.SpeciesId = Species.Id + """.format(dataset.group.species, trait.locus) + + result = g.db.execute(query).fetchone() + if result: + trait.locus_chr = result[0] + trait.locus_mb = result[1] + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + + if dataset.type == 'Publish': + query = """ + SELECT + PublishXRef.Locus, PublishXRef.LRS, PublishXRef.additive + FROM + PublishXRef, PublishFreeze + WHERE + PublishXRef.Id = %s AND + PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND + PublishFreeze.Id =%s + """ % (trait.name, dataset.id) + + trait_qtl = g.db.execute(query).fetchone() + if trait_qtl: + trait.locus, trait.lrs, trait.additive = trait_qtl + if trait.locus: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '{}' and + Geno.Name = '{}' and + Geno.SpeciesId = Species.Id + """.format(dataset.group.species, trait.locus) + + result = g.db.execute(query).fetchone() + if result: + trait.locus_chr = result[0] + trait.locus_mb = result[1] + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.lrs = trait.additive = "" + if (dataset.type == 'Publish' or dataset.type == "ProbeSet") and str(trait.locus_chr or "") != "" and str(trait.locus_mb or "") != "": + trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % ( + trait.locus_chr, float(trait.locus_mb)) + if str(trait.lrs or "") != "": + trait.LRS_score_repr = LRS_score_repr = '%3.1f' % trait.lrs + else: + raise KeyError(repr(trait.name) + + ' information is not found in the database.') + return trait diff --git a/gn3/base/webqtlCaseData.py b/gn3/base/webqtlCaseData.py new file mode 100644 index 0000000..8395af8 --- /dev/null +++ b/gn3/base/webqtlCaseData.py @@ -0,0 +1,84 @@ +# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) +# at rwilliams@uthsc.edu and xzhou15@uthsc.edu +# +# This module is used by GeneNetwork project (www.genenetwork.org) +# +# Created by GeneNetwork Core Team 2010/08/10 + + +# uncomment below + +# from utility.logger import getLogger +# logger = getLogger(__name__) + +# import utility.tools + +# utility.tools.show_settings() +# pylint: disable-all + +class webqtlCaseData: + """one case data in one trait""" + + def __init__(self, name, value=None, variance=None, num_cases=None, name2=None): + self.name = name + self.name2 = name2 # Other name (for traits like BXD65a) + self.value = value # Trait Value + self.variance = variance # Trait Variance + self.num_cases = num_cases # Number of individuals/cases + self.extra_attributes = None + self.this_id = None # Set a sane default (can't be just "id" cause that's a reserved word) + self.outlier = None # Not set to True/False until later + + def __repr__(self): + case_data_string = "<webqtlCaseData> " + if self.value is not None: + case_data_string += "value=%2.3f" % self.value + if self.variance is not None: + case_data_string += " variance=%2.3f" % self.variance + if self.num_cases: + case_data_string += " ndata=%s" % self.num_cases + if self.name: + case_data_string += " name=%s" % self.name + if self.name2: + case_data_string += " name2=%s" % self.name2 + return case_data_string + + @property + def class_outlier(self): + """Template helper""" + if self.outlier: + return "outlier" + return "" + + @property + def display_value(self): + if self.value is not None: + return "%2.3f" % self.value + return "x" + + @property + def display_variance(self): + if self.variance is not None: + return "%2.3f" % self.variance + return "x" + + @property + def display_num_cases(self): + if self.num_cases is not None: + return "%s" % self.num_cases + return "x"
\ No newline at end of file diff --git a/gn3/config.py b/gn3/config.py new file mode 100644 index 0000000..9c6ec34 --- /dev/null +++ b/gn3/config.py @@ -0,0 +1,16 @@ +class Config: + DEBUG = True + Testing = False + + +class DevConfig(Config): + Testing = True + SQLALCHEMY_DATABASE_URI = "mysql://kabui:1234@localhost/test" + SECRET_KEY = "password" + SQLALCHEMY_TRACK_MODIFICATIONS = False + + +def get_config(): + return { + "dev": DevConfig + } diff --git a/gn3/correlation/__init__.py b/gn3/correlation/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gn3/correlation/__init__.py diff --git a/gn3/correlation/correlation_computations.py b/gn3/correlation/correlation_computations.py new file mode 100644 index 0000000..6a3f2bb --- /dev/null +++ b/gn3/correlation/correlation_computations.py @@ -0,0 +1,32 @@ +"""module contains code for any computation in correlation""" + +import json +from .show_corr_results import CorrelationResults + +def compute_correlation(correlation_input_data, + correlation_results=CorrelationResults): + """function that does correlation .creates Correlation results instance + + correlation_input_data structure is a dict with + + { + "trait_id":"valid trait id", + "dataset":"", + "sample_vals":{}, + "primary_samples":"", + "corr_type":"", + corr_dataset:"", + "corr_return_results":"", + + + } + + """ + + corr_object = correlation_results( + start_vars=correlation_input_data) + + corr_results = corr_object.do_correlation(start_vars=correlation_input_data) + # possibility of file being so large cause of the not sure whether to return a file + + return corr_results diff --git a/gn3/correlation/correlation_functions.py b/gn3/correlation/correlation_functions.py new file mode 100644 index 0000000..be08c96 --- /dev/null +++ b/gn3/correlation/correlation_functions.py @@ -0,0 +1,96 @@ + +""" +# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) +# at rwilliams@uthsc.edu and xzhou15@uthsc.edu +# +# +# +# This module is used by GeneNetwork project (www.genenetwork.org) +# +# Created by GeneNetwork Core Team 2010/08/10 +# +# Last updated by NL 2011/03/23 + + +""" + +import rpy2.robjects +from gn3.base.mrna_assay_tissue_data import MrnaAssayTissueData + + +##################################################################################### +# Input: primaryValue(list): one list of expression values of one probeSet, +# targetValue(list): one list of expression values of one probeSet, +# method(string): indicate correlation method ('pearson' or 'spearman') +# Output: corr_result(list): first item is Correlation Value, second item is tissue number, +# third item is PValue +# Function: get correlation value,Tissue quantity ,p value result by using R; +# Note : This function is special case since both primaryValue and targetValue are from +# the same dataset. So the length of these two parameters is the same. They are pairs. +# Also, in the datatable TissueProbeSetData, all Tissue values are loaded based on +# the same tissue order +##################################################################################### + +def cal_zero_order_corr_for_tiss(primaryValue=[], targetValue=[], method='pearson'): + """refer above for info on the function""" + # pylint: disable = E, W, R, C + + #nb disabled pylint until tests are written for this function + + R_primary = rpy2.robjects.FloatVector(list(range(len(primaryValue)))) + N = len(primaryValue) + for i in range(len(primaryValue)): + R_primary[i] = primaryValue[i] + + R_target = rpy2.robjects.FloatVector(list(range(len(targetValue)))) + for i in range(len(targetValue)): + R_target[i] = targetValue[i] + + R_corr_test = rpy2.robjects.r['cor.test'] + if method == 'spearman': + R_result = R_corr_test(R_primary, R_target, method='spearman') + else: + R_result = R_corr_test(R_primary, R_target) + + corr_result = [] + corr_result.append(R_result[3][0]) + corr_result.append(N) + corr_result.append(R_result[2][0]) + + return corr_result + + +#################################################### +#################################################### +# input: cursor, symbolList (list), dataIdDict(Dict): key is symbol +# output: SymbolValuePairDict(dictionary):one dictionary of Symbol and Value Pair. +# key is symbol, value is one list of expression values of one probeSet. +# function: wrapper function for getSymbolValuePairDict function +# build gene symbol list if necessary, cut it into small lists if necessary, +# then call getSymbolValuePairDict function and merge the results. +################################################### +##################################################### + +def get_trait_symbol_and_tissue_values(symbol_list=None): + """function to get trait symbol and tissues values refer above""" + tissue_data = MrnaAssayTissueData(gene_symbols=symbol_list) + + if len(tissue_data.gene_symbols) >= 1: + return tissue_data.get_symbol_values_pairs() + + return None diff --git a/gn3/correlation/correlation_utility.py b/gn3/correlation/correlation_utility.py new file mode 100644 index 0000000..7583bd7 --- /dev/null +++ b/gn3/correlation/correlation_utility.py @@ -0,0 +1,22 @@ +"""module contains utility functions for correlation""" + + +class AttributeSetter: + """class for setting Attributes""" + + def __init__(self, trait_obj): + for key, value in trait_obj.items(): + setattr(self, key, value) + + def __str__(self): + return self.__class__.__name__ + + def get_dict(self): + """dummy function to get dict object""" + return self.__dict__ + + +def get_genofile_samplelist(dataset): + """mock function to get genofile samplelist""" + + return ["C57BL/6J"] diff --git a/gn3/correlation/show_corr_results.py b/gn3/correlation/show_corr_results.py new file mode 100644 index 0000000..55d8366 --- /dev/null +++ b/gn3/correlation/show_corr_results.py @@ -0,0 +1,735 @@ +"""module contains code for doing correlation""" + +import json +import collections +import numpy +import scipy.stats +import rpy2.robjects as ro +from flask import g +from gn3.base.data_set import create_dataset +from gn3.utility.db_tools import escape +from gn3.utility.helper_functions import get_species_dataset_trait +from gn3.utility.corr_result_helpers import normalize_values +from gn3.base.trait import create_trait +from gn3.utility import hmac +from . import correlation_functions + + +class CorrelationResults: + """class for computing correlation""" + # pylint: disable=too-many-instance-attributes + # pylint:disable=attribute-defined-outside-init + + def __init__(self, start_vars): + self.assertion_for_start_vars(start_vars) + + @staticmethod + def assertion_for_start_vars(start_vars): + # pylint: disable = E, W, R, C + + # should better ways to assert the variables + # example includes sample + assert("corr_type" in start_vars) + assert(isinstance(start_vars['corr_type'], str)) + # example includes pearson + assert('corr_sample_method' in start_vars) + assert('corr_dataset' in start_vars) + # means the limit + assert('corr_return_results' in start_vars) + + if "loc_chr" in start_vars: + assert('min_loc_mb' in start_vars) + assert('max_loc_mb' in start_vars) + + def get_formatted_corr_type(self): + """method to formatt corr_types""" + self.formatted_corr_type = "" + if self.corr_type == "lit": + self.formatted_corr_type += "Literature Correlation " + elif self.corr_type == "tissue": + self.formatted_corr_type += "Tissue Correlation " + elif self.corr_type == "sample": + self.formatted_corr_type += "Genetic Correlation " + + if self.corr_method == "pearson": + self.formatted_corr_type += "(Pearson's r)" + elif self.corr_method == "spearman": + self.formatted_corr_type += "(Spearman's rho)" + elif self.corr_method == "bicor": + self.formatted_corr_type += "(Biweight r)" + + def process_samples(self, start_vars, sample_names, excluded_samples=None): + """method to process samples""" + + + if not excluded_samples: + excluded_samples = () + + sample_val_dict = json.loads(start_vars["sample_vals"]) + print(sample_val_dict) + if sample_names is None: + raise NotImplementedError + + for sample in sample_names: + if sample not in excluded_samples: + value = sample_val_dict[sample] + + if not value.strip().lower() == "x": + self.sample_data[str(sample)] = float(value) + + def do_tissue_correlation_for_trait_list(self, tissue_dataset_id=1): + """Given a list of correlation results (self.correlation_results),\ + gets the tissue correlation value for each""" + # pylint: disable = E, W, R, C + + # Gets tissue expression values for the primary trait + primary_trait_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=[self.this_trait.symbol]) + + if self.this_trait.symbol.lower() in primary_trait_tissue_vals_dict: + primary_trait_tissue_values = primary_trait_tissue_vals_dict[self.this_trait.symbol.lower( + )] + gene_symbol_list = [ + trait.symbol for trait in self.correlation_results if trait.symbol] + + corr_result_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=gene_symbol_list) + + for trait in self.correlation_results: + if trait.symbol and trait.symbol.lower() in corr_result_tissue_vals_dict: + this_trait_tissue_values = corr_result_tissue_vals_dict[trait.symbol.lower( + )] + + result = correlation_functions.cal_zero_order_corr_for_tiss(primary_trait_tissue_values, + this_trait_tissue_values, + self.corr_method) + + trait.tissue_corr = result[0] + trait.tissue_pvalue = result[2] + + def do_lit_correlation_for_trait_list(self): + # pylint: disable = E, W, R, C + + input_trait_mouse_gene_id = self.convert_to_mouse_gene_id( + self.dataset.group.species.lower(), self.this_trait.geneid) + + for trait in self.correlation_results: + + if trait.geneid: + trait.mouse_gene_id = self.convert_to_mouse_gene_id( + self.dataset.group.species.lower(), trait.geneid) + else: + trait.mouse_gene_id = None + + if trait.mouse_gene_id and str(trait.mouse_gene_id).find(";") == -1: + result = g.db.execute( + """SELECT value + FROM LCorrRamin3 + WHERE GeneId1='%s' and + GeneId2='%s' + """ % (escape(str(trait.mouse_gene_id)), escape(str(input_trait_mouse_gene_id))) + ).fetchone() + if not result: + result = g.db.execute("""SELECT value + FROM LCorrRamin3 + WHERE GeneId2='%s' and + GeneId1='%s' + """ % (escape(str(trait.mouse_gene_id)), escape(str(input_trait_mouse_gene_id))) + ).fetchone() + + if result: + lit_corr = result.value + trait.lit_corr = lit_corr + else: + trait.lit_corr = 0 + else: + trait.lit_corr = 0 + + def do_lit_correlation_for_all_traits(self): + """method for lit_correlation for all traits""" + # pylint: disable = E, W, R, C + input_trait_mouse_gene_id = self.convert_to_mouse_gene_id( + self.dataset.group.species.lower(), self.this_trait.geneid) + + lit_corr_data = {} + for trait, gene_id in list(self.trait_geneid_dict.items()): + mouse_gene_id = self.convert_to_mouse_gene_id( + self.dataset.group.species.lower(), gene_id) + + if mouse_gene_id and str(mouse_gene_id).find(";") == -1: + #print("gene_symbols:", input_trait_mouse_gene_id + " / " + mouse_gene_id) + result = g.db.execute( + """SELECT value + FROM LCorrRamin3 + WHERE GeneId1='%s' and + GeneId2='%s' + """ % (escape(mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + if not result: + result = g.db.execute("""SELECT value + FROM LCorrRamin3 + WHERE GeneId2='%s' and + GeneId1='%s' + """ % (escape(mouse_gene_id), escape(input_trait_mouse_gene_id)) + ).fetchone() + if result: + #print("result:", result) + lit_corr = result.value + lit_corr_data[trait] = [gene_id, lit_corr] + else: + lit_corr_data[trait] = [gene_id, 0] + else: + lit_corr_data[trait] = [gene_id, 0] + + lit_corr_data = collections.OrderedDict(sorted(list(lit_corr_data.items()), + key=lambda t: -abs(t[1][1]))) + + return lit_corr_data + + def do_tissue_correlation_for_all_traits(self, tissue_dataset_id=1): + # Gets tissue expression values for the primary trait + # pylint: disable = E, W, R, C + primary_trait_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=[self.this_trait.symbol]) + + if self.this_trait.symbol.lower() in primary_trait_tissue_vals_dict: + primary_trait_tissue_values = primary_trait_tissue_vals_dict[self.this_trait.symbol.lower( + )] + + #print("trait_gene_symbols: ", pf(trait_gene_symbols.values())) + corr_result_tissue_vals_dict = correlation_functions.get_trait_symbol_and_tissue_values( + symbol_list=list(self.trait_symbol_dict.values())) + + #print("corr_result_tissue_vals: ", pf(corr_result_tissue_vals_dict)) + + #print("trait_gene_symbols: ", pf(trait_gene_symbols)) + + tissue_corr_data = {} + for trait, symbol in list(self.trait_symbol_dict.items()): + if symbol and symbol.lower() in corr_result_tissue_vals_dict: + this_trait_tissue_values = corr_result_tissue_vals_dict[symbol.lower( + )] + + result = correlation_functions.cal_zero_order_corr_for_tiss(primary_trait_tissue_values, + this_trait_tissue_values, + self.corr_method) + + tissue_corr_data[trait] = [symbol, result[0], result[2]] + + tissue_corr_data = collections.OrderedDict(sorted(list(tissue_corr_data.items()), + key=lambda t: -abs(t[1][1]))) + + def get_sample_r_and_p_values(self, trait, target_samples): + """Calculates the sample r (or rho) and p-value + + Given a primary trait and a target trait's sample values, + calculates either the pearson r or spearman rho and the p-value + using the corresponding scipy functions. + + """ + # pylint: disable = E, W, R, C + self.this_trait_vals = [] + target_vals = [] + + for index, sample in enumerate(self.target_dataset.samplelist): + if sample in self.sample_data: + sample_value = self.sample_data[sample] + target_sample_value = target_samples[index] + self.this_trait_vals.append(sample_value) + target_vals.append(target_sample_value) + + self.this_trait_vals, target_vals, num_overlap = normalize_values( + self.this_trait_vals, target_vals) + + if num_overlap > 5: + # ZS: 2015 could add biweight correlation, see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3465711/ + if self.corr_method == 'bicor': + sample_r, sample_p = do_bicor( + self.this_trait_vals, target_vals) + + elif self.corr_method == 'pearson': + sample_r, sample_p = scipy.stats.pearsonr( + self.this_trait_vals, target_vals) + + else: + sample_r, sample_p = scipy.stats.spearmanr( + self.this_trait_vals, target_vals) + + if numpy.isnan(sample_r): + pass + + else: + + self.correlation_data[trait] = [ + sample_r, sample_p, num_overlap] + + def convert_to_mouse_gene_id(self, species=None, gene_id=None): + """If the species is rat or human, translate the gene_id to the mouse geneid + + If there is no input gene_id or there's no corresponding mouse gene_id, return None + + """ + if not gene_id: + return None + + mouse_gene_id = None + if "species" == "mouse": + mouse_gene_id = gene_id + + elif species == 'rat': + query = """SELECT mouse + FROM GeneIDXRef + WHERE rat='%s'""" % escape(gene_id) + + result = g.db.execute(query).fetchone() + if result != None: + mouse_gene_id = result.mouse + + elif species == "human": + + query = """SELECT mouse + FROM GeneIDXRef + WHERE human='%s'""" % escape(gene_id) + + result = g.db.execute(query).fetchone() + if result != None: + mouse_gene_id = result.mouse + + return mouse_gene_id + + def do_correlation(self, start_vars, create_dataset=create_dataset, + create_trait=create_trait, + get_species_dataset_trait=get_species_dataset_trait): + # pylint: disable = E, W, R, C + # probably refactor start_vars being passed twice + # this method aims to replace the do_correlation but also add dependendency injection + # to enable testing + + # should maybe refactor below code more or less works the same + if start_vars["dataset"] == "Temp": + self.dataset = create_dataset( + dataset_name="Temp", dataset_type="Temp", group_name=start_vars['group']) + + self.trait_id = start_vars["trait_id"] + + self.this_trait = create_trait(dataset=self.dataset, + name=self.trait_id, + cellid=None) + + else: + + get_species_dataset_trait(self, start_vars) + + corr_samples_group = start_vars['corr_samples_group'] + self.sample_data = {} + self.corr_type = start_vars['corr_type'] + self.corr_method = start_vars['corr_sample_method'] + self.min_expr = float( + start_vars["min_expr"]) if start_vars["min_expr"] != "" else None + self.p_range_lower = float( + start_vars["p_range_lower"]) if start_vars["p_range_lower"] != "" else -1.0 + self.p_range_upper = float( + start_vars["p_range_upper"]) if start_vars["p_range_upper"] != "" else 1.0 + + if ("loc_chr" in start_vars and "min_loc_mb" in start_vars and "max_loc_mb" in start_vars): + self.location_type = str(start_vars['location_type']) + self.location_chr = str(start_vars['loc_chr']) + + try: + + # the code is below is basically a temporary fix + self.min_location_mb = int(start_vars['min_loc_mb']) + self.max_location_mb = int(start_vars['max_loc_mb']) + except Exception as e: + self.min_location_mb = None + self.max_location_mb = None + + else: + self.location_type = self.location_chr = self.min_location_mb = self.max_location_mb = None + + self.get_formatted_corr_type() + + self.return_number = int(start_vars['corr_return_results']) + + primary_samples = self.dataset.group.samplelist + + + # The two if statements below append samples to the sample list based upon whether the user + # rselected Primary Samples Only, Other Samples Only, or All Samples + + if self.dataset.group.parlist != None: + primary_samples += self.dataset.group.parlist + + if self.dataset.group.f1list != None: + + primary_samples += self.dataset.group.f1list + + # If either BXD/whatever Only or All Samples, append all of that group's samplelist + + if corr_samples_group != 'samples_other': + + # print("primary samples are *****",primary_samples) + + self.process_samples(start_vars, primary_samples) + + if corr_samples_group != 'samples_primary': + if corr_samples_group == 'samples_other': + primary_samples = [x for x in primary_samples if x not in ( + self.dataset.group.parlist + self.dataset.group.f1list)] + + self.process_samples(start_vars, list(self.this_trait.data.keys()), primary_samples) + + self.target_dataset = create_dataset(start_vars['corr_dataset']) + # when you add code to retrieve the trait_data for target dataset got gets very slow + import time + + init_time = time.time() + self.target_dataset.get_trait_data(list(self.sample_data.keys())) + + aft_time = time.time() - init_time + + self.header_fields = get_header_fields( + self.target_dataset.type, self.corr_method) + + if self.target_dataset.type == "ProbeSet": + self.filter_cols = [7, 6] + + elif self.target_dataset.type == "Publish": + self.filter_cols = [6, 0] + + else: + self.filter_cols = [4, 0] + + self.correlation_results = [] + + self.correlation_data = {} + + if self.corr_type == "tissue": + self.trait_symbol_dict = self.dataset.retrieve_genes("Symbol") + + tissue_corr_data = self.do_tissue_correlation_for_all_traits() + if tissue_corr_data != None: + for trait in list(tissue_corr_data.keys())[:self.return_number]: + self.get_sample_r_and_p_values( + trait, self.target_dataset.trait_data[trait]) + else: + for trait, values in list(self.target_dataset.trait_data.items()): + self.get_sample_r_and_p_values(trait, values) + + elif self.corr_type == "lit": + self.trait_geneid_dict = self.dataset.retrieve_genes("GeneId") + lit_corr_data = self.do_lit_correlation_for_all_traits() + + for trait in list(lit_corr_data.keys())[:self.return_number]: + self.get_sample_r_and_p_values( + trait, self.target_dataset.trait_data[trait]) + + elif self.corr_type == "sample": + for trait, values in list(self.target_dataset.trait_data.items()): + self.get_sample_r_and_p_values(trait, values) + + self.correlation_data = collections.OrderedDict(sorted(list(self.correlation_data.items()), + key=lambda t: -abs(t[1][0]))) + + # ZS: Convert min/max chromosome to an int for the location range option + + """ + took 20.79 seconds took compute all the above majority of time taken on retrieving target dataset trait + info + """ + + initial_time_chr = time.time() + + range_chr_as_int = None + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if 'loc_chr' in start_vars: + if chr_info.name == self.location_chr: + range_chr_as_int = order_id + + for _trait_counter, trait in enumerate(list(self.correlation_data.keys())[:self.return_number]): + trait_object = create_trait( + dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False) + if not trait_object: + continue + + chr_as_int = 0 + for order_id, chr_info in list(self.dataset.species.chromosomes.chromosomes.items()): + if self.location_type == "highest_lod": + if chr_info.name == trait_object.locus_chr: + chr_as_int = order_id + else: + if chr_info.name == trait_object.chr: + chr_as_int = order_id + + if (float(self.correlation_data[trait][0]) >= self.p_range_lower and + float(self.correlation_data[trait][0]) <= self.p_range_upper): + + if (self.target_dataset.type == "ProbeSet" or self.target_dataset.type == "Publish") and bool(trait_object.mean): + if (self.min_expr != None) and (float(trait_object.mean) < self.min_expr): + continue + + if range_chr_as_int != None and (chr_as_int != range_chr_as_int): + continue + if self.location_type == "highest_lod": + if (self.min_location_mb != None) and (float(trait_object.locus_mb) < float(self.min_location_mb)): + continue + if (self.max_location_mb != None) and (float(trait_object.locus_mb) > float(self.max_location_mb)): + continue + else: + if (self.min_location_mb != None) and (float(trait_object.mb) < float(self.min_location_mb)): + continue + if (self.max_location_mb != None) and (float(trait_object.mb) > float(self.max_location_mb)): + continue + + (trait_object.sample_r, + trait_object.sample_p, + trait_object.num_overlap) = self.correlation_data[trait] + + # Set some sane defaults + trait_object.tissue_corr = 0 + trait_object.tissue_pvalue = 0 + trait_object.lit_corr = 0 + if self.corr_type == "tissue" and tissue_corr_data != None: + trait_object.tissue_corr = tissue_corr_data[trait][1] + trait_object.tissue_pvalue = tissue_corr_data[trait][2] + elif self.corr_type == "lit": + trait_object.lit_corr = lit_corr_data[trait][1] + + self.correlation_results.append(trait_object) + + """ + above takes time with respect to size of traits i.e n=100,500,.....t_size + """ + + if self.corr_type != "lit" and self.dataset.type == "ProbeSet" and self.target_dataset.type == "ProbeSet": + # self.do_lit_correlation_for_trait_list() + self.do_lit_correlation_for_trait_list() + + if self.corr_type != "tissue" and self.dataset.type == "ProbeSet" and self.target_dataset.type == "ProbeSet": + self.do_tissue_correlation_for_trait_list() + # self.do_lit_correlation_for_trait_list() + + self.json_results = generate_corr_json( + self.correlation_results, self.this_trait, self.dataset, self.target_dataset) + + # org mode by bons + + # DVORAKS + # klavaro for touch typing + # archwiki for documentation + # exwm for window manager ->13 + + # will fit perfectly with genenetwork 2 with change of anything if return self + + # alternative for this + return self.json_results + # return { + # # "Results": "succeess", + # # "return_number": self.return_number, + # # "primary_samples": primary_samples, + # # "time_taken": 12, + # # "correlation_data": self.correlation_data, + # "correlation_json": self.json_results + # } + + +def do_bicor(this_trait_vals, target_trait_vals): + # pylint: disable = E, W, R, C + r_library = ro.r["library"] # Map the library function + r_options = ro.r["options"] # Map the options function + + r_library("WGCNA") + r_bicor = ro.r["bicorAndPvalue"] # Map the bicorAndPvalue function + + r_options(stringsAsFactors=False) + + this_vals = ro.Vector(this_trait_vals) + target_vals = ro.Vector(target_trait_vals) + + the_r, the_p, _fisher_transform, _the_t, _n_obs = [ + numpy.asarray(x) for x in r_bicor(x=this_vals, y=target_vals)] + + return the_r, the_p + + +def get_header_fields(data_type, corr_method): + """function to get header fields when doing correlation""" + if data_type == "ProbeSet": + if corr_method == "spearman": + + header_fields = ['Index', + 'Record', + 'Symbol', + 'Description', + 'Location', + 'Mean', + 'Sample rho', + 'N', + 'Sample p(rho)', + 'Lit rho', + 'Tissue rho', + 'Tissue p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + else: + header_fields = ['Index', + 'Record', + 'Abbreviation', + 'Description', + 'Mean', + 'Authors', + 'Year', + 'Sample r', + 'N', + 'Sample p(r)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + elif data_type == "Publish": + if corr_method == "spearman": + + header_fields = ['Index', + 'Record', + 'Abbreviation', + 'Description', + 'Mean', + 'Authors', + 'Year', + 'Sample rho', + 'N', + 'Sample p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + else: + header_fields = ['Index', + 'Record', + 'Abbreviation', + 'Description', + 'Mean', + 'Authors', + 'Year', + 'Sample r', + 'N', + 'Sample p(r)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'] + + else: + if corr_method == "spearman": + header_fields = ['Index', + 'ID', + 'Location', + 'Sample rho', + 'N', + 'Sample p(rho)'] + + else: + header_fields = ['Index', + 'ID', + 'Location', + 'Sample r', + 'N', + 'Sample p(r)'] + + return header_fields + + +def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_api=False): + """function to generate corr json data""" + #todo refactor this function + results_list = [] + for i, trait in enumerate(corr_results): + if trait.view == False: + continue + results_dict = {} + results_dict['index'] = i + 1 + results_dict['trait_id'] = trait.name + results_dict['dataset'] = trait.dataset.name + results_dict['hmac'] = hmac.data_hmac( + '{}:{}'.format(trait.name, trait.dataset.name)) + if target_dataset.type == "ProbeSet": + results_dict['symbol'] = trait.symbol + results_dict['description'] = "N/A" + results_dict['location'] = trait.location_repr + results_dict['mean'] = "N/A" + results_dict['additive'] = "N/A" + if bool(trait.description_display): + results_dict['description'] = trait.description_display + if bool(trait.mean): + results_dict['mean'] = f"{float(trait.mean):.3f}" + try: + results_dict['lod_score'] = f"{float(trait.LRS_score_repr) / 4.61:.1f}" + except: + results_dict['lod_score'] = "N/A" + results_dict['lrs_location'] = trait.LRS_location_repr + if bool(trait.additive): + results_dict['additive'] = f"{float(trait.additive):.3f}" + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" + results_dict['num_overlap'] = trait.num_overlap + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" + results_dict['lit_corr'] = "--" + results_dict['tissue_corr'] = "--" + results_dict['tissue_pvalue'] = "--" + if bool(trait.lit_corr): + results_dict['lit_corr'] = f"{float(trait.lit_corr):.3f}" + if bool(trait.tissue_corr): + results_dict['tissue_corr'] = f"{float(trait.tissue_corr):.3f}" + results_dict['tissue_pvalue'] = f"{float(trait.tissue_pvalue):.3e}" + elif target_dataset.type == "Publish": + results_dict['abbreviation_display'] = "N/A" + results_dict['description'] = "N/A" + results_dict['mean'] = "N/A" + results_dict['authors_display'] = "N/A" + results_dict['additive'] = "N/A" + if for_api: + results_dict['pubmed_id'] = "N/A" + results_dict['year'] = "N/A" + else: + results_dict['pubmed_link'] = "N/A" + results_dict['pubmed_text'] = "N/A" + + if bool(trait.abbreviation): + results_dict['abbreviation_display'] = trait.abbreviation + if bool(trait.description_display): + results_dict['description'] = trait.description_display + if bool(trait.mean): + results_dict['mean'] = f"{float(trait.mean):.3f}" + if bool(trait.authors): + authors_list = trait.authors.split(',') + if len(authors_list) > 6: + results_dict['authors_display'] = ", ".join( + authors_list[:6]) + ", et al." + else: + results_dict['authors_display'] = trait.authors + if bool(trait.pubmed_id): + if for_api: + results_dict['pubmed_id'] = trait.pubmed_id + results_dict['year'] = trait.pubmed_text + else: + results_dict['pubmed_link'] = trait.pubmed_link + results_dict['pubmed_text'] = trait.pubmed_text + try: + results_dict['lod_score'] = f"{float(trait.LRS_score_repr) / 4.61:.1f}" + except: + results_dict['lod_score'] = "N/A" + results_dict['lrs_location'] = trait.LRS_location_repr + if bool(trait.additive): + results_dict['additive'] = f"{float(trait.additive):.3f}" + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" + results_dict['num_overlap'] = trait.num_overlap + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" + else: + results_dict['location'] = trait.location_repr + results_dict['sample_r'] = f"{float(trait.sample_r):.3f}" + results_dict['num_overlap'] = trait.num_overlap + results_dict['sample_p'] = f"{float(trait.sample_p):.3e}" + + results_list.append(results_dict) + + return json.dumps(results_list) diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gn3/db/__init__.py diff --git a/gn3/db/calls.py b/gn3/db/calls.py new file mode 100644 index 0000000..547bccf --- /dev/null +++ b/gn3/db/calls.py @@ -0,0 +1,51 @@ +"""module contains calls method for db""" +import json +import urllib +from flask import g +from gn3.utility.logger import getLogger +logger = getLogger(__name__) +# should probably put this is env +USE_GN_SERVER = False +LOG_SQL = False + +GN_SERVER_URL = None + + +def fetch1(query, path=None, func=None): + """fetch1 method""" + if USE_GN_SERVER and path: + result = gn_server(path) + if func is not None: + res2 = func(result) + + else: + res2 = result + + if LOG_SQL: + pass + # should probably and logger + # logger.debug("Replaced SQL call", query) + + # logger.debug(path,res2) + return res2 + + return fetchone(query) + + +def gn_server(path): + """Return JSON record by calling GN_SERVER + + """ + res = urllib.request.urlopen(GN_SERVER_URL+path) + rest = res.read() + res2 = json.loads(rest) + return res2 + + +def fetchone(query): + """method to fetchone item from db""" + def helper(query): + res = g.db.execute(query) + return res.fetchone() + + return logger.sql(query, helper) diff --git a/gn3/db/webqtlDatabaseFunction.py b/gn3/db/webqtlDatabaseFunction.py new file mode 100644 index 0000000..9e9982b --- /dev/null +++ b/gn3/db/webqtlDatabaseFunction.py @@ -0,0 +1,52 @@ +""" +# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) +# at rwilliams@uthsc.edu and xzhou15@uthsc.edu +# +# +# +# This module is used by GeneNetwork project (www.genenetwork.org) +""" + +from gn3.db.calls import fetch1 + +from gn3.utility.logger import getLogger +logger = getLogger(__name__) + +########################################################################### +# output: cursor instance +# function: connect to database and return cursor instance +########################################################################### + + +def retrieve_species(group): + """Get the species of a group (e.g. returns string "mouse" on "BXD" + + """ + result = fetch1("select Species.Name from Species, InbredSet where InbredSet.Name = '%s' and InbredSet.SpeciesId = Species.Id" % ( + group), "/cross/"+group+".json", lambda r: (r["species"],))[0] + # logger.debug("retrieve_species result:", result) + return result + + +def retrieve_species_id(group): + """retrieve species id method""" + + result = fetch1("select SpeciesId from InbredSet where Name = '%s'" % ( + group), "/cross/"+group+".json", lambda r: (r["species_id"],))[0] + logger.debug("retrieve_species_id result:", result) + return result diff --git a/gn3/utility/__init__.py b/gn3/utility/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gn3/utility/__init__.py diff --git a/gn3/utility/bunch.py b/gn3/utility/bunch.py new file mode 100644 index 0000000..c1fd907 --- /dev/null +++ b/gn3/utility/bunch.py @@ -0,0 +1,16 @@ +"""module contains Bunch class a dictionary like with object notation """ + +from pprint import pformat as pf + + +class Bunch: + """Like a dictionary but using object notation""" + + def __init__(self, **kw): + self.__dict__ = kw + + def __repr__(self): + return pf(self.__dict__) + + def __str__(self): + return self.__class__.__name__ diff --git a/gn3/utility/chunks.py b/gn3/utility/chunks.py new file mode 100644 index 0000000..fa27a39 --- /dev/null +++ b/gn3/utility/chunks.py @@ -0,0 +1,32 @@ +"""module for chunks functions""" + +import math + + +def divide_into_chunks(the_list, number_chunks): + """Divides a list into approximately number_chunks smaller lists + + >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3) + [[1, 2, 7], [3, 22, 8], [5, 22, 333]] + >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4) + [[1, 2, 7], [3, 22, 8], [5, 22, 333]] + >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5) + [[1, 2], [7, 3], [22, 8], [5, 22], [333]] + >>> + + """ + length = len(the_list) + + if length == 0: + return [[]] + + if length <= number_chunks: + number_chunks = length + + chunksize = int(math.ceil(length / number_chunks)) + + chunks = [] + for counter in range(0, length, chunksize): + chunks.append(the_list[counter:counter+chunksize]) + + return chunks diff --git a/gn3/utility/corr_result_helpers.py b/gn3/utility/corr_result_helpers.py new file mode 100644 index 0000000..a68308e --- /dev/null +++ b/gn3/utility/corr_result_helpers.py @@ -0,0 +1,45 @@ +"""module contains helper function for corr results""" + +#pylint:disable=C0103 +#above disable snake_case for variable tod refactor +def normalize_values(a_values, b_values): + """ + Trim two lists of values to contain only the values they both share + + Given two lists of sample values, trim each list so that it contains + only the samples that contain a value in both lists. Also returns + the number of such samples. + + >>> normalize_values([2.3, None, None, 3.2, 4.1, 5], [3.4, 7.2, 1.3, None, 6.2, 4.1]) + ([2.3, 4.1, 5], [3.4, 6.2, 4.1], 3) + + """ + a_new = [] + b_new = [] + for a, b in zip(a_values, b_values): + if (a and b is not None): + a_new.append(a) + b_new.append(b) + return a_new, b_new, len(a_new) + + +def common_keys(a_samples, b_samples): + """ + >>> a = dict(BXD1 = 9.113, BXD2 = 9.825, BXD14 = 8.985, BXD15 = 9.300) + >>> b = dict(BXD1 = 9.723, BXD3 = 9.825, BXD14 = 9.124, BXD16 = 9.300) + >>> sorted(common_keys(a, b)) + ['BXD1', 'BXD14'] + """ + return set(a_samples.keys()).intersection(set(b_samples.keys())) + + +def normalize_values_with_samples(a_samples, b_samples): + """function to normalize values with samples""" + common_samples = common_keys(a_samples, b_samples) + a_new = {} + b_new = {} + for sample in common_samples: + a_new[sample] = a_samples[sample] + b_new[sample] = b_samples[sample] + + return a_new, b_new, len(a_new) diff --git a/gn3/utility/db_tools.py b/gn3/utility/db_tools.py new file mode 100644 index 0000000..446acda --- /dev/null +++ b/gn3/utility/db_tools.py @@ -0,0 +1,19 @@ +"""module for db_tools""" +from MySQLdb import escape_string as escape_ + + +def create_in_clause(items): + """Create an in clause for mysql""" + in_clause = ', '.join("'{}'".format(x) for x in mescape(*items)) + in_clause = '( {} )'.format(in_clause) + return in_clause + + +def mescape(*items): + """Multiple escape""" + return [escape_(str(item)).decode('utf8') for item in items] + + +def escape(string_): + """escape function""" + return escape_(string_).decode('utf8') diff --git a/gn3/utility/get_group_samplelists.py b/gn3/utility/get_group_samplelists.py new file mode 100644 index 0000000..8fb322a --- /dev/null +++ b/gn3/utility/get_group_samplelists.py @@ -0,0 +1,47 @@ + +"""module for group samplelist""" +import os + +#todo close the files after opening +def get_samplelist(file_type, geno_file): + """get samplelist function""" + if file_type == "geno": + return get_samplelist_from_geno(geno_file) + elif file_type == "plink": + return get_samplelist_from_plink(geno_file) + +def get_samplelist_from_geno(genofilename): + if os.path.isfile(genofilename + '.gz'): + genofilename += '.gz' + genofile = gzip.open(genofilename) + else: + genofile = open(genofilename) + + for line in genofile: + line = line.strip() + if not line: + continue + if line.startswith(("#", "@")): + continue + break + + headers = line.split("\t") + + if headers[3] == "Mb": + samplelist = headers[4:] + else: + samplelist = headers[3:] + return samplelist + + + +def get_samplelist_from_plink(genofilename): + """get samplelist from plink""" + genofile = open(genofilename) + + samplelist = [] + for line in genofile: + line = line.split(" ") + samplelist.append(line[1]) + + return samplelist diff --git a/gn3/utility/helper_functions.py b/gn3/utility/helper_functions.py new file mode 100644 index 0000000..f5a8b80 --- /dev/null +++ b/gn3/utility/helper_functions.py @@ -0,0 +1,24 @@ +"""module contains general helper functions """ +from gn3.base.data_set import create_dataset +from gn3.base.trait import create_trait +from gn3.base.species import TheSpecies + + +def get_species_dataset_trait(self, start_vars): + """function to get species dataset and trait""" + if "temp_trait" in list(start_vars.keys()): + if start_vars['temp_trait'] == "True": + self.dataset = create_dataset( + dataset_name="Temp", dataset_type="Temp", group_name=start_vars['group']) + + else: + self.dataset = create_dataset(start_vars['dataset']) + + else: + self.dataset = create_dataset(start_vars['dataset']) + self.species = TheSpecies(dataset=self.dataset) + + self.this_trait = create_trait(dataset=self.dataset, + name=start_vars['trait_id'], + cellid=None, + get_qtl_info=True) diff --git a/gn3/utility/hmac.py b/gn3/utility/hmac.py new file mode 100644 index 0000000..eb39e59 --- /dev/null +++ b/gn3/utility/hmac.py @@ -0,0 +1,50 @@ +"""module for hmac """ + +# pylint: disable-all +import hmac +import hashlib + +# xtodo work on this file + +# from main import app + + +def hmac_creation(stringy): + """Helper function to create the actual hmac""" + + # secret = app.config['SECRET_HMAC_CODE'] + # put in config + secret = "my secret" + hmaced = hmac.new(bytearray(secret, "latin-1"), + bytearray(stringy, "utf-8"), + hashlib.sha1) + hm = hmaced.hexdigest() + # ZS: Leaving the below comment here to ask Pjotr about + # "Conventional wisdom is that you don't lose much in terms of security if you throw away up to half of the output." + # http://www.w3.org/QA/2009/07/hmac_truncation_in_xml_signatu.html + hm = hm[:20] + return hm + + +def data_hmac(stringy): + """Takes arbitrary data string and appends :hmac so we know data hasn't been tampered with""" + return stringy + ":" + hmac_creation(stringy) + + +def url_for_hmac(endpoint, **values): + """Like url_for but adds an hmac at the end to insure the url hasn't been tampered with""" + + url = url_for(endpoint, **values) + + hm = hmac_creation(url) + if '?' in url: + combiner = "&" + else: + combiner = "?" + return url + combiner + "hm=" + hm + + + +# todo +# app.jinja_env.globals.update(url_for_hmac=url_for_hmac, +# data_hmac=data_hmac) diff --git a/gn3/utility/logger.py b/gn3/utility/logger.py new file mode 100644 index 0000000..4245a02 --- /dev/null +++ b/gn3/utility/logger.py @@ -0,0 +1,163 @@ +""" +# GeneNetwork logger +# +# The standard python logging module is very good. This logger adds a +# few facilities on top of that. Main one being that it picks up +# settings for log levels (global and by module) and (potentially) +# offers some fine grained log levels for the standard levels. +# +# All behaviour is defined here. Global settings (defined in +# default_settings.py). +# +# To use logging and settings put this at the top of a module: +# +# import utility.logger +# logger = utility.logger.getLogger(__name__ ) +# +# To override global behaviour set the LOG_LEVEL in default_settings.py +# or use an environment variable, e.g. +# +# env LOG_LEVEL=INFO ./bin/genenetwork2 +# +# To override log level for a module replace that with, for example, +# +# import logging +# import utility.logger +# logger = utility.logger.getLogger(__name__,level=logging.DEBUG) +# +# We'll add more overrides soon. +""" +# todo incomplete file + +# pylint: disable-all +import logging +import datetime +from inspect import isfunction +from inspect import stack + +from pprint import pformat as pf + + +# from utility.tools import LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_SQL + +LOG_SQL = True + + +class GNLogger: + """A logger class with some additional functionality, such as + multiple parameter logging, SQL logging, timing, colors, and lazy + functions. + + """ + + def __init__(self, name): + self.logger = logging.getLogger(name) + + def setLevel(self, value): + """Set the undelying log level""" + self.logger.setLevel(value) + + def debug(self, *args): + """Call logging.debug for multiple args. Use (lazy) debugf and +level=num to filter on LOG_LEVEL_DEBUG. + + """ + self.collect(self.logger.debug, *args) + + def debug20(self, *args): + """Call logging.debug for multiple args. Use level=num to filter on +LOG_LEVEL_DEBUG (NYI). + + """ + if level <= LOG_LEVEL_DEBUG: + if self.logger.getEffectiveLevel() < 20: + self.collect(self.logger.debug, *args) + + def info(self, *args): + """Call logging.info for multiple args""" + self.collect(self.logger.info, *args) + + def warning(self, *args): + """Call logging.warning for multiple args""" + self.collect(self.logger.warning, *args) + # self.logger.warning(self.collect(*args)) + + def error(self, *args): + """Call logging.error for multiple args""" + now = datetime.datetime.utcnow() + time_str = now.strftime('%H:%M:%S UTC %Y%m%d') + l = [time_str]+list(args) + self.collect(self.logger.error, *l) + + def infof(self, *args): + """Call logging.info for multiple args lazily""" + # only evaluate function when logging + if self.logger.getEffectiveLevel() < 30: + self.collectf(self.logger.debug, *args) + + def debugf(self, level=0, *args): + """Call logging.debug for multiple args lazily and handle + LOG_LEVEL_DEBUG correctly + + """ + # only evaluate function when logging + if level <= LOG_LEVEL_DEBUG: + if self.logger.getEffectiveLevel() < 20: + self.collectf(self.logger.debug, *args) + + def sql(self, sqlcommand, fun=None): + """Log SQL command, optionally invoking a timed fun""" + if LOG_SQL: + caller = stack()[1][3] + if caller in ['fetchone', 'fetch1', 'fetchall']: + caller = stack()[2][3] + self.info(caller, sqlcommand) + if fun: + result = fun(sqlcommand) + if LOG_SQL: + self.info(result) + return result + + def collect(self, fun, *args): + """Collect arguments and use fun to output""" + out = "."+stack()[2][3] + for a in args: + if len(out) > 1: + out += ": " + if isinstance(a, str): + out = out + a + else: + out = out + pf(a, width=160) + fun(out) + + def collectf(self, fun, *args): + """Collect arguments and use fun to output one by one""" + out = "."+stack()[2][3] + for a in args: + if len(out) > 1: + out += ": " + if isfunction(a): + out += a() + else: + if isinstance(a, str): + out = out + a + else: + out = out + pf(a, width=160) + fun(out) + +# Get the module logger. You can override log levels at the +# module level + + +def getLogger(name, level=None): + """method to get logger""" + gnlogger = GNLogger(name) + _logger = gnlogger.logger + + # if level: + # logger.setLevel(level) + # else: + # logger.setLevel(LOG_LEVEL) + + # logger.info("Log level of "+name+" set to "+logging.getLevelName(logger.getEffectiveLevel())) + return gnlogger diff --git a/gn3/utility/species.py b/gn3/utility/species.py new file mode 100644 index 0000000..0140d41 --- /dev/null +++ b/gn3/utility/species.py @@ -0,0 +1,71 @@ +"""module contains species and chromosomes classes""" +import collections + +from flask import g + + +from gn3.utility.logger import getLogger +logger = getLogger(__name__) + + # pylint: disable=too-few-public-methods + # intentionally disabled check for few public methods + +class TheSpecies: + """class for Species""" + + def __init__(self, dataset=None, species_name=None): + if species_name is not None: + self.name = species_name + self.chromosomes = Chromosomes(species=self.name) + else: + self.dataset = dataset + self.chromosomes = Chromosomes(dataset=self.dataset) + + + +class IndChromosome: + """class for IndChromosome""" + + def __init__(self, name, length): + self.name = name + self.length = length + + @property + def mb_length(self): + """Chromosome length in megabases""" + return self.length / 1000000 + + + + +class Chromosomes: + """class for Chromosomes""" + + def __init__(self, dataset=None, species=None): + self.chromosomes = collections.OrderedDict() + if species is not None: + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, Species + where + Chr_Length.SpeciesId = Species.SpeciesId AND + Species.Name = '%s' + Order by OrderId + """ % species.capitalize() + else: + self.dataset = dataset + + query = """ + Select + Chr_Length.Name, Chr_Length.OrderId, Length from Chr_Length, InbredSet + where + Chr_Length.SpeciesId = InbredSet.SpeciesId AND + InbredSet.Name = '%s' + Order by OrderId + """ % self.dataset.group.name + logger.sql(query) + results = g.db.execute(query).fetchall() + + for item in results: + self.chromosomes[item.OrderId] = IndChromosome( + item.Name, item.Length) diff --git a/gn3/utility/tools.py b/gn3/utility/tools.py new file mode 100644 index 0000000..85df9f6 --- /dev/null +++ b/gn3/utility/tools.py @@ -0,0 +1,37 @@ +"""module contains general tools forgenenetwork""" + +import os + +from default_settings import GENENETWORK_FILES + + +def valid_file(file_name): + """check if file is valid""" + if os.path.isfile(file_name): + return file_name + return None + + +def valid_path(dir_name): + """check if path is valid""" + if os.path.isdir(dir_name): + return dir_name + return None + + +def locate_ignore_error(name, subdir=None): + """ + Locate a static flat file in the GENENETWORK_FILES environment. + + This function does not throw an error when the file is not found + but returns None. + """ + base = GENENETWORK_FILES + if subdir: + base = base+"/"+subdir + if valid_path(base): + lookfor = base + "/" + name + if valid_file(lookfor): + return lookfor + + return None diff --git a/gn3/utility/webqtlUtil.py b/gn3/utility/webqtlUtil.py new file mode 100644 index 0000000..1c76410 --- /dev/null +++ b/gn3/utility/webqtlUtil.py @@ -0,0 +1,66 @@ +""" +# Copyright (C) University of Tennessee Health Science Center, Memphis, TN. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License +# as published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero General Public License for more details. +# +# This program is available from Source Forge: at GeneNetwork Project +# (sourceforge.net/projects/genenetwork/). +# +# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010) +# at rwilliams@uthsc.edu and xzhou15@uthsc.edu +# +# +# +# This module is used by GeneNetwork project (www.genenetwork.org) +# +# Created by GeneNetwork Core Team 2010/08/10 +# +# Last updated by GeneNetwork Core Team 2010/10/20 + +# from base import webqtlConfig + +# NL, 07/27/2010. moved from webqtlForm.py +# Dict of Parents and F1 information, In the order of [F1, Mat, Pat] + +""" +ParInfo = { + 'BXH': ['BHF1', 'HBF1', 'C57BL/6J', 'C3H/HeJ'], + 'AKXD': ['AKF1', 'KAF1', 'AKR/J', 'DBA/2J'], + 'BXD': ['B6D2F1', 'D2B6F1', 'C57BL/6J', 'DBA/2J'], + 'C57BL-6JxC57BL-6NJF2': ['', '', 'C57BL/6J', 'C57BL/6NJ'], + 'BXD300': ['B6D2F1', 'D2B6F1', 'C57BL/6J', 'DBA/2J'], + 'B6BTBRF2': ['B6BTBRF1', 'BTBRB6F1', 'C57BL/6J', 'BTBRT<+>tf/J'], + 'BHHBF2': ['B6HF2', 'HB6F2', 'C57BL/6J', 'C3H/HeJ'], + 'BHF2': ['B6HF2', 'HB6F2', 'C57BL/6J', 'C3H/HeJ'], + 'B6D2F2': ['B6D2F1', 'D2B6F1', 'C57BL/6J', 'DBA/2J'], + 'BDF2-1999': ['B6D2F2', 'D2B6F2', 'C57BL/6J', 'DBA/2J'], + 'BDF2-2005': ['B6D2F1', 'D2B6F1', 'C57BL/6J', 'DBA/2J'], + 'CTB6F2': ['CTB6F2', 'B6CTF2', 'C57BL/6J', 'Castaneous'], + 'CXB': ['CBF1', 'BCF1', 'C57BL/6ByJ', 'BALB/cByJ'], + 'AXBXA': ['ABF1', 'BAF1', 'C57BL/6J', 'A/J'], + 'AXB': ['ABF1', 'BAF1', 'C57BL/6J', 'A/J'], + 'BXA': ['BAF1', 'ABF1', 'C57BL/6J', 'A/J'], + 'LXS': ['LSF1', 'SLF1', 'ISS', 'ILS'], + 'HXBBXH': ['SHR_BNF1', 'BN_SHRF1', 'BN-Lx/Cub', 'SHR/OlaIpcv'], + 'BayXSha': ['BayXShaF1', 'ShaXBayF1', 'Bay-0', 'Shahdara'], + 'ColXBur': ['ColXBurF1', 'BurXColF1', 'Col-0', 'Bur-0'], + 'ColXCvi': ['ColXCviF1', 'CviXColF1', 'Col-0', 'Cvi'], + 'SXM': ['SMF1', 'MSF1', 'Steptoe', 'Morex'], + 'HRDP': ['SHR_BNF1', 'BN_SHRF1', 'BN-Lx/Cub', 'SHR/OlaIpcv'] +} + + +def has_access_to_confidentail_phenotype_trait(privilege, username, authorized_users): + """function to access to confidential phenotype Traits further implementation needed""" + access_to_confidential_phenotype_trait = 0 + + results = (privilege, username, authorized_users) + return access_to_confidential_phenotype_trait @@ -27,11 +27,13 @@ (gnu packages base) (gnu packages check) (gnu packages databases) + (gnu packages statistics) (gnu packages python) (gnu packages python-check) (gnu packages python-crypto) (gnu packages python-web) (gnu packages python-xyz) + (gnu packages python-science) ((guix build utils) #:select (with-directory-excursion)) (guix build-system python) (guix gexp) @@ -66,7 +68,6 @@ #:select? git-file?)) (propagated-inputs `(("coreutils" ,coreutils) ("gemma-wrapper" ,gemma-wrapper) - ("jupyter" ,jupyter) ("python-bcrypt" ,python-bcrypt) ("python" ,python-wrapper) ("python-flask" ,python-flask) @@ -75,7 +76,13 @@ ("python-mypy" ,python-mypy) ("python-mypy-extensions" ,python-mypy-extensions) ("python-redis" ,python-redis) - ("python-pylint" ,python-pylint))) + ("python-scipy" ,python-scipy) + ;; Remove one of these! + ("python-sqlalchemy" ,python-sqlalchemy) + ("python-mysqlclient" ,python-mysqlclient) + ;; This requires R in it's path + ;; TODO: Remove! + ("python-rpy2" ,python-rpy2))) (build-system python-build-system) (home-page "https://github.com/genenetwork/genenetwork3") (synopsis "GeneNetwork3 API for data science and machine learning.") diff --git a/requirements.txt b/requirements.txt index 7dc7a01..c76e429 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,11 @@ -astroid==2.4.2 bcrypt==3.1.7 -cffi==1.14.5 click==7.1.2 Flask==1.1.2 -isort==4.3.21 itsdangerous==1.1.0 Jinja2==2.11.3 -lazy-object-proxy==1.4.3 MarkupSafe==1.1.1 -mccabe==0.6.1 -mypy==0.790 -mypy-extensions==0.4.3 +mysqlclient==2.0.1 numpy==1.17.3 -pycparser==2.20 -pylint==2.5.3 -redis==3.5.3 -six==1.15.0 -toml==0.10.2 -typed-ast==1.4.2 -typing-extensions==3.7.4.3 +scipy==1.6.0 +SQLAlchemy==1.3.20 Werkzeug==1.0.1 -wrapt==1.12.1 diff --git a/tests/integration/correlation_data.json b/tests/integration/correlation_data.json new file mode 100644 index 0000000..87d24e3 --- /dev/null +++ b/tests/integration/correlation_data.json @@ -0,0 +1,18 @@ +{ + "primary_samples": "C57BL/6J,DBA/2J,B6D2F1,D2B6F1,BXD1,BXD2,BXD5,BXD6,BXD8,BXD9,BXD11,BXD12,BXD13,BXD14,BXD15,BXD16,BXD18,BXD19,BXD20,BXD21,BXD22,BXD23,BXD24,BXD24a,BXD25,BXD27,BXD28,BXD29,BXD30,BXD31,BXD32,BXD33,BXD34,BXD35,BXD36,BXD37,BXD38,BXD39,BXD40,BXD41,BXD42,BXD43,BXD44,BXD45,BXD48,BXD48a,BXD49,BXD50,BXD51,BXD52,BXD53,BXD54,BXD55,BXD56,BXD59,BXD60,BXD61,BXD62,BXD63,BXD64,BXD65,BXD65a,BXD65b,BXD66,BXD67,BXD68,BXD69,BXD70,BXD71,BXD72,BXD73,BXD73a,BXD73b,BXD74,BXD75,BXD76,BXD77,BXD78,BXD79,BXD81,BXD83,BXD84,BXD85,BXD86,BXD87,BXD88,BXD89,BXD90,BXD91,BXD93,BXD94,BXD95,BXD98,BXD99,BXD100,BXD101,BXD102,BXD104,BXD105,BXD106,BXD107,BXD108,BXD109,BXD110,BXD111,BXD112,BXD113,BXD114,BXD115,BXD116,BXD117,BXD119,BXD120,BXD121,BXD122,BXD123,BXD124,BXD125,BXD126,BXD127,BXD128,BXD128a,BXD130,BXD131,BXD132,BXD133,BXD134,BXD135,BXD136,BXD137,BXD138,BXD139,BXD141,BXD142,BXD144,BXD145,BXD146,BXD147,BXD148,BXD149,BXD150,BXD151,BXD152,BXD153,BXD154,BXD155,BXD156,BXD157,BXD160,BXD161,BXD162,BXD165,BXD168,BXD169,BXD170,BXD171,BXD172,BXD173,BXD174,BXD175,BXD176,BXD177,BXD178,BXD180,BXD181,BXD183,BXD184,BXD186,BXD187,BXD188,BXD189,BXD190,BXD191,BXD192,BXD193,BXD194,BXD195,BXD196,BXD197,BXD198,BXD199,BXD200,BXD201,BXD202,BXD203,BXD204,BXD205,BXD206,BXD207,BXD208,BXD209,BXD210,BXD211,BXD212,BXD213,BXD214,BXD215,BXD216,BXD217,BXD218,BXD219,BXD220", + "trait_id": "1444666_at", + "dataset": "HC_M2_0606_P", + "sample_vals": "{\"C57BL/6J\":\"6.638\",\"DBA/2J\":\"6.266\",\"B6D2F1\":\"6.494\",\"D2B6F1\":\"6.565\",\"BXD1\":\"6.357\",\"BXD2\":\"6.456\",\"BXD5\":\"6.590\",\"BXD6\":\"6.568\",\"BXD8\":\"6.581\",\"BXD9\":\"6.322\",\"BXD11\":\"6.519\",\"BXD12\":\"6.543\",\"BXD13\":\"6.636\",\"BXD14\":\"x\",\"BXD15\":\"6.578\",\"BXD16\":\"6.636\",\"BXD18\":\"x\",\"BXD19\":\"6.562\",\"BXD20\":\"6.610\",\"BXD21\":\"6.668\",\"BXD22\":\"6.607\",\"BXD23\":\"6.513\",\"BXD24\":\"6.601\",\"BXD24a\":\"x\",\"BXD25\":\"x\",\"BXD27\":\"6.573\",\"BXD28\":\"6.639\",\"BXD29\":\"6.656\",\"BXD30\":\"x\",\"BXD31\":\"6.549\",\"BXD32\":\"6.502\",\"BXD33\":\"6.584\",\"BXD34\":\"6.261\",\"BXD35\":\"x\",\"BXD36\":\"x\",\"BXD37\":\"x\",\"BXD38\":\"6.646\",\"BXD39\":\"6.584\",\"BXD40\":\"6.790\",\"BXD41\":\"x\",\"BXD42\":\"6.536\",\"BXD43\":\"6.476\",\"BXD44\":\"6.545\",\"BXD45\":\"6.742\",\"BXD48\":\"6.393\",\"BXD48a\":\"6.618\",\"BXD49\":\"x\",\"BXD50\":\"6.496\",\"BXD51\":\"6.494\",\"BXD52\":\"x\",\"BXD53\":\"x\",\"BXD54\":\"x\",\"BXD55\":\"6.263\",\"BXD56\":\"x\",\"BXD59\":\"x\",\"BXD60\":\"6.541\",\"BXD61\":\"6.662\",\"BXD62\":\"6.628\",\"BXD63\":\"6.556\",\"BXD64\":\"6.572\",\"BXD65\":\"6.530\",\"BXD65a\":\"6.280\",\"BXD65b\":\"6.490\",\"BXD66\":\"6.608\",\"BXD67\":\"6.534\",\"BXD68\":\"6.352\",\"BXD69\":\"6.548\",\"BXD70\":\"6.520\",\"BXD71\":\"x\",\"BXD72\":\"x\",\"BXD73\":\"6.484\",\"BXD73a\":\"6.486\",\"BXD73b\":\"x\",\"BXD74\":\"6.639\",\"BXD75\":\"6.401\",\"BXD76\":\"6.452\",\"BXD77\":\"6.568\",\"BXD78\":\"x\",\"BXD79\":\"6.642\",\"BXD81\":\"x\",\"BXD83\":\"6.446\",\"BXD84\":\"6.582\",\"BXD85\":\"6.484\",\"BXD86\":\"6.877\",\"BXD87\":\"6.474\",\"BXD88\":\"x\",\"BXD89\":\"6.676\",\"BXD90\":\"6.644\",\"BXD91\":\"x\",\"BXD93\":\"6.620\",\"BXD94\":\"6.528\",\"BXD95\":\"x\",\"BXD98\":\"6.486\",\"BXD99\":\"6.530\",\"BXD100\":\"x\",\"BXD101\":\"x\",\"BXD102\":\"x\",\"BXD104\":\"x\",\"BXD105\":\"x\",\"BXD106\":\"x\",\"BXD107\":\"x\",\"BXD108\":\"x\",\"BXD109\":\"x\",\"BXD110\":\"x\",\"BXD111\":\"x\",\"BXD112\":\"x\",\"BXD113\":\"x\",\"BXD114\":\"x\",\"BXD115\":\"x\",\"BXD116\":\"x\",\"BXD117\":\"x\",\"BXD119\":\"x\",\"BXD120\":\"x\",\"BXD121\":\"x\",\"BXD122\":\"x\",\"BXD123\":\"x\",\"BXD124\":\"x\",\"BXD125\":\"x\",\"BXD126\":\"x\",\"BXD127\":\"x\",\"BXD128\":\"x\",\"BXD128a\":\"x\",\"BXD130\":\"x\",\"BXD131\":\"x\",\"BXD132\":\"x\",\"BXD133\":\"x\",\"BXD134\":\"x\",\"BXD135\":\"x\",\"BXD136\":\"x\",\"BXD137\":\"x\",\"BXD138\":\"x\",\"BXD139\":\"x\",\"BXD141\":\"x\",\"BXD142\":\"x\",\"BXD144\":\"x\",\"BXD145\":\"x\",\"BXD146\":\"x\",\"BXD147\":\"x\",\"BXD148\":\"x\",\"BXD149\":\"x\",\"BXD150\":\"x\",\"BXD151\":\"x\",\"BXD152\":\"x\",\"BXD153\":\"x\",\"BXD154\":\"x\",\"BXD155\":\"x\",\"BXD156\":\"x\",\"BXD157\":\"x\",\"BXD160\":\"x\",\"BXD161\":\"x\",\"BXD162\":\"x\",\"BXD165\":\"x\",\"BXD168\":\"x\",\"BXD169\":\"x\",\"BXD170\":\"x\",\"BXD171\":\"x\",\"BXD172\":\"x\",\"BXD173\":\"x\",\"BXD174\":\"x\",\"BXD175\":\"x\",\"BXD176\":\"x\",\"BXD177\":\"x\",\"BXD178\":\"x\",\"BXD180\":\"x\",\"BXD181\":\"x\",\"BXD183\":\"x\",\"BXD184\":\"x\",\"BXD186\":\"x\",\"BXD187\":\"x\",\"BXD188\":\"x\",\"BXD189\":\"x\",\"BXD190\":\"x\",\"BXD191\":\"x\",\"BXD192\":\"x\",\"BXD193\":\"x\",\"BXD194\":\"x\",\"BXD195\":\"x\",\"BXD196\":\"x\",\"BXD197\":\"x\",\"BXD198\":\"x\",\"BXD199\":\"x\",\"BXD200\":\"x\",\"BXD201\":\"x\",\"BXD202\":\"x\",\"BXD203\":\"x\",\"BXD204\":\"x\",\"BXD205\":\"x\",\"BXD206\":\"x\",\"BXD207\":\"x\",\"BXD208\":\"x\",\"BXD209\":\"x\",\"BXD210\":\"x\",\"BXD211\":\"x\",\"BXD212\":\"x\",\"BXD213\":\"x\",\"BXD214\":\"x\",\"BXD215\":\"x\",\"BXD216\":\"x\",\"BXD217\":\"x\",\"BXD218\":\"x\",\"BXD219\":\"x\",\"BXD220\":\"x\"}", + "corr_type": "lit", + "corr_dataset": "HC_M2_0606_P", + "corr_return_results": "100", + "corr_samples_group": "samples_primary", + "corr_sample_method": "pearson", + "min_expr": "", + "location_type": "gene", + "loc_chr": "", + "min_loc_mb": "", + "max_loc_mb": "", + "p_range_lower": "-0.60", + "p_range_upper": "0.74" +}
\ No newline at end of file diff --git a/tests/integration/expected_corr_results.json b/tests/integration/expected_corr_results.json new file mode 100644 index 0000000..b5bbc2d --- /dev/null +++ b/tests/integration/expected_corr_results.json @@ -0,0 +1,1902 @@ +[ + { + "index": 1, + "trait_id": "1415758_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415758_at:HC_M2_0606_P:da50fa1141a7d608ab20", + "symbol": "Fryl", + "description": "furry homolog-like; far 3' UTR", + "location": "Chr5: 72.964984", + "mean": "9.193", + "additive": "-0.081", + "lod_score": "4.4", + "lrs_location": "Chr1: 196.404284", + "sample_r": "-0.407", + "num_overlap": 67, + "sample_p": "6.234e-04", + "lit_corr": "--", + "tissue_corr": "-0.221", + "tissue_pvalue": "2.780e-01" + }, + { + "index": 2, + "trait_id": "1415693_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415693_at:HC_M2_0606_P:0959e913366f559ea22b", + "symbol": "Derl1", + "description": "derlin 1; proximal to mid 3' UTR", + "location": "Chr15: 57.702171", + "mean": "9.445", + "additive": "0.056", + "lod_score": "2.1", + "lrs_location": "Chr1: 193.731996", + "sample_r": "0.398", + "num_overlap": 67, + "sample_p": "8.614e-04", + "lit_corr": "--", + "tissue_corr": "0.114", + "tissue_pvalue": "5.800e-01" + }, + { + "index": 3, + "trait_id": "1415753_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415753_at:HC_M2_0606_P:d75ca42e7fa1613364bb", + "symbol": "Fam108a", + "description": "abhydrolase domain-containing protein FAM108A; last two exons and proximal 3' UTR", + "location": "Chr10: 80.046470", + "mean": "12.731", + "additive": "0.050", + "lod_score": "1.5", + "lrs_location": "ChrX: 103.404884", + "sample_r": "0.384", + "num_overlap": 67, + "sample_p": "1.344e-03", + "lit_corr": "--", + "tissue_corr": "0.108", + "tissue_pvalue": "5.990e-01" + }, + { + "index": 4, + "trait_id": "1415740_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415740_at:HC_M2_0606_P:755cdc41d0d50a03b647", + "symbol": "Psmc5", + "description": "protease (prosome, macropain) 26S subunit, ATPase 5; exons 7, 8, 9", + "location": "Chr11: 106.123450", + "mean": "12.424", + "additive": "0.059", + "lod_score": "2.6", + "lrs_location": "Chr9: 34.013550", + "sample_r": "0.364", + "num_overlap": 67, + "sample_p": "2.476e-03", + "lit_corr": "--", + "tissue_corr": "0.333", + "tissue_pvalue": "9.696e-02" + }, + { + "index": 5, + "trait_id": "1415757_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415757_at:HC_M2_0606_P:8bbf06aa2e3aa5530934", + "symbol": "Gbf1", + "description": "Golgi-specific brefeldin A-resistance factor 1; last exon and proximal 3' UTR", + "location": "Chr19: 46.360410", + "mean": "9.800", + "additive": "-0.062", + "lod_score": "2.0", + "lrs_location": "Chr17: 52.750885", + "sample_r": "0.363", + "num_overlap": 67, + "sample_p": "2.539e-03", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.741e-01" + }, + { + "index": 6, + "trait_id": "1415768_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415768_a_at:HC_M2_0606_P:5e67109eee04f5da3393", + "symbol": "Ube2r2", + "description": "ubiquitin-conjugating enzyme E2R 2", + "location": "Chr4: 41.137929", + "mean": "9.811", + "additive": "-0.087", + "lod_score": "3.3", + "lrs_location": "Chr12: 114.553844", + "sample_r": "-0.312", + "num_overlap": 67, + "sample_p": "1.019e-02", + "lit_corr": "--", + "tissue_corr": "-0.007", + "tissue_pvalue": "9.711e-01" + }, + { + "index": 7, + "trait_id": "1415670_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415670_at:HC_M2_0606_P:4f82d7374f29ebfacaaf", + "symbol": "Copg", + "description": "coatomer protein complex, subunit gamma 1; two of the three last exons and proximal 3' UTR", + "location": "Chr6: 87.859681", + "mean": "11.199", + "additive": "-0.113", + "lod_score": "3.7", + "lrs_location": "Chr1: 157.588921", + "sample_r": "0.305", + "num_overlap": 67, + "sample_p": "1.200e-02", + "lit_corr": "--", + "tissue_corr": "-0.405", + "tissue_pvalue": "4.032e-02" + }, + { + "index": 8, + "trait_id": "1415742_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415742_at:HC_M2_0606_P:b72a582a1f840a18c3e7", + "symbol": "Aup1", + "description": "ancient ubiquitous protein 1", + "location": "Chr6: 83.006784", + "mean": "9.529", + "additive": "-0.062", + "lod_score": "2.4", + "lrs_location": "Chr19: 16.955950", + "sample_r": "0.295", + "num_overlap": 67, + "sample_p": "1.523e-02", + "lit_corr": "--", + "tissue_corr": "-0.033", + "tissue_pvalue": "8.716e-01" + }, + { + "index": 9, + "trait_id": "1415743_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415743_at:HC_M2_0606_P:3187245a079e824b4236", + "symbol": "Hdac5", + "description": "histone deacetylase 5; last four exons", + "location": "Chr11: 102.057397", + "mean": "11.009", + "additive": "0.081", + "lod_score": "2.1", + "lrs_location": "Chr7: 125.263073", + "sample_r": "0.285", + "num_overlap": 67, + "sample_p": "1.950e-02", + "lit_corr": "--", + "tissue_corr": "0.005", + "tissue_pvalue": "9.823e-01" + }, + { + "index": 10, + "trait_id": "1415690_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415690_at:HC_M2_0606_P:603b215ede00b6fe1104", + "symbol": "Mrp127", + "description": "39S ribosomal protein L27, mitochondrial; last three exons", + "location": "Chr11: 94.517922", + "mean": "12.569", + "additive": "0.063", + "lod_score": "1.9", + "lrs_location": "Chr2: 164.779024", + "sample_r": "0.266", + "num_overlap": 67, + "sample_p": "2.986e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 11, + "trait_id": "1415727_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415727_at:HC_M2_0606_P:cb40b8cba0eee75781a6", + "symbol": "Apoa1bp", + "description": "apolipoprotein A-I binding protein; exons 3 through 6", + "location": "Chr3: 87.860534", + "mean": "11.707", + "additive": "-0.076", + "lod_score": "2.8", + "lrs_location": "Chr3: 56.295375", + "sample_r": "0.263", + "num_overlap": 67, + "sample_p": "3.136e-02", + "lit_corr": "--", + "tissue_corr": "-0.535", + "tissue_pvalue": "4.841e-03" + }, + { + "index": 12, + "trait_id": "1415730_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415730_at:HC_M2_0606_P:a970e0610a56ac4aba27", + "symbol": "Cpsf7", + "description": "cleavage and polyadenylation specificity factor 7; distal 3' UTR (transQTL on Chr 4 in BXD eye data)", + "location": "Chr19: 10.621618", + "mean": "10.662", + "additive": "-0.048", + "lod_score": "2.1", + "lrs_location": "Chr1: 188.085707", + "sample_r": "-0.263", + "num_overlap": 67, + "sample_p": "3.164e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 13, + "trait_id": "1415741_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415741_at:HC_M2_0606_P:033752be361d32960c29", + "symbol": "Tmem165", + "description": "transmembrane protein 165; 3' UTR", + "location": "Chr5: 76.637708", + "mean": "10.974", + "additive": "0.048", + "lod_score": "2.0", + "lrs_location": "Chr4: 5.606394", + "sample_r": "-0.258", + "num_overlap": 67, + "sample_p": "3.489e-02", + "lit_corr": "--", + "tissue_corr": "0.271", + "tissue_pvalue": "1.812e-01" + }, + { + "index": 14, + "trait_id": "1415725_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415725_at:HC_M2_0606_P:fbd6458be4f8ccbf1dc0", + "symbol": "Rrn3", + "description": "RRN3 RNA polymerase I transcription factor homolog (yeast)", + "location": "Chr16: 13.814359", + "mean": "9.195", + "additive": "-0.085", + "lod_score": "2.8", + "lrs_location": "Chr1: 148.717644", + "sample_r": "0.256", + "num_overlap": 67, + "sample_p": "3.636e-02", + "lit_corr": "--", + "tissue_corr": "0.587", + "tissue_pvalue": "1.621e-03" + }, + { + "index": 15, + "trait_id": "1415717_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415717_at:HC_M2_0606_P:dd51438830e4033114f8", + "symbol": "Rnf220", + "description": "ring finger protein 220; mid 3' UTR", + "location": "Chr4: 116.944155", + "mean": "10.778", + "additive": "-0.084", + "lod_score": "2.4", + "lrs_location": "Chr4: 122.536808", + "sample_r": "0.242", + "num_overlap": 67, + "sample_p": "4.816e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 16, + "trait_id": "1415703_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415703_at:HC_M2_0606_P:51ee8e47654845a546f0", + "symbol": "Huwe1", + "description": "HECT, UBA and WWE domain containing 1; last 3 exons and proximal 3' UTR", + "location": "ChrX: 148.367136", + "mean": "11.335", + "additive": "-0.094", + "lod_score": "2.3", + "lrs_location": "Chr1: 135.891043", + "sample_r": "0.235", + "num_overlap": 67, + "sample_p": "5.541e-02", + "lit_corr": "--", + "tissue_corr": "0.528", + "tissue_pvalue": "5.576e-03" + }, + { + "index": 17, + "trait_id": "1415748_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415748_a_at:HC_M2_0606_P:749a2279081b54e89885", + "symbol": "Dctn5", + "description": "dynactin 5; last exon and proximal half of 3' UTR", + "location": "Chr7: 129.291923", + "mean": "11.250", + "additive": "0.071", + "lod_score": "3.4", + "lrs_location": "Chr5: 138.337847", + "sample_r": "0.230", + "num_overlap": 67, + "sample_p": "6.133e-02", + "lit_corr": "--", + "tissue_corr": "0.064", + "tissue_pvalue": "7.557e-01" + }, + { + "index": 18, + "trait_id": "1415706_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415706_at:HC_M2_0606_P:ddfffdb78d0ff84d6a1a", + "symbol": "Copa", + "description": "coatomer protein complex, subunit alpha; 3' UTR", + "location": "Chr1: 174.051912", + "mean": "12.577", + "additive": "-0.143", + "lod_score": "8.7", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.224", + "num_overlap": 67, + "sample_p": "6.829e-02", + "lit_corr": "--", + "tissue_corr": "-0.147", + "tissue_pvalue": "4.739e-01" + }, + { + "index": 19, + "trait_id": "1415696_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415696_at:HC_M2_0606_P:da00b2667d7c27dc76a2", + "symbol": "Sar1a", + "description": "SAR1 gene homolog A; distal 3' UTR", + "location": "Chr10: 61.155492", + "mean": "11.447", + "additive": "-0.051", + "lod_score": "2.4", + "lrs_location": "Chr15: 87.788313", + "sample_r": "0.220", + "num_overlap": 67, + "sample_p": "7.356e-02", + "lit_corr": "--", + "tissue_corr": "-0.559", + "tissue_pvalue": "3.015e-03" + }, + { + "index": 20, + "trait_id": "1415731_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415731_at:HC_M2_0606_P:9e91e97ca1001091a5f3", + "symbol": "Angel2", + "description": "angel homolog 2; distal 3' UTR", + "location": "Chr1: 192.769800", + "mean": "9.490", + "additive": "0.062", + "lod_score": "2.6", + "lrs_location": "Chr14: 124.508018", + "sample_r": "0.218", + "num_overlap": 67, + "sample_p": "7.623e-02", + "lit_corr": "--", + "tissue_corr": "0.232", + "tissue_pvalue": "2.544e-01" + }, + { + "index": 21, + "trait_id": "1415750_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415750_at:HC_M2_0606_P:c9f757736d57e5f23aa5", + "symbol": "Tbl3", + "description": "transducin (beta)-like 3", + "location": "Chr17: 24.838067", + "mean": "8.703", + "additive": "-0.132", + "lod_score": "10.0", + "lrs_location": "Chr17: 23.322636", + "sample_r": "0.213", + "num_overlap": 67, + "sample_p": "8.332e-02", + "lit_corr": "--", + "tissue_corr": "0.312", + "tissue_pvalue": "1.211e-01" + }, + { + "index": 22, + "trait_id": "1415680_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415680_at:HC_M2_0606_P:22e90a54261cb373975e", + "symbol": "Anapc1", + "description": "anaphase promoting complex subunit 1; last 3 exons and 3' UTR", + "location": "Chr2: 128.438499", + "mean": "9.180", + "additive": "-0.102", + "lod_score": "8.7", + "lrs_location": "Chr2: 125.304784", + "sample_r": "-0.210", + "num_overlap": 67, + "sample_p": "8.734e-02", + "lit_corr": "--", + "tissue_corr": "0.367", + "tissue_pvalue": "6.539e-02" + }, + { + "index": 23, + "trait_id": "1415712_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415712_at:HC_M2_0606_P:48e284402cb79a5fbede", + "symbol": "Zranb1", + "description": "zinc finger, RAN-binding domain containing 1 (ubiquitin thioesterase, TRAF-binding protein); far 3' UTR (M430AB control duplicate)", + "location": "Chr7: 140.175988", + "mean": "9.923", + "additive": "-0.079", + "lod_score": "2.8", + "lrs_location": "Chr5: 143.642242", + "sample_r": "-0.208", + "num_overlap": 67, + "sample_p": "9.125e-02", + "lit_corr": "--", + "tissue_corr": "-0.068", + "tissue_pvalue": "7.413e-01" + }, + { + "index": 24, + "trait_id": "1415674_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415674_a_at:HC_M2_0606_P:c8e7fb1fcad21d73fcfd", + "symbol": "Trappc4", + "description": "trafficking protein particle complex 4; exons 3 and 4", + "location": "Chr9: 44.212489", + "mean": "10.760", + "additive": "-0.065", + "lod_score": "3.3", + "lrs_location": "Chr5: 69.527298", + "sample_r": "0.201", + "num_overlap": 67, + "sample_p": "1.028e-01", + "lit_corr": "--", + "tissue_corr": "-0.334", + "tissue_pvalue": "9.587e-02" + }, + { + "index": 25, + "trait_id": "1415747_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415747_s_at:HC_M2_0606_P:5d86584be55f6cec47ab", + "symbol": "Riok3", + "description": "RIO kinase 3 (yeast); mid to distal 3' UTR", + "location": "Chr18: 12.314783", + "mean": "10.906", + "additive": "0.068", + "lod_score": "2.1", + "lrs_location": "Chr4: 13.764991", + "sample_r": "-0.198", + "num_overlap": 67, + "sample_p": "1.081e-01", + "lit_corr": "--", + "tissue_corr": "0.282", + "tissue_pvalue": "1.628e-01" + }, + { + "index": 26, + "trait_id": "1415682_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415682_at:HC_M2_0606_P:d02febdf17a279a71088", + "symbol": "Xpo7", + "description": "exportin 7", + "location": "Chr14: 71.064730", + "mean": "9.075", + "additive": "-0.073", + "lod_score": "2.8", + "lrs_location": "Chr17: 68.421021", + "sample_r": "0.197", + "num_overlap": 67, + "sample_p": "1.092e-01", + "lit_corr": "--", + "tissue_corr": "-0.322", + "tissue_pvalue": "1.084e-01" + }, + { + "index": 27, + "trait_id": "1415732_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415732_at:HC_M2_0606_P:c0010f5b42f210874883", + "symbol": "Abhd16a", + "description": "abhydrolase domain containing 16A; last five exons including proximal 3' UTR", + "location": "Chr17: 35.238940", + "mean": "10.798", + "additive": "-0.132", + "lod_score": "6.1", + "lrs_location": "Chr17: 37.015392", + "sample_r": "0.177", + "num_overlap": 67, + "sample_p": "1.527e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 28, + "trait_id": "1415688_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415688_at:HC_M2_0606_P:4c3b6c7cd3d447f2346c", + "symbol": "Ube2g1", + "description": "ubiquitin-conjugating enzyme E2 G1; mid to distal 3' UTR", + "location": "Chr11: 72.497627", + "mean": "11.494", + "additive": "-0.116", + "lod_score": "7.1", + "lrs_location": "Chr11: 72.486317", + "sample_r": "-0.173", + "num_overlap": 67, + "sample_p": "1.605e-01", + "lit_corr": "--", + "tissue_corr": "0.365", + "tissue_pvalue": "6.671e-02" + }, + { + "index": 29, + "trait_id": "1415698_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415698_at:HC_M2_0606_P:4d8988a8fac8bdbce9c2", + "symbol": "Golm1", + "description": "Golgi membrane protein 1; distal 3' UTR", + "location": "Chr13: 59.736417", + "mean": "11.367", + "additive": "0.113", + "lod_score": "2.9", + "lrs_location": "Chr7: 36.124856", + "sample_r": "0.151", + "num_overlap": 67, + "sample_p": "2.221e-01", + "lit_corr": "--", + "tissue_corr": "-0.053", + "tissue_pvalue": "7.958e-01" + }, + { + "index": 30, + "trait_id": "1415697_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415697_at:HC_M2_0606_P:ab18358c61fbc03fdf13", + "symbol": "G3bp2", + "description": "GTPase activating protein (SH3 domain) binding protein 2; mid proximal 3' UTR", + "location": "Chr5: 92.482845", + "mean": "10.768", + "additive": "0.137", + "lod_score": "3.6", + "lrs_location": "Chr5: 138.337847", + "sample_r": "0.142", + "num_overlap": 67, + "sample_p": "2.504e-01", + "lit_corr": "--", + "tissue_corr": "0.107", + "tissue_pvalue": "6.032e-01" + }, + { + "index": 31, + "trait_id": "1415676_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415676_a_at:HC_M2_0606_P:b236ce0b2af4408662b6", + "symbol": "Psmb5", + "description": "proteasome (prosome, macropain) subunit, beta type 5; coding exons 2 and 3", + "location": "Chr14: 55.233131", + "mean": "14.199", + "additive": "0.130", + "lod_score": "6.9", + "lrs_location": "Chr14: 54.987777", + "sample_r": "-0.136", + "num_overlap": 67, + "sample_p": "2.725e-01", + "lit_corr": "--", + "tissue_corr": "0.152", + "tissue_pvalue": "4.580e-01" + }, + { + "index": 32, + "trait_id": "1415723_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415723_at:HC_M2_0606_P:8672294efc1c30e220c2", + "symbol": "Eif5", + "description": "eukaryotic translation initiation factor 5; distal 3' UTR", + "location": "Chr12: 112.784258", + "mean": "12.507", + "additive": "-0.196", + "lod_score": "12.9", + "lrs_location": "Chr12: 112.426348", + "sample_r": "-0.134", + "num_overlap": 67, + "sample_p": "2.795e-01", + "lit_corr": "--", + "tissue_corr": "0.105", + "tissue_pvalue": "6.104e-01" + }, + { + "index": 33, + "trait_id": "1415692_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415692_s_at:HC_M2_0606_P:a30c9243d16dd6d28826", + "symbol": "Canx", + "description": "calnexin; mid 3' UTR", + "location": "Chr11: 50.108505", + "mean": "13.862", + "additive": "0.090", + "lod_score": "3.3", + "lrs_location": "Chr9: 15.693672", + "sample_r": "0.133", + "num_overlap": 67, + "sample_p": "2.828e-01", + "lit_corr": "--", + "tissue_corr": "0.298", + "tissue_pvalue": "1.388e-01" + }, + { + "index": 34, + "trait_id": "1415728_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415728_at:HC_M2_0606_P:449a770634eff3bac9f5", + "symbol": "Pabpn1", + "description": "polyadenylate-binding protein 2; far 3' UTR", + "location": "Chr14: 55.517242", + "mean": "10.510", + "additive": "0.150", + "lod_score": "2.3", + "lrs_location": "Chr19: 53.933992", + "sample_r": "-0.130", + "num_overlap": 67, + "sample_p": "2.942e-01", + "lit_corr": "--", + "tissue_corr": "0.132", + "tissue_pvalue": "5.194e-01" + }, + { + "index": 35, + "trait_id": "1415675_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415675_at:HC_M2_0606_P:9712db695d534370b0d9", + "symbol": "Dpm2", + "description": "dolichol-phosphate (beta-D) mannosyltransferase 2; last exon and proximal to mid 3' UTR", + "location": "Chr2: 32.428524", + "mean": "10.207", + "additive": "-0.043", + "lod_score": "2.6", + "lrs_location": "Chr13: 30.769380", + "sample_r": "-0.129", + "num_overlap": 67, + "sample_p": "2.966e-01", + "lit_corr": "--", + "tissue_corr": "0.102", + "tissue_pvalue": "6.201e-01" + }, + { + "index": 36, + "trait_id": "1415721_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415721_a_at:HC_M2_0606_P:fd804230fcc3400d6b4b", + "symbol": "Naa60", + "description": "N(alpha)-acetyltransferase 60, NatF catalytic subunit; distal 3' UTR", + "location": "Chr16: 3.904169", + "mean": "10.153", + "additive": "-0.059", + "lod_score": "3.6", + "lrs_location": "Chr2: 159.368724", + "sample_r": "0.128", + "num_overlap": 67, + "sample_p": "3.004e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 37, + "trait_id": "1415733_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415733_a_at:HC_M2_0606_P:4eff33f3ecd4c0dd418e", + "symbol": "Shb", + "description": "Src homology 2 domain containing adaptor protein B; putative far 3' UTR (or intercalated neighbor)", + "location": "Chr4: 45.118127", + "mean": "10.756", + "additive": "-0.044", + "lod_score": "1.9", + "lrs_location": "Chr5: 69.527298", + "sample_r": "0.126", + "num_overlap": 67, + "sample_p": "3.103e-01", + "lit_corr": "--", + "tissue_corr": "0.149", + "tissue_pvalue": "4.678e-01" + }, + { + "index": 38, + "trait_id": "1415720_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415720_s_at:HC_M2_0606_P:4e7dab211ec586e8297a", + "symbol": "Mad2l1bp", + "description": "mitotic arrest deficient 2, homolog-like 1 (MAD2L1) binding protein; last exon and 3' UTR", + "location": "Chr17: 46.284624", + "mean": "7.057", + "additive": "0.048", + "lod_score": "2.5", + "lrs_location": "Chr8: 33.934048", + "sample_r": "0.122", + "num_overlap": 67, + "sample_p": "3.262e-01", + "lit_corr": "--", + "tissue_corr": "0.463", + "tissue_pvalue": "1.709e-02" + }, + { + "index": 39, + "trait_id": "1415767_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415767_at:HC_M2_0606_P:3e5a802a95121f3ffa1f", + "symbol": "Ythdf1", + "description": "YTH domain family, member 1; mid 3' UTR", + "location": "Chr2: 180.639551", + "mean": "10.902", + "additive": "-0.051", + "lod_score": "2.2", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.120", + "num_overlap": 67, + "sample_p": "3.325e-01", + "lit_corr": "--", + "tissue_corr": "0.382", + "tissue_pvalue": "5.396e-02" + }, + { + "index": 40, + "trait_id": "1415762_x_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415762_x_at:HC_M2_0606_P:978ad700958782192aa2", + "symbol": "Mrpl52", + "description": "mitochondrial ribosomal protein L52", + "location": "Chr14: 55.045789", + "mean": "10.926", + "additive": "0.086", + "lod_score": "2.5", + "lrs_location": "Chr1: 190.087097", + "sample_r": "0.118", + "num_overlap": 67, + "sample_p": "3.406e-01", + "lit_corr": "--", + "tissue_corr": "0.395", + "tissue_pvalue": "4.585e-02" + }, + { + "index": 41, + "trait_id": "1415736_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415736_at:HC_M2_0606_P:c9bd62acd0c2cc087606", + "symbol": "Pfdn5", + "description": "prefoldin 5", + "location": "Chr15: 102.156651", + "mean": "13.571", + "additive": "0.095", + "lod_score": "2.3", + "lrs_location": "Chr10: 5.378622", + "sample_r": "0.118", + "num_overlap": 67, + "sample_p": "3.418e-01", + "lit_corr": "--", + "tissue_corr": "-0.261", + "tissue_pvalue": "1.975e-01" + }, + { + "index": 42, + "trait_id": "1415704_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415704_a_at:HC_M2_0606_P:a05982c0214ff2dc2a40", + "symbol": "Cdv3", + "description": "carnitine deficiency-associated gene expressed in ventricle 3", + "location": "Chr9: 103.255487", + "mean": "10.994", + "additive": "0.060", + "lod_score": "3.1", + "lrs_location": "Chr3: 10.018672", + "sample_r": "-0.115", + "num_overlap": 67, + "sample_p": "3.539e-01", + "lit_corr": "--", + "tissue_corr": "0.598", + "tissue_pvalue": "1.246e-03" + }, + { + "index": 43, + "trait_id": "1415699_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415699_a_at:HC_M2_0606_P:8a5c52aea60cad17e29c", + "symbol": "Gps1", + "description": "G protein pathway suppressor 1 (COP9 signalosome complex subunit 1)", + "location": "Chr11: 120.649820", + "mean": "12.033", + "additive": "0.065", + "lod_score": "3.4", + "lrs_location": "Chr11: 62.910461", + "sample_r": "-0.114", + "num_overlap": 67, + "sample_p": "3.575e-01", + "lit_corr": "--", + "tissue_corr": "0.150", + "tissue_pvalue": "4.638e-01" + }, + { + "index": 44, + "trait_id": "1415739_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415739_at:HC_M2_0606_P:c5e8b34713057f53dd07", + "symbol": "Rbm42", + "description": "RNA-binding motif protein 42; exon 7 and 3' UTR", + "location": "Chr7: 31.426055", + "mean": "10.926", + "additive": "-0.154", + "lod_score": "12.8", + "lrs_location": "Chr1: 174.792334", + "sample_r": "0.107", + "num_overlap": 67, + "sample_p": "3.898e-01", + "lit_corr": "--", + "tissue_corr": "0.550", + "tissue_pvalue": "3.580e-03" + }, + { + "index": 45, + "trait_id": "1415695_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415695_at:HC_M2_0606_P:44556cafdf6f5e38669b", + "symbol": "Psma1", + "description": "proteasome (prosome, macropain) subunit, alpha type 1; last four exons and proximal 3' UTR", + "location": "Chr7: 121.408358", + "mean": "12.346", + "additive": "-0.081", + "lod_score": "3.1", + "lrs_location": "Chr12: 29.344230", + "sample_r": "-0.106", + "num_overlap": 67, + "sample_p": "3.925e-01", + "lit_corr": "--", + "tissue_corr": "0.274", + "tissue_pvalue": "1.763e-01" + }, + { + "index": 46, + "trait_id": "1415745_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415745_a_at:HC_M2_0606_P:0178fc19ada3ba0179fb", + "symbol": "Dscr3", + "description": "Down syndrome critical region protein 3", + "location": "Chr16: 94.719451", + "mean": "9.329", + "additive": "0.071", + "lod_score": "2.2", + "lrs_location": "Chr4: 19.960179", + "sample_r": "-0.102", + "num_overlap": 67, + "sample_p": "4.133e-01", + "lit_corr": "--", + "tissue_corr": "-0.138", + "tissue_pvalue": "5.025e-01" + }, + { + "index": 47, + "trait_id": "1415763_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415763_a_at:HC_M2_0606_P:489dea4b682a7f0b5dc4", + "symbol": "Tmem234", + "description": "transmembrane protein 234; far 3' UTR", + "location": "Chr4: 129.285471", + "mean": "11.370", + "additive": "-0.080", + "lod_score": "2.7", + "lrs_location": "Chr19: 36.251059", + "sample_r": "-0.099", + "num_overlap": 67, + "sample_p": "4.274e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 48, + "trait_id": "1415707_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415707_at:HC_M2_0606_P:44193c047da5c37a307d", + "symbol": "Anapc2", + "description": "anaphase promoting complex subunit 2; last two exons and proximal 3' UTR", + "location": "Chr2: 25.140684", + "mean": "10.044", + "additive": "0.057", + "lod_score": "3.0", + "lrs_location": "Chr11: 76.761051", + "sample_r": "-0.096", + "num_overlap": 67, + "sample_p": "4.378e-01", + "lit_corr": "--", + "tissue_corr": "-0.121", + "tissue_pvalue": "5.551e-01" + }, + { + "index": 49, + "trait_id": "1415716_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415716_a_at:HC_M2_0606_P:c453f863ce1446551a6c", + "symbol": "Rps27", + "description": "ribosomal protein S27; last two exons and proximal 3' UTR", + "location": "Chr3: 90.016627", + "mean": "15.694", + "additive": "0.132", + "lod_score": "3.2", + "lrs_location": "Chr1: 165.315110", + "sample_r": "0.092", + "num_overlap": 67, + "sample_p": "4.594e-01", + "lit_corr": "--", + "tissue_corr": "0.150", + "tissue_pvalue": "4.654e-01" + }, + { + "index": 50, + "trait_id": "1415769_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415769_at:HC_M2_0606_P:564c4d3bb19aca88c74b", + "symbol": "Itch", + "description": "itchy, E3 ubiquitin protein ligase; distal 3' UTR", + "location": "Chr2: 155.052012", + "mean": "9.460", + "additive": "0.057", + "lod_score": "2.5", + "lrs_location": "Chr7: 56.652492", + "sample_r": "0.087", + "num_overlap": 67, + "sample_p": "4.833e-01", + "lit_corr": "--", + "tissue_corr": "0.373", + "tissue_pvalue": "6.074e-02" + }, + { + "index": 51, + "trait_id": "1415761_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415761_at:HC_M2_0606_P:744c009738648980b1a3", + "symbol": "Mrpl52", + "description": "mitochondrial ribosomal protein L52; all five exons", + "location": "Chr14: 55.045789", + "mean": "10.635", + "additive": "0.099", + "lod_score": "2.9", + "lrs_location": "Chr4: 155.235046", + "sample_r": "0.085", + "num_overlap": 67, + "sample_p": "4.953e-01", + "lit_corr": "--", + "tissue_corr": "0.395", + "tissue_pvalue": "4.585e-02" + }, + { + "index": 52, + "trait_id": "1415746_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415746_at:HC_M2_0606_P:fed140f95a21fef772a2", + "symbol": "Cic", + "description": "capicua transcriptional repressor", + "location": "Chr7: 26.078638", + "mean": "12.178", + "additive": "-0.115", + "lod_score": "2.0", + "lrs_location": "Chr11: 64.909098", + "sample_r": "-0.082", + "num_overlap": 67, + "sample_p": "5.099e-01", + "lit_corr": "--", + "tissue_corr": "0.263", + "tissue_pvalue": "1.949e-01" + }, + { + "index": 53, + "trait_id": "1415759_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415759_a_at:HC_M2_0606_P:a27045c52162a32061e0", + "symbol": "Hbxip", + "description": "hepatitis B virus x-interacting protein (binds C-terminus of hepatitis B virus X protein, HBx); last two exons and 3' UTR", + "location": "Chr3: 107.084847", + "mean": "11.029", + "additive": "-0.205", + "lod_score": "13.4", + "lrs_location": "Chr3: 108.822022", + "sample_r": "0.081", + "num_overlap": 67, + "sample_p": "5.170e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 54, + "trait_id": "1415705_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415705_at:HC_M2_0606_P:84786a1fa09230a4b766", + "symbol": "Smim7", + "description": "small integral membrane protein 7", + "location": "Chr8: 75.089847", + "mean": "10.144", + "additive": "-0.106", + "lod_score": "4.3", + "lrs_location": "Chr1: 172.981863", + "sample_r": "-0.070", + "num_overlap": 67, + "sample_p": "5.723e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 55, + "trait_id": "1415708_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415708_at:HC_M2_0606_P:4c91e4736226606aa737", + "symbol": "Tug1", + "description": "taurine upregulated gene 1; distal 3' UTR", + "location": "Chr11: 3.540066", + "mean": "11.596", + "additive": "-0.093", + "lod_score": "4.0", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.070", + "num_overlap": 67, + "sample_p": "5.733e-01", + "lit_corr": "--", + "tissue_corr": "0.612", + "tissue_pvalue": "8.850e-04" + }, + { + "index": 56, + "trait_id": "1415766_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415766_at:HC_M2_0606_P:204ca6dc37a14c02d1c5", + "symbol": "Sec22l1", + "description": "SEC22 vesicle trafficking protein-like 1; distal 3' UTR", + "location": "Chr3: 97.726622", + "mean": "10.619", + "additive": "0.055", + "lod_score": "2.0", + "lrs_location": "Chr1: 183.936095", + "sample_r": "0.070", + "num_overlap": 67, + "sample_p": "5.757e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 57, + "trait_id": "1415722_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415722_a_at:HC_M2_0606_P:c5fd27526c57d8c3fd4b", + "symbol": "Vta1", + "description": "Vps20-associated 1; last two exons and proximal 3' UTR", + "location": "Chr10: 14.375393", + "mean": "10.716", + "additive": "-0.076", + "lod_score": "6.1", + "lrs_location": "Chr10: 5.378622", + "sample_r": "0.065", + "num_overlap": 67, + "sample_p": "6.012e-01", + "lit_corr": "--", + "tissue_corr": "0.421", + "tissue_pvalue": "3.209e-02" + }, + { + "index": 58, + "trait_id": "1415689_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415689_s_at:HC_M2_0606_P:a70dcbef5742da689bc1", + "symbol": "Zkscan3", + "description": "zinc finger with KRAB and SCAN domains 3 (human ZKSCAN4); mid 3' UTR", + "location": "Chr13: 21.479302", + "mean": "8.611", + "additive": "0.064", + "lod_score": "1.9", + "lrs_location": "Chr4: 154.365177", + "sample_r": "-0.064", + "num_overlap": 67, + "sample_p": "6.046e-01", + "lit_corr": "--", + "tissue_corr": "0.552", + "tissue_pvalue": "3.454e-03" + }, + { + "index": 59, + "trait_id": "1415754_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415754_at:HC_M2_0606_P:e5bf579fd7db6c886098", + "symbol": "Polr2f", + "description": "polymerase (RNA) II (DNA directed) polypeptide F; 5' UTR and exons 1, 2, and 4", + "location": "Chr15: 78.971834", + "mean": "10.742", + "additive": "0.058", + "lod_score": "2.4", + "lrs_location": "Chr1: 189.435367", + "sample_r": "0.062", + "num_overlap": 67, + "sample_p": "6.167e-01", + "lit_corr": "--", + "tissue_corr": "-0.181", + "tissue_pvalue": "3.755e-01" + }, + { + "index": 60, + "trait_id": "1415765_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415765_at:HC_M2_0606_P:01b87826e23dea53f4fb", + "symbol": "Hnrpul2", + "description": "heterogeneous nuclear ribonucleoprotein U-like 2 (similar to ubiquitin carboxyl-terminal hydrolase 21); 3' UTR", + "location": "Chr19: 8.905975", + "mean": "9.165", + "additive": "-0.091", + "lod_score": "2.9", + "lrs_location": "Chr6: 98.258572", + "sample_r": "-0.061", + "num_overlap": 67, + "sample_p": "6.259e-01", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.728e-01" + }, + { + "index": 61, + "trait_id": "1415714_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415714_a_at:HC_M2_0606_P:24547c4d8e0d33203c93", + "symbol": "Snrnp27", + "description": "small nuclear ribonucleoprotein 27 kDa (U4/U6.U5); exons 3 and 4", + "location": "Chr6: 86.630900", + "mean": "12.255", + "additive": "0.076", + "lod_score": "3.3", + "lrs_location": "Chr5: 138.337847", + "sample_r": "-0.059", + "num_overlap": 67, + "sample_p": "6.375e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 62, + "trait_id": "1415760_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415760_s_at:HC_M2_0606_P:8c46a844ccc841978948", + "symbol": "Atox1", + "description": "ATX1 (antioxidant protein 1) homolog 1; last two exons and proximal 3' UTR", + "location": "Chr11: 55.263981", + "mean": "11.035", + "additive": "0.077", + "lod_score": "1.8", + "lrs_location": "Chr9: 49.215835", + "sample_r": "-0.056", + "num_overlap": 67, + "sample_p": "6.511e-01", + "lit_corr": "--", + "tissue_corr": "-0.243", + "tissue_pvalue": "2.324e-01" + }, + { + "index": 63, + "trait_id": "1415734_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415734_at:HC_M2_0606_P:aa7f07dc0f541cde5715", + "symbol": "Rab7", + "description": "RAB7, member RAS oncogene family (Charcot-Marie-Tooth (CMT) type 2)", + "location": "Chr6: 87.949145", + "mean": "13.802", + "additive": "-0.053", + "lod_score": "2.3", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.054", + "num_overlap": 67, + "sample_p": "6.618e-01", + "lit_corr": "--", + "tissue_corr": "0.054", + "tissue_pvalue": "7.921e-01" + }, + { + "index": 64, + "trait_id": "1415719_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415719_s_at:HC_M2_0606_P:90fe587b88df98f034a9", + "symbol": "Armc1", + "description": "armadillo repeat containing 1; distal 3' UTR", + "location": "Chr3: 19.032212", + "mean": "11.373", + "additive": "-0.193", + "lod_score": "17.0", + "lrs_location": "Chr3: 19.544553", + "sample_r": "-0.053", + "num_overlap": 67, + "sample_p": "6.680e-01", + "lit_corr": "--", + "tissue_corr": "0.305", + "tissue_pvalue": "1.296e-01" + }, + { + "index": 65, + "trait_id": "1415677_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415677_at:HC_M2_0606_P:0b0c1af1012288383c27", + "symbol": "Dhrs1", + "description": "dehydrogenase/reductase (SDR family) member 1; last four exons", + "location": "Chr14: 56.358423", + "mean": "10.640", + "additive": "0.070", + "lod_score": "4.3", + "lrs_location": "Chr1: 29.231425", + "sample_r": "0.052", + "num_overlap": 67, + "sample_p": "6.785e-01", + "lit_corr": "--", + "tissue_corr": "-0.238", + "tissue_pvalue": "2.422e-01" + }, + { + "index": 66, + "trait_id": "1415756_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415756_a_at:HC_M2_0606_P:c5252e44b226f6bfb751", + "symbol": "Snapap", + "description": "SNAP-associated protein; mid 3' UTR", + "location": "Chr3: 90.292659", + "mean": "9.902", + "additive": "-0.155", + "lod_score": "9.4", + "lrs_location": "Chr3: 89.894692", + "sample_r": "-0.052", + "num_overlap": 67, + "sample_p": "6.788e-01", + "lit_corr": "--", + "tissue_corr": "0.179", + "tissue_pvalue": "3.809e-01" + }, + { + "index": 67, + "trait_id": "1415678_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415678_at:HC_M2_0606_P:04b17c5b061ad6e8904b", + "symbol": "Ppm1a", + "description": "protein phosphatase 1A, magnesium dependent; 3' UTR", + "location": "Chr12: 73.894951", + "mean": "11.586", + "additive": "-0.075", + "lod_score": "3.4", + "lrs_location": "Chr12: 76.396441", + "sample_r": "-0.051", + "num_overlap": 67, + "sample_p": "6.841e-01", + "lit_corr": "--", + "tissue_corr": "-0.099", + "tissue_pvalue": "6.295e-01" + }, + { + "index": 68, + "trait_id": "1415709_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415709_s_at:HC_M2_0606_P:4b91fccf51bc6263dcae", + "symbol": "Gbf1", + "description": "Golgi-specific brefeldin A-resistance factor 1", + "location": "Chr19: 46.360511", + "mean": "9.342", + "additive": "0.056", + "lod_score": "3.6", + "lrs_location": "ChrX: 81.842525", + "sample_r": "0.050", + "num_overlap": 67, + "sample_p": "6.863e-01", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.741e-01" + }, + { + "index": 69, + "trait_id": "1415671_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415671_at:HC_M2_0606_P:c3cd4876e293def795bf", + "symbol": "Atp6v0d1", + "description": "ATPase, H+ transporting, lysosomal 38kDa, V0 subunit d1", + "location": "Chr8: 108.048521", + "mean": "13.278", + "additive": "-0.080", + "lod_score": "3.7", + "lrs_location": "Chr19: 13.033814", + "sample_r": "-0.050", + "num_overlap": 67, + "sample_p": "6.898e-01", + "lit_corr": "--", + "tissue_corr": "-0.284", + "tissue_pvalue": "1.593e-01" + }, + { + "index": 70, + "trait_id": "1415752_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415752_at:HC_M2_0606_P:4db5c0fbe608b70cb257", + "symbol": "C18orf32", + "description": "putative NF-kappa-B-activating protein 200, C18orf32; 3' UTR", + "location": "Chr18: 75.169011", + "mean": "12.815", + "additive": "0.093", + "lod_score": "5.3", + "lrs_location": "Chr18: 75.843607", + "sample_r": "-0.048", + "num_overlap": 67, + "sample_p": "6.997e-01", + "lit_corr": "--", + "tissue_corr": "-0.378", + "tissue_pvalue": "5.664e-02" + }, + { + "index": 71, + "trait_id": "1415749_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415749_a_at:HC_M2_0606_P:7d00997b6e9b339f534d", + "symbol": "Rragc", + "description": "Ras-related GTP binding C; mid-distal 3' UTR", + "location": "Chr4: 123.613693", + "mean": "11.140", + "additive": "-0.057", + "lod_score": "2.2", + "lrs_location": "Chr12: 76.396441", + "sample_r": "-0.044", + "num_overlap": 67, + "sample_p": "7.244e-01", + "lit_corr": "--", + "tissue_corr": "-0.158", + "tissue_pvalue": "4.411e-01" + }, + { + "index": 72, + "trait_id": "1415673_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415673_at:HC_M2_0606_P:6eb18e73a45c97c7f8d0", + "symbol": "Psph", + "description": "phosphoserine phosphatase; last three exons and distal 3' UTR", + "location": "Chr5: 130.271465", + "mean": "9.690", + "additive": "-0.121", + "lod_score": "6.9", + "lrs_location": "Chr1: 174.792334", + "sample_r": "-0.043", + "num_overlap": 67, + "sample_p": "7.325e-01", + "lit_corr": "--", + "tissue_corr": "0.070", + "tissue_pvalue": "7.354e-01" + }, + { + "index": 73, + "trait_id": "1415718_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415718_at:HC_M2_0606_P:9714b7b3046b5c8bf4a0", + "symbol": "Sap30l", + "description": "SAP30-like (histone deacetylase complex subunit, sin3A-associated protein p30-like protein); last three exons and 3' UTR", + "location": "Chr11: 57.619548", + "mean": "10.407", + "additive": "0.170", + "lod_score": "12.8", + "lrs_location": "Chr11: 57.088037", + "sample_r": "0.041", + "num_overlap": 67, + "sample_p": "7.418e-01", + "lit_corr": "--", + "tissue_corr": "0.016", + "tissue_pvalue": "9.370e-01" + }, + { + "index": 74, + "trait_id": "1415755_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415755_a_at:HC_M2_0606_P:e23340ac6458755b9d1e", + "symbol": "Ube2v1", + "description": "ubiquitin-conjugating enzyme E2 variant 1", + "location": "Chr2: 23.477654", + "mean": "12.282", + "additive": "0.053", + "lod_score": "2.2", + "lrs_location": "Chr6: 127.954548", + "sample_r": "0.040", + "num_overlap": 67, + "sample_p": "7.490e-01", + "lit_corr": "--", + "tissue_corr": "-0.321", + "tissue_pvalue": "1.102e-01" + }, + { + "index": 75, + "trait_id": "1415694_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415694_at:HC_M2_0606_P:38c96bb74d8916f0c519", + "symbol": "Wars", + "description": "tryptophanyl-tRNA synthetase; alternative 3' UTR (short form, test Mendelian 12.109, BXD hippocampus, B high)", + "location": "Chr12: 110.098698", + "mean": "8.523", + "additive": "-0.938", + "lod_score": "32.3", + "lrs_location": "Chr12: 110.136559", + "sample_r": "-0.039", + "num_overlap": 67, + "sample_p": "7.559e-01", + "lit_corr": "--", + "tissue_corr": "-0.275", + "tissue_pvalue": "1.738e-01" + }, + { + "index": 76, + "trait_id": "1415744_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415744_at:HC_M2_0606_P:38f9abcb635f29e5871c", + "symbol": "Pfdn6", + "description": "prefoldin subunit 6 (H2-K region expressed gene 2); 5' UTR, exons 1, 3, 4, and 3' UTR", + "location": "Chr17: 34.075883", + "mean": "11.324", + "additive": "-0.157", + "lod_score": "11.0", + "lrs_location": "Chr17: 33.247164", + "sample_r": "0.038", + "num_overlap": 67, + "sample_p": "7.626e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 77, + "trait_id": "1415700_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415700_a_at:HC_M2_0606_P:95582b9daa0776067713", + "symbol": "Ssr3", + "description": "signal sequence receptor, gamma (translocon-associated protein gamma); mid-distal 3' UTR", + "location": "Chr3: 65.183917", + "mean": "12.068", + "additive": "0.067", + "lod_score": "2.1", + "lrs_location": "Chr7: 27.852865", + "sample_r": "0.036", + "num_overlap": 67, + "sample_p": "7.742e-01", + "lit_corr": "--", + "tissue_corr": "-0.354", + "tissue_pvalue": "7.623e-02" + }, + { + "index": 78, + "trait_id": "1415687_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415687_a_at:HC_M2_0606_P:f15bcfef7839d22ca5a3", + "symbol": "Psap", + "description": "prosaposin; mid and distal 3' UTR", + "location": "Chr10: 59.764772", + "mean": "14.976", + "additive": "0.121", + "lod_score": "2.0", + "lrs_location": "Chr5: 4.468199", + "sample_r": "0.035", + "num_overlap": 67, + "sample_p": "7.777e-01", + "lit_corr": "--", + "tissue_corr": "0.078", + "tissue_pvalue": "7.058e-01" + }, + { + "index": 79, + "trait_id": "1415729_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415729_at:HC_M2_0606_P:08dc70633663e17111dd", + "symbol": "Pdpk1", + "description": "3-phosphoinositide dependent protein kinase-1; distal 3' UTR", + "location": "Chr17: 24.210667", + "mean": "12.376", + "additive": "-0.081", + "lod_score": "3.0", + "lrs_location": "Chr2: 55.266330", + "sample_r": "-0.029", + "num_overlap": 67, + "sample_p": "8.147e-01", + "lit_corr": "--", + "tissue_corr": "0.290", + "tissue_pvalue": "1.506e-01" + }, + { + "index": 80, + "trait_id": "1415672_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415672_at:HC_M2_0606_P:d6a7286d4957f3487196", + "symbol": "Golga7", + "description": "golgi autoantigen, golgin subfamily a, 7", + "location": "Chr8: 24.351869", + "mean": "13.218", + "additive": "0.063", + "lod_score": "2.6", + "lrs_location": "Chr13: 120.059030", + "sample_r": "-0.027", + "num_overlap": 67, + "sample_p": "8.305e-01", + "lit_corr": "--", + "tissue_corr": "-0.456", + "tissue_pvalue": "1.919e-02" + }, + { + "index": 81, + "trait_id": "1415713_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415713_a_at:HC_M2_0606_P:e22be15fd9ade623e3bb", + "symbol": "Ddx24", + "description": "DEAD (Asp-Glu-Ala-Asp) box polypeptide 24; last two exons", + "location": "Chr12: 104.646500", + "mean": "11.808", + "additive": "0.052", + "lod_score": "3.1", + "lrs_location": "Chr9: 15.693672", + "sample_r": "-0.026", + "num_overlap": 67, + "sample_p": "8.322e-01", + "lit_corr": "--", + "tissue_corr": "0.338", + "tissue_pvalue": "9.077e-02" + }, + { + "index": 82, + "trait_id": "1415683_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415683_at:HC_M2_0606_P:f544e88da2dd8adb0b3f", + "symbol": "Nmt1", + "description": "N-myristoyltransferase 1; exons 10 and 11, and 3' UTR", + "location": "Chr11: 102.926047", + "mean": "12.261", + "additive": "-0.070", + "lod_score": "2.6", + "lrs_location": "Chr6: 101.797292", + "sample_r": "0.026", + "num_overlap": 67, + "sample_p": "8.375e-01", + "lit_corr": "--", + "tissue_corr": "0.366", + "tissue_pvalue": "6.559e-02" + }, + { + "index": 83, + "trait_id": "1415701_x_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415701_x_at:HC_M2_0606_P:8faa1e92ec8fc8cf33b5", + "symbol": "Rpl23", + "description": "ribosomal protein L23; spans exons 1, 2, 3, 4, and intron 4, and proximal 3' UTR", + "location": "Chr11: 97.639386", + "mean": "16.236", + "additive": "0.067", + "lod_score": "2.7", + "lrs_location": "Chr2: 162.502590", + "sample_r": "0.024", + "num_overlap": 67, + "sample_p": "8.474e-01", + "lit_corr": "--", + "tissue_corr": "-0.036", + "tissue_pvalue": "8.630e-01" + }, + { + "index": 84, + "trait_id": "1415681_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415681_at:HC_M2_0606_P:96ceed972f5f3da9d52d", + "symbol": "Mrpl43", + "description": "mitochondrial ribosomal protein L43", + "location": "Chr19: 45.079983", + "mean": "10.604", + "additive": "-0.058", + "lod_score": "2.1", + "lrs_location": "Chr7: 90.186486", + "sample_r": "-0.021", + "num_overlap": 67, + "sample_p": "8.669e-01", + "lit_corr": "--", + "tissue_corr": "0.362", + "tissue_pvalue": "6.958e-02" + }, + { + "index": 85, + "trait_id": "1415691_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415691_at:HC_M2_0606_P:c6a3213115c205f73f86", + "symbol": "Dlg1", + "description": "discs, large homolog 1 (presynaptic protein SAP97); distal 3' UTR", + "location": "Chr16: 31.872849", + "mean": "11.782", + "additive": "0.088", + "lod_score": "2.9", + "lrs_location": "Chr17: 55.490261", + "sample_r": "-0.020", + "num_overlap": 67, + "sample_p": "8.731e-01", + "lit_corr": "--", + "tissue_corr": "0.015", + "tissue_pvalue": "9.426e-01" + }, + { + "index": 86, + "trait_id": "1415715_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415715_at:HC_M2_0606_P:8c7d719635beb0f7a9f5", + "symbol": "Slbp", + "description": "stem-loop binding protein", + "location": "Chr5: 33.995959", + "mean": "9.003", + "additive": "0.051", + "lod_score": "2.2", + "lrs_location": "Chr11: 69.415410", + "sample_r": "-0.020", + "num_overlap": 67, + "sample_p": "8.749e-01", + "lit_corr": "--", + "tissue_corr": "0.090", + "tissue_pvalue": "6.621e-01" + }, + { + "index": 87, + "trait_id": "1415751_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415751_at:HC_M2_0606_P:d0d8a9fa8a2b142d4374", + "symbol": "Hb1bp3", + "description": "heterochromatin protein 1-binding protein 3", + "location": "Chr4: 137.798500", + "mean": "12.239", + "additive": "-0.168", + "lod_score": "14.7", + "lrs_location": "Chr4: 138.152371", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.773e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 88, + "trait_id": "1415764_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415764_at:HC_M2_0606_P:8a23b78d5d55a0026ceb", + "symbol": "Cpsf7", + "description": "cleavage and polyadenylation specificity factor 7", + "location": "Chr1: 135.516541", + "mean": "11.499", + "additive": "-0.352", + "lod_score": "28.8", + "lrs_location": "Chr1: 135.115363", + "sample_r": "-0.019", + "num_overlap": 67, + "sample_p": "8.787e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 89, + "trait_id": "1415724_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415724_a_at:HC_M2_0606_P:4ff4b2d244043dc3b03e", + "symbol": "Cdc42", + "description": "cell division cycle 42 (activator of Rac); mid-distal 3' UTR", + "location": "Chr4: 136.876012", + "mean": "11.795", + "additive": "-0.120", + "lod_score": "5.5", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.792e-01", + "lit_corr": "--", + "tissue_corr": "0.073", + "tissue_pvalue": "7.233e-01" + }, + { + "index": 90, + "trait_id": "1415737_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415737_at:HC_M2_0606_P:c667a35a9b2b78172117", + "symbol": "Rfk", + "description": "riboflavin kinase; distal 3' UTR", + "location": "Chr19: 17.475267", + "mean": "11.552", + "additive": "0.414", + "lod_score": "35.4", + "lrs_location": "Chr19: 16.955950", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.810e-01", + "lit_corr": "--", + "tissue_corr": "0.117", + "tissue_pvalue": "5.681e-01" + }, + { + "index": 91, + "trait_id": "1415738_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415738_at:HC_M2_0606_P:304349c531fb99926720", + "symbol": "Txndc12", + "description": "thioredoxin domain-containing protein 12; 3' UTR", + "location": "Chr4: 108.534146", + "mean": "9.375", + "additive": "-0.103", + "lod_score": "3.2", + "lrs_location": "Chr1: 172.981863", + "sample_r": "-0.016", + "num_overlap": 67, + "sample_p": "9.004e-01", + "lit_corr": "--", + "tissue_corr": "0.135", + "tissue_pvalue": "5.114e-01" + }, + { + "index": 92, + "trait_id": "1415735_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415735_at:HC_M2_0606_P:f30f5a5f571c8c61d459", + "symbol": "Ddb1", + "description": "damage-specific DNA binding protein 1, 127 kDa", + "location": "Chr19: 10.703737", + "mean": "10.647", + "additive": "-0.085", + "lod_score": "5.1", + "lrs_location": "Chr16: 28.990480", + "sample_r": "0.016", + "num_overlap": 67, + "sample_p": "9.008e-01", + "lit_corr": "--", + "tissue_corr": "0.248", + "tissue_pvalue": "2.217e-01" + }, + { + "index": 93, + "trait_id": "1415684_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415684_at:HC_M2_0606_P:710753b49f7e38406e4b", + "symbol": "Atg5", + "description": "autophagy related 5; mid 3' UTR", + "location": "Chr10: 44.083511", + "mean": "8.854", + "additive": "-0.068", + "lod_score": "2.2", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.014", + "num_overlap": 67, + "sample_p": "9.086e-01", + "lit_corr": "--", + "tissue_corr": "-0.109", + "tissue_pvalue": "5.954e-01" + }, + { + "index": 94, + "trait_id": "1415686_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415686_at:HC_M2_0606_P:455a84fffcd7a0997580", + "symbol": "Rab14", + "description": "Rab GTPase family member 14", + "location": "Chr2: 35.036216", + "mean": "12.112", + "additive": "0.110", + "lod_score": "3.6", + "lrs_location": "Chr14: 124.508018", + "sample_r": "-0.013", + "num_overlap": 67, + "sample_p": "9.139e-01", + "lit_corr": "--", + "tissue_corr": "-0.056", + "tissue_pvalue": "7.850e-01" + }, + { + "index": 95, + "trait_id": "1415685_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415685_at:HC_M2_0606_P:60c84786fe2f4a62d13d", + "symbol": "Mtif2", + "description": "mitochondrial translational initiation factor 2", + "location": "Chr11: 29.442428", + "mean": "9.271", + "additive": "-0.367", + "lod_score": "23.1", + "lrs_location": "Chr11: 28.975002", + "sample_r": "0.012", + "num_overlap": 67, + "sample_p": "9.259e-01", + "lit_corr": "--", + "tissue_corr": "-0.358", + "tissue_pvalue": "7.272e-02" + }, + { + "index": 96, + "trait_id": "1415679_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415679_at:HC_M2_0606_P:513339a6b22faab7d8f6", + "symbol": "Psenen", + "description": "presenilin enhancer 2; 5' UTR, all exons, and 3' UTR", + "location": "Chr7: 31.346914", + "mean": "11.480", + "additive": "-0.283", + "lod_score": "19.1", + "lrs_location": "Chr7: 31.505577", + "sample_r": "-0.011", + "num_overlap": 67, + "sample_p": "9.286e-01", + "lit_corr": "--", + "tissue_corr": "-0.002", + "tissue_pvalue": "9.929e-01" + }, + { + "index": 97, + "trait_id": "1415710_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415710_at:HC_M2_0606_P:4b8e32a96cf0e9bb30d3", + "symbol": "Cox18", + "description": "cytochrome c oxidase assembly protein 18; last three exons and proximal 3' UTR", + "location": "Chr5: 90.644087", + "mean": "9.513", + "additive": "0.402", + "lod_score": "33.4", + "lrs_location": "Chr5: 90.500265", + "sample_r": "0.010", + "num_overlap": 67, + "sample_p": "9.360e-01", + "lit_corr": "--", + "tissue_corr": "0.420", + "tissue_pvalue": "3.257e-02" + }, + { + "index": 98, + "trait_id": "1415702_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415702_a_at:HC_M2_0606_P:7ef725f27498e294d14a", + "symbol": "Ctbp1", + "description": "C-terminal binding protein 1; 3' UTR", + "location": "Chr5: 33.590456", + "mean": "12.530", + "additive": "-0.056", + "lod_score": "2.3", + "lrs_location": "Chr12: 76.993653", + "sample_r": "-0.010", + "num_overlap": 67, + "sample_p": "9.372e-01", + "lit_corr": "--", + "tissue_corr": "0.514", + "tissue_pvalue": "7.288e-03" + }, + { + "index": 99, + "trait_id": "1415711_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415711_at:HC_M2_0606_P:f71bb40cdefd07ae95d6", + "symbol": "Arfgef1", + "description": "ADP-ribosylation factor guanine nucleotide-exchange factor 1 (brefeldin A-inhibited); 3' UTR", + "location": "Chr18: 22.122655", + "mean": "11.617", + "additive": "-0.055", + "lod_score": "3.3", + "lrs_location": "Chr2: 50.500580", + "sample_r": "-0.003", + "num_overlap": 67, + "sample_p": "9.802e-01", + "lit_corr": "--", + "tissue_corr": "-0.020", + "tissue_pvalue": "9.216e-01" + }, + { + "index": 100, + "trait_id": "1415726_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415726_at:HC_M2_0606_P:89e8ab5b988a202a2fb0", + "symbol": "Ankrd17", + "description": "ankyrin repeat domain protein 17; last exon and proximal 3' UTR", + "location": "Chr5: 90.657781", + "mean": "11.533", + "additive": "0.046", + "lod_score": "2.0", + "lrs_location": "Chr14: 42.819085", + "sample_r": "0.000", + "num_overlap": 67, + "sample_p": "9.991e-01", + "lit_corr": "--", + "tissue_corr": "0.530", + "tissue_pvalue": "5.382e-03" + } +]
\ No newline at end of file diff --git a/tests/integration/test_correlation.py b/tests/integration/test_correlation.py new file mode 100644 index 0000000..b94487a --- /dev/null +++ b/tests/integration/test_correlation.py @@ -0,0 +1,57 @@ +"""Integration tests for correlation api""" + +import os +import json +import pickle +import unittest +from unittest import mock + +from gn3.app import create_app + + +def file_path(relative_path): + """getting abs path for file """ + dir_name = os.path.dirname(os.path.abspath(__file__)) + split_path = relative_path.split("/") + new_path = os.path.join(dir_name, *split_path) + return new_path + + +class CorrelationAPITest(unittest.TestCase): + # currently disable + """Test cases for the Correlation API""" + + def setUp(self): + self.app = create_app().test_client() + + with open(file_path("correlation_data.json")) as json_file: + self.correlation_data = json.load(json_file) + + with open(file_path("expected_corr_results.json")) as results_file: + self.correlation_results = json.load(results_file) + + def tearDown(self): + self.correlation_data = "" + + self.correlation_results = "" + + @mock.patch("gn3.api.correlation.compute_correlation") + def test_corr_compute(self, compute_corr): + """Test that the correct response in correlation""" + + compute_corr.return_value = self.correlation_results + response = self.app.post( + "/api/correlation/corr_compute", json=self.correlation_data, follow_redirects=True) + + self.assertEqual(response.status_code, 200) + + @mock.patch("gn3.api.correlation.compute_correlation") + def test_corr_compute_failed_request(self,compute_corr): + """test taht cormpute requests fails """ + + compute_corr.return_value = self.correlation_results + + response = self.app.post( + "/api/correlation/corr_compute", json=None, follow_redirects=True) + + self.assertEqual(response.status_code,400) diff --git a/tests/unit/correlation/__init__.py b/tests/unit/correlation/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/unit/correlation/__init__.py diff --git a/tests/unit/correlation/correlation_test_data.json b/tests/unit/correlation/correlation_test_data.json new file mode 100644 index 0000000..87d24e3 --- /dev/null +++ b/tests/unit/correlation/correlation_test_data.json @@ -0,0 +1,18 @@ +{ + "primary_samples": "C57BL/6J,DBA/2J,B6D2F1,D2B6F1,BXD1,BXD2,BXD5,BXD6,BXD8,BXD9,BXD11,BXD12,BXD13,BXD14,BXD15,BXD16,BXD18,BXD19,BXD20,BXD21,BXD22,BXD23,BXD24,BXD24a,BXD25,BXD27,BXD28,BXD29,BXD30,BXD31,BXD32,BXD33,BXD34,BXD35,BXD36,BXD37,BXD38,BXD39,BXD40,BXD41,BXD42,BXD43,BXD44,BXD45,BXD48,BXD48a,BXD49,BXD50,BXD51,BXD52,BXD53,BXD54,BXD55,BXD56,BXD59,BXD60,BXD61,BXD62,BXD63,BXD64,BXD65,BXD65a,BXD65b,BXD66,BXD67,BXD68,BXD69,BXD70,BXD71,BXD72,BXD73,BXD73a,BXD73b,BXD74,BXD75,BXD76,BXD77,BXD78,BXD79,BXD81,BXD83,BXD84,BXD85,BXD86,BXD87,BXD88,BXD89,BXD90,BXD91,BXD93,BXD94,BXD95,BXD98,BXD99,BXD100,BXD101,BXD102,BXD104,BXD105,BXD106,BXD107,BXD108,BXD109,BXD110,BXD111,BXD112,BXD113,BXD114,BXD115,BXD116,BXD117,BXD119,BXD120,BXD121,BXD122,BXD123,BXD124,BXD125,BXD126,BXD127,BXD128,BXD128a,BXD130,BXD131,BXD132,BXD133,BXD134,BXD135,BXD136,BXD137,BXD138,BXD139,BXD141,BXD142,BXD144,BXD145,BXD146,BXD147,BXD148,BXD149,BXD150,BXD151,BXD152,BXD153,BXD154,BXD155,BXD156,BXD157,BXD160,BXD161,BXD162,BXD165,BXD168,BXD169,BXD170,BXD171,BXD172,BXD173,BXD174,BXD175,BXD176,BXD177,BXD178,BXD180,BXD181,BXD183,BXD184,BXD186,BXD187,BXD188,BXD189,BXD190,BXD191,BXD192,BXD193,BXD194,BXD195,BXD196,BXD197,BXD198,BXD199,BXD200,BXD201,BXD202,BXD203,BXD204,BXD205,BXD206,BXD207,BXD208,BXD209,BXD210,BXD211,BXD212,BXD213,BXD214,BXD215,BXD216,BXD217,BXD218,BXD219,BXD220", + "trait_id": "1444666_at", + "dataset": "HC_M2_0606_P", + "sample_vals": "{\"C57BL/6J\":\"6.638\",\"DBA/2J\":\"6.266\",\"B6D2F1\":\"6.494\",\"D2B6F1\":\"6.565\",\"BXD1\":\"6.357\",\"BXD2\":\"6.456\",\"BXD5\":\"6.590\",\"BXD6\":\"6.568\",\"BXD8\":\"6.581\",\"BXD9\":\"6.322\",\"BXD11\":\"6.519\",\"BXD12\":\"6.543\",\"BXD13\":\"6.636\",\"BXD14\":\"x\",\"BXD15\":\"6.578\",\"BXD16\":\"6.636\",\"BXD18\":\"x\",\"BXD19\":\"6.562\",\"BXD20\":\"6.610\",\"BXD21\":\"6.668\",\"BXD22\":\"6.607\",\"BXD23\":\"6.513\",\"BXD24\":\"6.601\",\"BXD24a\":\"x\",\"BXD25\":\"x\",\"BXD27\":\"6.573\",\"BXD28\":\"6.639\",\"BXD29\":\"6.656\",\"BXD30\":\"x\",\"BXD31\":\"6.549\",\"BXD32\":\"6.502\",\"BXD33\":\"6.584\",\"BXD34\":\"6.261\",\"BXD35\":\"x\",\"BXD36\":\"x\",\"BXD37\":\"x\",\"BXD38\":\"6.646\",\"BXD39\":\"6.584\",\"BXD40\":\"6.790\",\"BXD41\":\"x\",\"BXD42\":\"6.536\",\"BXD43\":\"6.476\",\"BXD44\":\"6.545\",\"BXD45\":\"6.742\",\"BXD48\":\"6.393\",\"BXD48a\":\"6.618\",\"BXD49\":\"x\",\"BXD50\":\"6.496\",\"BXD51\":\"6.494\",\"BXD52\":\"x\",\"BXD53\":\"x\",\"BXD54\":\"x\",\"BXD55\":\"6.263\",\"BXD56\":\"x\",\"BXD59\":\"x\",\"BXD60\":\"6.541\",\"BXD61\":\"6.662\",\"BXD62\":\"6.628\",\"BXD63\":\"6.556\",\"BXD64\":\"6.572\",\"BXD65\":\"6.530\",\"BXD65a\":\"6.280\",\"BXD65b\":\"6.490\",\"BXD66\":\"6.608\",\"BXD67\":\"6.534\",\"BXD68\":\"6.352\",\"BXD69\":\"6.548\",\"BXD70\":\"6.520\",\"BXD71\":\"x\",\"BXD72\":\"x\",\"BXD73\":\"6.484\",\"BXD73a\":\"6.486\",\"BXD73b\":\"x\",\"BXD74\":\"6.639\",\"BXD75\":\"6.401\",\"BXD76\":\"6.452\",\"BXD77\":\"6.568\",\"BXD78\":\"x\",\"BXD79\":\"6.642\",\"BXD81\":\"x\",\"BXD83\":\"6.446\",\"BXD84\":\"6.582\",\"BXD85\":\"6.484\",\"BXD86\":\"6.877\",\"BXD87\":\"6.474\",\"BXD88\":\"x\",\"BXD89\":\"6.676\",\"BXD90\":\"6.644\",\"BXD91\":\"x\",\"BXD93\":\"6.620\",\"BXD94\":\"6.528\",\"BXD95\":\"x\",\"BXD98\":\"6.486\",\"BXD99\":\"6.530\",\"BXD100\":\"x\",\"BXD101\":\"x\",\"BXD102\":\"x\",\"BXD104\":\"x\",\"BXD105\":\"x\",\"BXD106\":\"x\",\"BXD107\":\"x\",\"BXD108\":\"x\",\"BXD109\":\"x\",\"BXD110\":\"x\",\"BXD111\":\"x\",\"BXD112\":\"x\",\"BXD113\":\"x\",\"BXD114\":\"x\",\"BXD115\":\"x\",\"BXD116\":\"x\",\"BXD117\":\"x\",\"BXD119\":\"x\",\"BXD120\":\"x\",\"BXD121\":\"x\",\"BXD122\":\"x\",\"BXD123\":\"x\",\"BXD124\":\"x\",\"BXD125\":\"x\",\"BXD126\":\"x\",\"BXD127\":\"x\",\"BXD128\":\"x\",\"BXD128a\":\"x\",\"BXD130\":\"x\",\"BXD131\":\"x\",\"BXD132\":\"x\",\"BXD133\":\"x\",\"BXD134\":\"x\",\"BXD135\":\"x\",\"BXD136\":\"x\",\"BXD137\":\"x\",\"BXD138\":\"x\",\"BXD139\":\"x\",\"BXD141\":\"x\",\"BXD142\":\"x\",\"BXD144\":\"x\",\"BXD145\":\"x\",\"BXD146\":\"x\",\"BXD147\":\"x\",\"BXD148\":\"x\",\"BXD149\":\"x\",\"BXD150\":\"x\",\"BXD151\":\"x\",\"BXD152\":\"x\",\"BXD153\":\"x\",\"BXD154\":\"x\",\"BXD155\":\"x\",\"BXD156\":\"x\",\"BXD157\":\"x\",\"BXD160\":\"x\",\"BXD161\":\"x\",\"BXD162\":\"x\",\"BXD165\":\"x\",\"BXD168\":\"x\",\"BXD169\":\"x\",\"BXD170\":\"x\",\"BXD171\":\"x\",\"BXD172\":\"x\",\"BXD173\":\"x\",\"BXD174\":\"x\",\"BXD175\":\"x\",\"BXD176\":\"x\",\"BXD177\":\"x\",\"BXD178\":\"x\",\"BXD180\":\"x\",\"BXD181\":\"x\",\"BXD183\":\"x\",\"BXD184\":\"x\",\"BXD186\":\"x\",\"BXD187\":\"x\",\"BXD188\":\"x\",\"BXD189\":\"x\",\"BXD190\":\"x\",\"BXD191\":\"x\",\"BXD192\":\"x\",\"BXD193\":\"x\",\"BXD194\":\"x\",\"BXD195\":\"x\",\"BXD196\":\"x\",\"BXD197\":\"x\",\"BXD198\":\"x\",\"BXD199\":\"x\",\"BXD200\":\"x\",\"BXD201\":\"x\",\"BXD202\":\"x\",\"BXD203\":\"x\",\"BXD204\":\"x\",\"BXD205\":\"x\",\"BXD206\":\"x\",\"BXD207\":\"x\",\"BXD208\":\"x\",\"BXD209\":\"x\",\"BXD210\":\"x\",\"BXD211\":\"x\",\"BXD212\":\"x\",\"BXD213\":\"x\",\"BXD214\":\"x\",\"BXD215\":\"x\",\"BXD216\":\"x\",\"BXD217\":\"x\",\"BXD218\":\"x\",\"BXD219\":\"x\",\"BXD220\":\"x\"}", + "corr_type": "lit", + "corr_dataset": "HC_M2_0606_P", + "corr_return_results": "100", + "corr_samples_group": "samples_primary", + "corr_sample_method": "pearson", + "min_expr": "", + "location_type": "gene", + "loc_chr": "", + "min_loc_mb": "", + "max_loc_mb": "", + "p_range_lower": "-0.60", + "p_range_upper": "0.74" +}
\ No newline at end of file diff --git a/tests/unit/correlation/dataset.json b/tests/unit/correlation/dataset.json new file mode 100644 index 0000000..8a53ed5 --- /dev/null +++ b/tests/unit/correlation/dataset.json @@ -0,0 +1,64 @@ +{ + "name":"HC_M2_0606_P", + "id":112, + "shortname":"Hippocampus M430v2 BXD 06/06 PDNN", + "fullname":"Hippocampus Consortium M430v2 (Jun06) PDNN", + "type":"ProbeSet", + "data_scale":"log2", + "search_fields":[ + "Name", + "Description", + "Probe_Target_Description", + "Symbol", + "Alias", + "GenbankId", + "UniGeneId", + "RefSeq_TranscriptId" + ], + "display_fields":[ + "name", + "symbol", + "description", + "probe_target_description", + "chr", + "mb", + "alias", + "geneid", + "genbankid", + "unigeneid", + "omim", + "refseq_transcriptid", + "blatseq", + "targetseq", + "chipid", + "comments", + "strand_probe", + "strand_gene", + "proteinid", + "uniprotid", + "probe_set_target_region", + "probe_set_specificity", + "probe_set_blat_score", + "probe_set_blat_mb_start", + "probe_set_blat_mb_end", + "probe_set_strand", + "probe_set_note_by_rw", + "flag" + ], + "header_fields":[ + "Index", + "Record", + "Symbol", + "Description", + "Location", + "Mean", + "Max LRS", + "Max LRS Location", + "Additive Effect" + ], + "query_for_group":"\n SELECT\n InbredSet.Name, InbredSet.Id, InbredSet.GeneticType\n FROM\n InbredSet, ProbeSetFreeze, ProbeFreeze\n WHERE\n ProbeFreeze.InbredSetId = InbredSet.Id AND\n ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId AND\n ProbeSetFreeze.Name = \"HC_M2_0606_P\"\n ", + "tissue":"Hippocampus mRNA", + "group":"None", + "accession_id":"None", + "species":"None" +}
\ No newline at end of file diff --git a/tests/unit/correlation/expected_correlation_results.json b/tests/unit/correlation/expected_correlation_results.json new file mode 100644 index 0000000..b5bbc2d --- /dev/null +++ b/tests/unit/correlation/expected_correlation_results.json @@ -0,0 +1,1902 @@ +[ + { + "index": 1, + "trait_id": "1415758_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415758_at:HC_M2_0606_P:da50fa1141a7d608ab20", + "symbol": "Fryl", + "description": "furry homolog-like; far 3' UTR", + "location": "Chr5: 72.964984", + "mean": "9.193", + "additive": "-0.081", + "lod_score": "4.4", + "lrs_location": "Chr1: 196.404284", + "sample_r": "-0.407", + "num_overlap": 67, + "sample_p": "6.234e-04", + "lit_corr": "--", + "tissue_corr": "-0.221", + "tissue_pvalue": "2.780e-01" + }, + { + "index": 2, + "trait_id": "1415693_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415693_at:HC_M2_0606_P:0959e913366f559ea22b", + "symbol": "Derl1", + "description": "derlin 1; proximal to mid 3' UTR", + "location": "Chr15: 57.702171", + "mean": "9.445", + "additive": "0.056", + "lod_score": "2.1", + "lrs_location": "Chr1: 193.731996", + "sample_r": "0.398", + "num_overlap": 67, + "sample_p": "8.614e-04", + "lit_corr": "--", + "tissue_corr": "0.114", + "tissue_pvalue": "5.800e-01" + }, + { + "index": 3, + "trait_id": "1415753_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415753_at:HC_M2_0606_P:d75ca42e7fa1613364bb", + "symbol": "Fam108a", + "description": "abhydrolase domain-containing protein FAM108A; last two exons and proximal 3' UTR", + "location": "Chr10: 80.046470", + "mean": "12.731", + "additive": "0.050", + "lod_score": "1.5", + "lrs_location": "ChrX: 103.404884", + "sample_r": "0.384", + "num_overlap": 67, + "sample_p": "1.344e-03", + "lit_corr": "--", + "tissue_corr": "0.108", + "tissue_pvalue": "5.990e-01" + }, + { + "index": 4, + "trait_id": "1415740_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415740_at:HC_M2_0606_P:755cdc41d0d50a03b647", + "symbol": "Psmc5", + "description": "protease (prosome, macropain) 26S subunit, ATPase 5; exons 7, 8, 9", + "location": "Chr11: 106.123450", + "mean": "12.424", + "additive": "0.059", + "lod_score": "2.6", + "lrs_location": "Chr9: 34.013550", + "sample_r": "0.364", + "num_overlap": 67, + "sample_p": "2.476e-03", + "lit_corr": "--", + "tissue_corr": "0.333", + "tissue_pvalue": "9.696e-02" + }, + { + "index": 5, + "trait_id": "1415757_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415757_at:HC_M2_0606_P:8bbf06aa2e3aa5530934", + "symbol": "Gbf1", + "description": "Golgi-specific brefeldin A-resistance factor 1; last exon and proximal 3' UTR", + "location": "Chr19: 46.360410", + "mean": "9.800", + "additive": "-0.062", + "lod_score": "2.0", + "lrs_location": "Chr17: 52.750885", + "sample_r": "0.363", + "num_overlap": 67, + "sample_p": "2.539e-03", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.741e-01" + }, + { + "index": 6, + "trait_id": "1415768_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415768_a_at:HC_M2_0606_P:5e67109eee04f5da3393", + "symbol": "Ube2r2", + "description": "ubiquitin-conjugating enzyme E2R 2", + "location": "Chr4: 41.137929", + "mean": "9.811", + "additive": "-0.087", + "lod_score": "3.3", + "lrs_location": "Chr12: 114.553844", + "sample_r": "-0.312", + "num_overlap": 67, + "sample_p": "1.019e-02", + "lit_corr": "--", + "tissue_corr": "-0.007", + "tissue_pvalue": "9.711e-01" + }, + { + "index": 7, + "trait_id": "1415670_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415670_at:HC_M2_0606_P:4f82d7374f29ebfacaaf", + "symbol": "Copg", + "description": "coatomer protein complex, subunit gamma 1; two of the three last exons and proximal 3' UTR", + "location": "Chr6: 87.859681", + "mean": "11.199", + "additive": "-0.113", + "lod_score": "3.7", + "lrs_location": "Chr1: 157.588921", + "sample_r": "0.305", + "num_overlap": 67, + "sample_p": "1.200e-02", + "lit_corr": "--", + "tissue_corr": "-0.405", + "tissue_pvalue": "4.032e-02" + }, + { + "index": 8, + "trait_id": "1415742_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415742_at:HC_M2_0606_P:b72a582a1f840a18c3e7", + "symbol": "Aup1", + "description": "ancient ubiquitous protein 1", + "location": "Chr6: 83.006784", + "mean": "9.529", + "additive": "-0.062", + "lod_score": "2.4", + "lrs_location": "Chr19: 16.955950", + "sample_r": "0.295", + "num_overlap": 67, + "sample_p": "1.523e-02", + "lit_corr": "--", + "tissue_corr": "-0.033", + "tissue_pvalue": "8.716e-01" + }, + { + "index": 9, + "trait_id": "1415743_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415743_at:HC_M2_0606_P:3187245a079e824b4236", + "symbol": "Hdac5", + "description": "histone deacetylase 5; last four exons", + "location": "Chr11: 102.057397", + "mean": "11.009", + "additive": "0.081", + "lod_score": "2.1", + "lrs_location": "Chr7: 125.263073", + "sample_r": "0.285", + "num_overlap": 67, + "sample_p": "1.950e-02", + "lit_corr": "--", + "tissue_corr": "0.005", + "tissue_pvalue": "9.823e-01" + }, + { + "index": 10, + "trait_id": "1415690_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415690_at:HC_M2_0606_P:603b215ede00b6fe1104", + "symbol": "Mrp127", + "description": "39S ribosomal protein L27, mitochondrial; last three exons", + "location": "Chr11: 94.517922", + "mean": "12.569", + "additive": "0.063", + "lod_score": "1.9", + "lrs_location": "Chr2: 164.779024", + "sample_r": "0.266", + "num_overlap": 67, + "sample_p": "2.986e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 11, + "trait_id": "1415727_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415727_at:HC_M2_0606_P:cb40b8cba0eee75781a6", + "symbol": "Apoa1bp", + "description": "apolipoprotein A-I binding protein; exons 3 through 6", + "location": "Chr3: 87.860534", + "mean": "11.707", + "additive": "-0.076", + "lod_score": "2.8", + "lrs_location": "Chr3: 56.295375", + "sample_r": "0.263", + "num_overlap": 67, + "sample_p": "3.136e-02", + "lit_corr": "--", + "tissue_corr": "-0.535", + "tissue_pvalue": "4.841e-03" + }, + { + "index": 12, + "trait_id": "1415730_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415730_at:HC_M2_0606_P:a970e0610a56ac4aba27", + "symbol": "Cpsf7", + "description": "cleavage and polyadenylation specificity factor 7; distal 3' UTR (transQTL on Chr 4 in BXD eye data)", + "location": "Chr19: 10.621618", + "mean": "10.662", + "additive": "-0.048", + "lod_score": "2.1", + "lrs_location": "Chr1: 188.085707", + "sample_r": "-0.263", + "num_overlap": 67, + "sample_p": "3.164e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 13, + "trait_id": "1415741_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415741_at:HC_M2_0606_P:033752be361d32960c29", + "symbol": "Tmem165", + "description": "transmembrane protein 165; 3' UTR", + "location": "Chr5: 76.637708", + "mean": "10.974", + "additive": "0.048", + "lod_score": "2.0", + "lrs_location": "Chr4: 5.606394", + "sample_r": "-0.258", + "num_overlap": 67, + "sample_p": "3.489e-02", + "lit_corr": "--", + "tissue_corr": "0.271", + "tissue_pvalue": "1.812e-01" + }, + { + "index": 14, + "trait_id": "1415725_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415725_at:HC_M2_0606_P:fbd6458be4f8ccbf1dc0", + "symbol": "Rrn3", + "description": "RRN3 RNA polymerase I transcription factor homolog (yeast)", + "location": "Chr16: 13.814359", + "mean": "9.195", + "additive": "-0.085", + "lod_score": "2.8", + "lrs_location": "Chr1: 148.717644", + "sample_r": "0.256", + "num_overlap": 67, + "sample_p": "3.636e-02", + "lit_corr": "--", + "tissue_corr": "0.587", + "tissue_pvalue": "1.621e-03" + }, + { + "index": 15, + "trait_id": "1415717_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415717_at:HC_M2_0606_P:dd51438830e4033114f8", + "symbol": "Rnf220", + "description": "ring finger protein 220; mid 3' UTR", + "location": "Chr4: 116.944155", + "mean": "10.778", + "additive": "-0.084", + "lod_score": "2.4", + "lrs_location": "Chr4: 122.536808", + "sample_r": "0.242", + "num_overlap": 67, + "sample_p": "4.816e-02", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 16, + "trait_id": "1415703_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415703_at:HC_M2_0606_P:51ee8e47654845a546f0", + "symbol": "Huwe1", + "description": "HECT, UBA and WWE domain containing 1; last 3 exons and proximal 3' UTR", + "location": "ChrX: 148.367136", + "mean": "11.335", + "additive": "-0.094", + "lod_score": "2.3", + "lrs_location": "Chr1: 135.891043", + "sample_r": "0.235", + "num_overlap": 67, + "sample_p": "5.541e-02", + "lit_corr": "--", + "tissue_corr": "0.528", + "tissue_pvalue": "5.576e-03" + }, + { + "index": 17, + "trait_id": "1415748_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415748_a_at:HC_M2_0606_P:749a2279081b54e89885", + "symbol": "Dctn5", + "description": "dynactin 5; last exon and proximal half of 3' UTR", + "location": "Chr7: 129.291923", + "mean": "11.250", + "additive": "0.071", + "lod_score": "3.4", + "lrs_location": "Chr5: 138.337847", + "sample_r": "0.230", + "num_overlap": 67, + "sample_p": "6.133e-02", + "lit_corr": "--", + "tissue_corr": "0.064", + "tissue_pvalue": "7.557e-01" + }, + { + "index": 18, + "trait_id": "1415706_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415706_at:HC_M2_0606_P:ddfffdb78d0ff84d6a1a", + "symbol": "Copa", + "description": "coatomer protein complex, subunit alpha; 3' UTR", + "location": "Chr1: 174.051912", + "mean": "12.577", + "additive": "-0.143", + "lod_score": "8.7", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.224", + "num_overlap": 67, + "sample_p": "6.829e-02", + "lit_corr": "--", + "tissue_corr": "-0.147", + "tissue_pvalue": "4.739e-01" + }, + { + "index": 19, + "trait_id": "1415696_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415696_at:HC_M2_0606_P:da00b2667d7c27dc76a2", + "symbol": "Sar1a", + "description": "SAR1 gene homolog A; distal 3' UTR", + "location": "Chr10: 61.155492", + "mean": "11.447", + "additive": "-0.051", + "lod_score": "2.4", + "lrs_location": "Chr15: 87.788313", + "sample_r": "0.220", + "num_overlap": 67, + "sample_p": "7.356e-02", + "lit_corr": "--", + "tissue_corr": "-0.559", + "tissue_pvalue": "3.015e-03" + }, + { + "index": 20, + "trait_id": "1415731_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415731_at:HC_M2_0606_P:9e91e97ca1001091a5f3", + "symbol": "Angel2", + "description": "angel homolog 2; distal 3' UTR", + "location": "Chr1: 192.769800", + "mean": "9.490", + "additive": "0.062", + "lod_score": "2.6", + "lrs_location": "Chr14: 124.508018", + "sample_r": "0.218", + "num_overlap": 67, + "sample_p": "7.623e-02", + "lit_corr": "--", + "tissue_corr": "0.232", + "tissue_pvalue": "2.544e-01" + }, + { + "index": 21, + "trait_id": "1415750_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415750_at:HC_M2_0606_P:c9f757736d57e5f23aa5", + "symbol": "Tbl3", + "description": "transducin (beta)-like 3", + "location": "Chr17: 24.838067", + "mean": "8.703", + "additive": "-0.132", + "lod_score": "10.0", + "lrs_location": "Chr17: 23.322636", + "sample_r": "0.213", + "num_overlap": 67, + "sample_p": "8.332e-02", + "lit_corr": "--", + "tissue_corr": "0.312", + "tissue_pvalue": "1.211e-01" + }, + { + "index": 22, + "trait_id": "1415680_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415680_at:HC_M2_0606_P:22e90a54261cb373975e", + "symbol": "Anapc1", + "description": "anaphase promoting complex subunit 1; last 3 exons and 3' UTR", + "location": "Chr2: 128.438499", + "mean": "9.180", + "additive": "-0.102", + "lod_score": "8.7", + "lrs_location": "Chr2: 125.304784", + "sample_r": "-0.210", + "num_overlap": 67, + "sample_p": "8.734e-02", + "lit_corr": "--", + "tissue_corr": "0.367", + "tissue_pvalue": "6.539e-02" + }, + { + "index": 23, + "trait_id": "1415712_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415712_at:HC_M2_0606_P:48e284402cb79a5fbede", + "symbol": "Zranb1", + "description": "zinc finger, RAN-binding domain containing 1 (ubiquitin thioesterase, TRAF-binding protein); far 3' UTR (M430AB control duplicate)", + "location": "Chr7: 140.175988", + "mean": "9.923", + "additive": "-0.079", + "lod_score": "2.8", + "lrs_location": "Chr5: 143.642242", + "sample_r": "-0.208", + "num_overlap": 67, + "sample_p": "9.125e-02", + "lit_corr": "--", + "tissue_corr": "-0.068", + "tissue_pvalue": "7.413e-01" + }, + { + "index": 24, + "trait_id": "1415674_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415674_a_at:HC_M2_0606_P:c8e7fb1fcad21d73fcfd", + "symbol": "Trappc4", + "description": "trafficking protein particle complex 4; exons 3 and 4", + "location": "Chr9: 44.212489", + "mean": "10.760", + "additive": "-0.065", + "lod_score": "3.3", + "lrs_location": "Chr5: 69.527298", + "sample_r": "0.201", + "num_overlap": 67, + "sample_p": "1.028e-01", + "lit_corr": "--", + "tissue_corr": "-0.334", + "tissue_pvalue": "9.587e-02" + }, + { + "index": 25, + "trait_id": "1415747_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415747_s_at:HC_M2_0606_P:5d86584be55f6cec47ab", + "symbol": "Riok3", + "description": "RIO kinase 3 (yeast); mid to distal 3' UTR", + "location": "Chr18: 12.314783", + "mean": "10.906", + "additive": "0.068", + "lod_score": "2.1", + "lrs_location": "Chr4: 13.764991", + "sample_r": "-0.198", + "num_overlap": 67, + "sample_p": "1.081e-01", + "lit_corr": "--", + "tissue_corr": "0.282", + "tissue_pvalue": "1.628e-01" + }, + { + "index": 26, + "trait_id": "1415682_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415682_at:HC_M2_0606_P:d02febdf17a279a71088", + "symbol": "Xpo7", + "description": "exportin 7", + "location": "Chr14: 71.064730", + "mean": "9.075", + "additive": "-0.073", + "lod_score": "2.8", + "lrs_location": "Chr17: 68.421021", + "sample_r": "0.197", + "num_overlap": 67, + "sample_p": "1.092e-01", + "lit_corr": "--", + "tissue_corr": "-0.322", + "tissue_pvalue": "1.084e-01" + }, + { + "index": 27, + "trait_id": "1415732_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415732_at:HC_M2_0606_P:c0010f5b42f210874883", + "symbol": "Abhd16a", + "description": "abhydrolase domain containing 16A; last five exons including proximal 3' UTR", + "location": "Chr17: 35.238940", + "mean": "10.798", + "additive": "-0.132", + "lod_score": "6.1", + "lrs_location": "Chr17: 37.015392", + "sample_r": "0.177", + "num_overlap": 67, + "sample_p": "1.527e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 28, + "trait_id": "1415688_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415688_at:HC_M2_0606_P:4c3b6c7cd3d447f2346c", + "symbol": "Ube2g1", + "description": "ubiquitin-conjugating enzyme E2 G1; mid to distal 3' UTR", + "location": "Chr11: 72.497627", + "mean": "11.494", + "additive": "-0.116", + "lod_score": "7.1", + "lrs_location": "Chr11: 72.486317", + "sample_r": "-0.173", + "num_overlap": 67, + "sample_p": "1.605e-01", + "lit_corr": "--", + "tissue_corr": "0.365", + "tissue_pvalue": "6.671e-02" + }, + { + "index": 29, + "trait_id": "1415698_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415698_at:HC_M2_0606_P:4d8988a8fac8bdbce9c2", + "symbol": "Golm1", + "description": "Golgi membrane protein 1; distal 3' UTR", + "location": "Chr13: 59.736417", + "mean": "11.367", + "additive": "0.113", + "lod_score": "2.9", + "lrs_location": "Chr7: 36.124856", + "sample_r": "0.151", + "num_overlap": 67, + "sample_p": "2.221e-01", + "lit_corr": "--", + "tissue_corr": "-0.053", + "tissue_pvalue": "7.958e-01" + }, + { + "index": 30, + "trait_id": "1415697_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415697_at:HC_M2_0606_P:ab18358c61fbc03fdf13", + "symbol": "G3bp2", + "description": "GTPase activating protein (SH3 domain) binding protein 2; mid proximal 3' UTR", + "location": "Chr5: 92.482845", + "mean": "10.768", + "additive": "0.137", + "lod_score": "3.6", + "lrs_location": "Chr5: 138.337847", + "sample_r": "0.142", + "num_overlap": 67, + "sample_p": "2.504e-01", + "lit_corr": "--", + "tissue_corr": "0.107", + "tissue_pvalue": "6.032e-01" + }, + { + "index": 31, + "trait_id": "1415676_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415676_a_at:HC_M2_0606_P:b236ce0b2af4408662b6", + "symbol": "Psmb5", + "description": "proteasome (prosome, macropain) subunit, beta type 5; coding exons 2 and 3", + "location": "Chr14: 55.233131", + "mean": "14.199", + "additive": "0.130", + "lod_score": "6.9", + "lrs_location": "Chr14: 54.987777", + "sample_r": "-0.136", + "num_overlap": 67, + "sample_p": "2.725e-01", + "lit_corr": "--", + "tissue_corr": "0.152", + "tissue_pvalue": "4.580e-01" + }, + { + "index": 32, + "trait_id": "1415723_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415723_at:HC_M2_0606_P:8672294efc1c30e220c2", + "symbol": "Eif5", + "description": "eukaryotic translation initiation factor 5; distal 3' UTR", + "location": "Chr12: 112.784258", + "mean": "12.507", + "additive": "-0.196", + "lod_score": "12.9", + "lrs_location": "Chr12: 112.426348", + "sample_r": "-0.134", + "num_overlap": 67, + "sample_p": "2.795e-01", + "lit_corr": "--", + "tissue_corr": "0.105", + "tissue_pvalue": "6.104e-01" + }, + { + "index": 33, + "trait_id": "1415692_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415692_s_at:HC_M2_0606_P:a30c9243d16dd6d28826", + "symbol": "Canx", + "description": "calnexin; mid 3' UTR", + "location": "Chr11: 50.108505", + "mean": "13.862", + "additive": "0.090", + "lod_score": "3.3", + "lrs_location": "Chr9: 15.693672", + "sample_r": "0.133", + "num_overlap": 67, + "sample_p": "2.828e-01", + "lit_corr": "--", + "tissue_corr": "0.298", + "tissue_pvalue": "1.388e-01" + }, + { + "index": 34, + "trait_id": "1415728_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415728_at:HC_M2_0606_P:449a770634eff3bac9f5", + "symbol": "Pabpn1", + "description": "polyadenylate-binding protein 2; far 3' UTR", + "location": "Chr14: 55.517242", + "mean": "10.510", + "additive": "0.150", + "lod_score": "2.3", + "lrs_location": "Chr19: 53.933992", + "sample_r": "-0.130", + "num_overlap": 67, + "sample_p": "2.942e-01", + "lit_corr": "--", + "tissue_corr": "0.132", + "tissue_pvalue": "5.194e-01" + }, + { + "index": 35, + "trait_id": "1415675_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415675_at:HC_M2_0606_P:9712db695d534370b0d9", + "symbol": "Dpm2", + "description": "dolichol-phosphate (beta-D) mannosyltransferase 2; last exon and proximal to mid 3' UTR", + "location": "Chr2: 32.428524", + "mean": "10.207", + "additive": "-0.043", + "lod_score": "2.6", + "lrs_location": "Chr13: 30.769380", + "sample_r": "-0.129", + "num_overlap": 67, + "sample_p": "2.966e-01", + "lit_corr": "--", + "tissue_corr": "0.102", + "tissue_pvalue": "6.201e-01" + }, + { + "index": 36, + "trait_id": "1415721_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415721_a_at:HC_M2_0606_P:fd804230fcc3400d6b4b", + "symbol": "Naa60", + "description": "N(alpha)-acetyltransferase 60, NatF catalytic subunit; distal 3' UTR", + "location": "Chr16: 3.904169", + "mean": "10.153", + "additive": "-0.059", + "lod_score": "3.6", + "lrs_location": "Chr2: 159.368724", + "sample_r": "0.128", + "num_overlap": 67, + "sample_p": "3.004e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 37, + "trait_id": "1415733_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415733_a_at:HC_M2_0606_P:4eff33f3ecd4c0dd418e", + "symbol": "Shb", + "description": "Src homology 2 domain containing adaptor protein B; putative far 3' UTR (or intercalated neighbor)", + "location": "Chr4: 45.118127", + "mean": "10.756", + "additive": "-0.044", + "lod_score": "1.9", + "lrs_location": "Chr5: 69.527298", + "sample_r": "0.126", + "num_overlap": 67, + "sample_p": "3.103e-01", + "lit_corr": "--", + "tissue_corr": "0.149", + "tissue_pvalue": "4.678e-01" + }, + { + "index": 38, + "trait_id": "1415720_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415720_s_at:HC_M2_0606_P:4e7dab211ec586e8297a", + "symbol": "Mad2l1bp", + "description": "mitotic arrest deficient 2, homolog-like 1 (MAD2L1) binding protein; last exon and 3' UTR", + "location": "Chr17: 46.284624", + "mean": "7.057", + "additive": "0.048", + "lod_score": "2.5", + "lrs_location": "Chr8: 33.934048", + "sample_r": "0.122", + "num_overlap": 67, + "sample_p": "3.262e-01", + "lit_corr": "--", + "tissue_corr": "0.463", + "tissue_pvalue": "1.709e-02" + }, + { + "index": 39, + "trait_id": "1415767_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415767_at:HC_M2_0606_P:3e5a802a95121f3ffa1f", + "symbol": "Ythdf1", + "description": "YTH domain family, member 1; mid 3' UTR", + "location": "Chr2: 180.639551", + "mean": "10.902", + "additive": "-0.051", + "lod_score": "2.2", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.120", + "num_overlap": 67, + "sample_p": "3.325e-01", + "lit_corr": "--", + "tissue_corr": "0.382", + "tissue_pvalue": "5.396e-02" + }, + { + "index": 40, + "trait_id": "1415762_x_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415762_x_at:HC_M2_0606_P:978ad700958782192aa2", + "symbol": "Mrpl52", + "description": "mitochondrial ribosomal protein L52", + "location": "Chr14: 55.045789", + "mean": "10.926", + "additive": "0.086", + "lod_score": "2.5", + "lrs_location": "Chr1: 190.087097", + "sample_r": "0.118", + "num_overlap": 67, + "sample_p": "3.406e-01", + "lit_corr": "--", + "tissue_corr": "0.395", + "tissue_pvalue": "4.585e-02" + }, + { + "index": 41, + "trait_id": "1415736_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415736_at:HC_M2_0606_P:c9bd62acd0c2cc087606", + "symbol": "Pfdn5", + "description": "prefoldin 5", + "location": "Chr15: 102.156651", + "mean": "13.571", + "additive": "0.095", + "lod_score": "2.3", + "lrs_location": "Chr10: 5.378622", + "sample_r": "0.118", + "num_overlap": 67, + "sample_p": "3.418e-01", + "lit_corr": "--", + "tissue_corr": "-0.261", + "tissue_pvalue": "1.975e-01" + }, + { + "index": 42, + "trait_id": "1415704_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415704_a_at:HC_M2_0606_P:a05982c0214ff2dc2a40", + "symbol": "Cdv3", + "description": "carnitine deficiency-associated gene expressed in ventricle 3", + "location": "Chr9: 103.255487", + "mean": "10.994", + "additive": "0.060", + "lod_score": "3.1", + "lrs_location": "Chr3: 10.018672", + "sample_r": "-0.115", + "num_overlap": 67, + "sample_p": "3.539e-01", + "lit_corr": "--", + "tissue_corr": "0.598", + "tissue_pvalue": "1.246e-03" + }, + { + "index": 43, + "trait_id": "1415699_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415699_a_at:HC_M2_0606_P:8a5c52aea60cad17e29c", + "symbol": "Gps1", + "description": "G protein pathway suppressor 1 (COP9 signalosome complex subunit 1)", + "location": "Chr11: 120.649820", + "mean": "12.033", + "additive": "0.065", + "lod_score": "3.4", + "lrs_location": "Chr11: 62.910461", + "sample_r": "-0.114", + "num_overlap": 67, + "sample_p": "3.575e-01", + "lit_corr": "--", + "tissue_corr": "0.150", + "tissue_pvalue": "4.638e-01" + }, + { + "index": 44, + "trait_id": "1415739_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415739_at:HC_M2_0606_P:c5e8b34713057f53dd07", + "symbol": "Rbm42", + "description": "RNA-binding motif protein 42; exon 7 and 3' UTR", + "location": "Chr7: 31.426055", + "mean": "10.926", + "additive": "-0.154", + "lod_score": "12.8", + "lrs_location": "Chr1: 174.792334", + "sample_r": "0.107", + "num_overlap": 67, + "sample_p": "3.898e-01", + "lit_corr": "--", + "tissue_corr": "0.550", + "tissue_pvalue": "3.580e-03" + }, + { + "index": 45, + "trait_id": "1415695_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415695_at:HC_M2_0606_P:44556cafdf6f5e38669b", + "symbol": "Psma1", + "description": "proteasome (prosome, macropain) subunit, alpha type 1; last four exons and proximal 3' UTR", + "location": "Chr7: 121.408358", + "mean": "12.346", + "additive": "-0.081", + "lod_score": "3.1", + "lrs_location": "Chr12: 29.344230", + "sample_r": "-0.106", + "num_overlap": 67, + "sample_p": "3.925e-01", + "lit_corr": "--", + "tissue_corr": "0.274", + "tissue_pvalue": "1.763e-01" + }, + { + "index": 46, + "trait_id": "1415745_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415745_a_at:HC_M2_0606_P:0178fc19ada3ba0179fb", + "symbol": "Dscr3", + "description": "Down syndrome critical region protein 3", + "location": "Chr16: 94.719451", + "mean": "9.329", + "additive": "0.071", + "lod_score": "2.2", + "lrs_location": "Chr4: 19.960179", + "sample_r": "-0.102", + "num_overlap": 67, + "sample_p": "4.133e-01", + "lit_corr": "--", + "tissue_corr": "-0.138", + "tissue_pvalue": "5.025e-01" + }, + { + "index": 47, + "trait_id": "1415763_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415763_a_at:HC_M2_0606_P:489dea4b682a7f0b5dc4", + "symbol": "Tmem234", + "description": "transmembrane protein 234; far 3' UTR", + "location": "Chr4: 129.285471", + "mean": "11.370", + "additive": "-0.080", + "lod_score": "2.7", + "lrs_location": "Chr19: 36.251059", + "sample_r": "-0.099", + "num_overlap": 67, + "sample_p": "4.274e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 48, + "trait_id": "1415707_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415707_at:HC_M2_0606_P:44193c047da5c37a307d", + "symbol": "Anapc2", + "description": "anaphase promoting complex subunit 2; last two exons and proximal 3' UTR", + "location": "Chr2: 25.140684", + "mean": "10.044", + "additive": "0.057", + "lod_score": "3.0", + "lrs_location": "Chr11: 76.761051", + "sample_r": "-0.096", + "num_overlap": 67, + "sample_p": "4.378e-01", + "lit_corr": "--", + "tissue_corr": "-0.121", + "tissue_pvalue": "5.551e-01" + }, + { + "index": 49, + "trait_id": "1415716_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415716_a_at:HC_M2_0606_P:c453f863ce1446551a6c", + "symbol": "Rps27", + "description": "ribosomal protein S27; last two exons and proximal 3' UTR", + "location": "Chr3: 90.016627", + "mean": "15.694", + "additive": "0.132", + "lod_score": "3.2", + "lrs_location": "Chr1: 165.315110", + "sample_r": "0.092", + "num_overlap": 67, + "sample_p": "4.594e-01", + "lit_corr": "--", + "tissue_corr": "0.150", + "tissue_pvalue": "4.654e-01" + }, + { + "index": 50, + "trait_id": "1415769_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415769_at:HC_M2_0606_P:564c4d3bb19aca88c74b", + "symbol": "Itch", + "description": "itchy, E3 ubiquitin protein ligase; distal 3' UTR", + "location": "Chr2: 155.052012", + "mean": "9.460", + "additive": "0.057", + "lod_score": "2.5", + "lrs_location": "Chr7: 56.652492", + "sample_r": "0.087", + "num_overlap": 67, + "sample_p": "4.833e-01", + "lit_corr": "--", + "tissue_corr": "0.373", + "tissue_pvalue": "6.074e-02" + }, + { + "index": 51, + "trait_id": "1415761_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415761_at:HC_M2_0606_P:744c009738648980b1a3", + "symbol": "Mrpl52", + "description": "mitochondrial ribosomal protein L52; all five exons", + "location": "Chr14: 55.045789", + "mean": "10.635", + "additive": "0.099", + "lod_score": "2.9", + "lrs_location": "Chr4: 155.235046", + "sample_r": "0.085", + "num_overlap": 67, + "sample_p": "4.953e-01", + "lit_corr": "--", + "tissue_corr": "0.395", + "tissue_pvalue": "4.585e-02" + }, + { + "index": 52, + "trait_id": "1415746_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415746_at:HC_M2_0606_P:fed140f95a21fef772a2", + "symbol": "Cic", + "description": "capicua transcriptional repressor", + "location": "Chr7: 26.078638", + "mean": "12.178", + "additive": "-0.115", + "lod_score": "2.0", + "lrs_location": "Chr11: 64.909098", + "sample_r": "-0.082", + "num_overlap": 67, + "sample_p": "5.099e-01", + "lit_corr": "--", + "tissue_corr": "0.263", + "tissue_pvalue": "1.949e-01" + }, + { + "index": 53, + "trait_id": "1415759_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415759_a_at:HC_M2_0606_P:a27045c52162a32061e0", + "symbol": "Hbxip", + "description": "hepatitis B virus x-interacting protein (binds C-terminus of hepatitis B virus X protein, HBx); last two exons and 3' UTR", + "location": "Chr3: 107.084847", + "mean": "11.029", + "additive": "-0.205", + "lod_score": "13.4", + "lrs_location": "Chr3: 108.822022", + "sample_r": "0.081", + "num_overlap": 67, + "sample_p": "5.170e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 54, + "trait_id": "1415705_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415705_at:HC_M2_0606_P:84786a1fa09230a4b766", + "symbol": "Smim7", + "description": "small integral membrane protein 7", + "location": "Chr8: 75.089847", + "mean": "10.144", + "additive": "-0.106", + "lod_score": "4.3", + "lrs_location": "Chr1: 172.981863", + "sample_r": "-0.070", + "num_overlap": 67, + "sample_p": "5.723e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 55, + "trait_id": "1415708_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415708_at:HC_M2_0606_P:4c91e4736226606aa737", + "symbol": "Tug1", + "description": "taurine upregulated gene 1; distal 3' UTR", + "location": "Chr11: 3.540066", + "mean": "11.596", + "additive": "-0.093", + "lod_score": "4.0", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.070", + "num_overlap": 67, + "sample_p": "5.733e-01", + "lit_corr": "--", + "tissue_corr": "0.612", + "tissue_pvalue": "8.850e-04" + }, + { + "index": 56, + "trait_id": "1415766_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415766_at:HC_M2_0606_P:204ca6dc37a14c02d1c5", + "symbol": "Sec22l1", + "description": "SEC22 vesicle trafficking protein-like 1; distal 3' UTR", + "location": "Chr3: 97.726622", + "mean": "10.619", + "additive": "0.055", + "lod_score": "2.0", + "lrs_location": "Chr1: 183.936095", + "sample_r": "0.070", + "num_overlap": 67, + "sample_p": "5.757e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 57, + "trait_id": "1415722_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415722_a_at:HC_M2_0606_P:c5fd27526c57d8c3fd4b", + "symbol": "Vta1", + "description": "Vps20-associated 1; last two exons and proximal 3' UTR", + "location": "Chr10: 14.375393", + "mean": "10.716", + "additive": "-0.076", + "lod_score": "6.1", + "lrs_location": "Chr10: 5.378622", + "sample_r": "0.065", + "num_overlap": 67, + "sample_p": "6.012e-01", + "lit_corr": "--", + "tissue_corr": "0.421", + "tissue_pvalue": "3.209e-02" + }, + { + "index": 58, + "trait_id": "1415689_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415689_s_at:HC_M2_0606_P:a70dcbef5742da689bc1", + "symbol": "Zkscan3", + "description": "zinc finger with KRAB and SCAN domains 3 (human ZKSCAN4); mid 3' UTR", + "location": "Chr13: 21.479302", + "mean": "8.611", + "additive": "0.064", + "lod_score": "1.9", + "lrs_location": "Chr4: 154.365177", + "sample_r": "-0.064", + "num_overlap": 67, + "sample_p": "6.046e-01", + "lit_corr": "--", + "tissue_corr": "0.552", + "tissue_pvalue": "3.454e-03" + }, + { + "index": 59, + "trait_id": "1415754_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415754_at:HC_M2_0606_P:e5bf579fd7db6c886098", + "symbol": "Polr2f", + "description": "polymerase (RNA) II (DNA directed) polypeptide F; 5' UTR and exons 1, 2, and 4", + "location": "Chr15: 78.971834", + "mean": "10.742", + "additive": "0.058", + "lod_score": "2.4", + "lrs_location": "Chr1: 189.435367", + "sample_r": "0.062", + "num_overlap": 67, + "sample_p": "6.167e-01", + "lit_corr": "--", + "tissue_corr": "-0.181", + "tissue_pvalue": "3.755e-01" + }, + { + "index": 60, + "trait_id": "1415765_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415765_at:HC_M2_0606_P:01b87826e23dea53f4fb", + "symbol": "Hnrpul2", + "description": "heterogeneous nuclear ribonucleoprotein U-like 2 (similar to ubiquitin carboxyl-terminal hydrolase 21); 3' UTR", + "location": "Chr19: 8.905975", + "mean": "9.165", + "additive": "-0.091", + "lod_score": "2.9", + "lrs_location": "Chr6: 98.258572", + "sample_r": "-0.061", + "num_overlap": 67, + "sample_p": "6.259e-01", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.728e-01" + }, + { + "index": 61, + "trait_id": "1415714_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415714_a_at:HC_M2_0606_P:24547c4d8e0d33203c93", + "symbol": "Snrnp27", + "description": "small nuclear ribonucleoprotein 27 kDa (U4/U6.U5); exons 3 and 4", + "location": "Chr6: 86.630900", + "mean": "12.255", + "additive": "0.076", + "lod_score": "3.3", + "lrs_location": "Chr5: 138.337847", + "sample_r": "-0.059", + "num_overlap": 67, + "sample_p": "6.375e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 62, + "trait_id": "1415760_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415760_s_at:HC_M2_0606_P:8c46a844ccc841978948", + "symbol": "Atox1", + "description": "ATX1 (antioxidant protein 1) homolog 1; last two exons and proximal 3' UTR", + "location": "Chr11: 55.263981", + "mean": "11.035", + "additive": "0.077", + "lod_score": "1.8", + "lrs_location": "Chr9: 49.215835", + "sample_r": "-0.056", + "num_overlap": 67, + "sample_p": "6.511e-01", + "lit_corr": "--", + "tissue_corr": "-0.243", + "tissue_pvalue": "2.324e-01" + }, + { + "index": 63, + "trait_id": "1415734_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415734_at:HC_M2_0606_P:aa7f07dc0f541cde5715", + "symbol": "Rab7", + "description": "RAB7, member RAS oncogene family (Charcot-Marie-Tooth (CMT) type 2)", + "location": "Chr6: 87.949145", + "mean": "13.802", + "additive": "-0.053", + "lod_score": "2.3", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.054", + "num_overlap": 67, + "sample_p": "6.618e-01", + "lit_corr": "--", + "tissue_corr": "0.054", + "tissue_pvalue": "7.921e-01" + }, + { + "index": 64, + "trait_id": "1415719_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415719_s_at:HC_M2_0606_P:90fe587b88df98f034a9", + "symbol": "Armc1", + "description": "armadillo repeat containing 1; distal 3' UTR", + "location": "Chr3: 19.032212", + "mean": "11.373", + "additive": "-0.193", + "lod_score": "17.0", + "lrs_location": "Chr3: 19.544553", + "sample_r": "-0.053", + "num_overlap": 67, + "sample_p": "6.680e-01", + "lit_corr": "--", + "tissue_corr": "0.305", + "tissue_pvalue": "1.296e-01" + }, + { + "index": 65, + "trait_id": "1415677_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415677_at:HC_M2_0606_P:0b0c1af1012288383c27", + "symbol": "Dhrs1", + "description": "dehydrogenase/reductase (SDR family) member 1; last four exons", + "location": "Chr14: 56.358423", + "mean": "10.640", + "additive": "0.070", + "lod_score": "4.3", + "lrs_location": "Chr1: 29.231425", + "sample_r": "0.052", + "num_overlap": 67, + "sample_p": "6.785e-01", + "lit_corr": "--", + "tissue_corr": "-0.238", + "tissue_pvalue": "2.422e-01" + }, + { + "index": 66, + "trait_id": "1415756_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415756_a_at:HC_M2_0606_P:c5252e44b226f6bfb751", + "symbol": "Snapap", + "description": "SNAP-associated protein; mid 3' UTR", + "location": "Chr3: 90.292659", + "mean": "9.902", + "additive": "-0.155", + "lod_score": "9.4", + "lrs_location": "Chr3: 89.894692", + "sample_r": "-0.052", + "num_overlap": 67, + "sample_p": "6.788e-01", + "lit_corr": "--", + "tissue_corr": "0.179", + "tissue_pvalue": "3.809e-01" + }, + { + "index": 67, + "trait_id": "1415678_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415678_at:HC_M2_0606_P:04b17c5b061ad6e8904b", + "symbol": "Ppm1a", + "description": "protein phosphatase 1A, magnesium dependent; 3' UTR", + "location": "Chr12: 73.894951", + "mean": "11.586", + "additive": "-0.075", + "lod_score": "3.4", + "lrs_location": "Chr12: 76.396441", + "sample_r": "-0.051", + "num_overlap": 67, + "sample_p": "6.841e-01", + "lit_corr": "--", + "tissue_corr": "-0.099", + "tissue_pvalue": "6.295e-01" + }, + { + "index": 68, + "trait_id": "1415709_s_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415709_s_at:HC_M2_0606_P:4b91fccf51bc6263dcae", + "symbol": "Gbf1", + "description": "Golgi-specific brefeldin A-resistance factor 1", + "location": "Chr19: 46.360511", + "mean": "9.342", + "additive": "0.056", + "lod_score": "3.6", + "lrs_location": "ChrX: 81.842525", + "sample_r": "0.050", + "num_overlap": 67, + "sample_p": "6.863e-01", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.741e-01" + }, + { + "index": 69, + "trait_id": "1415671_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415671_at:HC_M2_0606_P:c3cd4876e293def795bf", + "symbol": "Atp6v0d1", + "description": "ATPase, H+ transporting, lysosomal 38kDa, V0 subunit d1", + "location": "Chr8: 108.048521", + "mean": "13.278", + "additive": "-0.080", + "lod_score": "3.7", + "lrs_location": "Chr19: 13.033814", + "sample_r": "-0.050", + "num_overlap": 67, + "sample_p": "6.898e-01", + "lit_corr": "--", + "tissue_corr": "-0.284", + "tissue_pvalue": "1.593e-01" + }, + { + "index": 70, + "trait_id": "1415752_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415752_at:HC_M2_0606_P:4db5c0fbe608b70cb257", + "symbol": "C18orf32", + "description": "putative NF-kappa-B-activating protein 200, C18orf32; 3' UTR", + "location": "Chr18: 75.169011", + "mean": "12.815", + "additive": "0.093", + "lod_score": "5.3", + "lrs_location": "Chr18: 75.843607", + "sample_r": "-0.048", + "num_overlap": 67, + "sample_p": "6.997e-01", + "lit_corr": "--", + "tissue_corr": "-0.378", + "tissue_pvalue": "5.664e-02" + }, + { + "index": 71, + "trait_id": "1415749_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415749_a_at:HC_M2_0606_P:7d00997b6e9b339f534d", + "symbol": "Rragc", + "description": "Ras-related GTP binding C; mid-distal 3' UTR", + "location": "Chr4: 123.613693", + "mean": "11.140", + "additive": "-0.057", + "lod_score": "2.2", + "lrs_location": "Chr12: 76.396441", + "sample_r": "-0.044", + "num_overlap": 67, + "sample_p": "7.244e-01", + "lit_corr": "--", + "tissue_corr": "-0.158", + "tissue_pvalue": "4.411e-01" + }, + { + "index": 72, + "trait_id": "1415673_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415673_at:HC_M2_0606_P:6eb18e73a45c97c7f8d0", + "symbol": "Psph", + "description": "phosphoserine phosphatase; last three exons and distal 3' UTR", + "location": "Chr5: 130.271465", + "mean": "9.690", + "additive": "-0.121", + "lod_score": "6.9", + "lrs_location": "Chr1: 174.792334", + "sample_r": "-0.043", + "num_overlap": 67, + "sample_p": "7.325e-01", + "lit_corr": "--", + "tissue_corr": "0.070", + "tissue_pvalue": "7.354e-01" + }, + { + "index": 73, + "trait_id": "1415718_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415718_at:HC_M2_0606_P:9714b7b3046b5c8bf4a0", + "symbol": "Sap30l", + "description": "SAP30-like (histone deacetylase complex subunit, sin3A-associated protein p30-like protein); last three exons and 3' UTR", + "location": "Chr11: 57.619548", + "mean": "10.407", + "additive": "0.170", + "lod_score": "12.8", + "lrs_location": "Chr11: 57.088037", + "sample_r": "0.041", + "num_overlap": 67, + "sample_p": "7.418e-01", + "lit_corr": "--", + "tissue_corr": "0.016", + "tissue_pvalue": "9.370e-01" + }, + { + "index": 74, + "trait_id": "1415755_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415755_a_at:HC_M2_0606_P:e23340ac6458755b9d1e", + "symbol": "Ube2v1", + "description": "ubiquitin-conjugating enzyme E2 variant 1", + "location": "Chr2: 23.477654", + "mean": "12.282", + "additive": "0.053", + "lod_score": "2.2", + "lrs_location": "Chr6: 127.954548", + "sample_r": "0.040", + "num_overlap": 67, + "sample_p": "7.490e-01", + "lit_corr": "--", + "tissue_corr": "-0.321", + "tissue_pvalue": "1.102e-01" + }, + { + "index": 75, + "trait_id": "1415694_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415694_at:HC_M2_0606_P:38c96bb74d8916f0c519", + "symbol": "Wars", + "description": "tryptophanyl-tRNA synthetase; alternative 3' UTR (short form, test Mendelian 12.109, BXD hippocampus, B high)", + "location": "Chr12: 110.098698", + "mean": "8.523", + "additive": "-0.938", + "lod_score": "32.3", + "lrs_location": "Chr12: 110.136559", + "sample_r": "-0.039", + "num_overlap": 67, + "sample_p": "7.559e-01", + "lit_corr": "--", + "tissue_corr": "-0.275", + "tissue_pvalue": "1.738e-01" + }, + { + "index": 76, + "trait_id": "1415744_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415744_at:HC_M2_0606_P:38f9abcb635f29e5871c", + "symbol": "Pfdn6", + "description": "prefoldin subunit 6 (H2-K region expressed gene 2); 5' UTR, exons 1, 3, 4, and 3' UTR", + "location": "Chr17: 34.075883", + "mean": "11.324", + "additive": "-0.157", + "lod_score": "11.0", + "lrs_location": "Chr17: 33.247164", + "sample_r": "0.038", + "num_overlap": 67, + "sample_p": "7.626e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 77, + "trait_id": "1415700_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415700_a_at:HC_M2_0606_P:95582b9daa0776067713", + "symbol": "Ssr3", + "description": "signal sequence receptor, gamma (translocon-associated protein gamma); mid-distal 3' UTR", + "location": "Chr3: 65.183917", + "mean": "12.068", + "additive": "0.067", + "lod_score": "2.1", + "lrs_location": "Chr7: 27.852865", + "sample_r": "0.036", + "num_overlap": 67, + "sample_p": "7.742e-01", + "lit_corr": "--", + "tissue_corr": "-0.354", + "tissue_pvalue": "7.623e-02" + }, + { + "index": 78, + "trait_id": "1415687_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415687_a_at:HC_M2_0606_P:f15bcfef7839d22ca5a3", + "symbol": "Psap", + "description": "prosaposin; mid and distal 3' UTR", + "location": "Chr10: 59.764772", + "mean": "14.976", + "additive": "0.121", + "lod_score": "2.0", + "lrs_location": "Chr5: 4.468199", + "sample_r": "0.035", + "num_overlap": 67, + "sample_p": "7.777e-01", + "lit_corr": "--", + "tissue_corr": "0.078", + "tissue_pvalue": "7.058e-01" + }, + { + "index": 79, + "trait_id": "1415729_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415729_at:HC_M2_0606_P:08dc70633663e17111dd", + "symbol": "Pdpk1", + "description": "3-phosphoinositide dependent protein kinase-1; distal 3' UTR", + "location": "Chr17: 24.210667", + "mean": "12.376", + "additive": "-0.081", + "lod_score": "3.0", + "lrs_location": "Chr2: 55.266330", + "sample_r": "-0.029", + "num_overlap": 67, + "sample_p": "8.147e-01", + "lit_corr": "--", + "tissue_corr": "0.290", + "tissue_pvalue": "1.506e-01" + }, + { + "index": 80, + "trait_id": "1415672_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415672_at:HC_M2_0606_P:d6a7286d4957f3487196", + "symbol": "Golga7", + "description": "golgi autoantigen, golgin subfamily a, 7", + "location": "Chr8: 24.351869", + "mean": "13.218", + "additive": "0.063", + "lod_score": "2.6", + "lrs_location": "Chr13: 120.059030", + "sample_r": "-0.027", + "num_overlap": 67, + "sample_p": "8.305e-01", + "lit_corr": "--", + "tissue_corr": "-0.456", + "tissue_pvalue": "1.919e-02" + }, + { + "index": 81, + "trait_id": "1415713_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415713_a_at:HC_M2_0606_P:e22be15fd9ade623e3bb", + "symbol": "Ddx24", + "description": "DEAD (Asp-Glu-Ala-Asp) box polypeptide 24; last two exons", + "location": "Chr12: 104.646500", + "mean": "11.808", + "additive": "0.052", + "lod_score": "3.1", + "lrs_location": "Chr9: 15.693672", + "sample_r": "-0.026", + "num_overlap": 67, + "sample_p": "8.322e-01", + "lit_corr": "--", + "tissue_corr": "0.338", + "tissue_pvalue": "9.077e-02" + }, + { + "index": 82, + "trait_id": "1415683_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415683_at:HC_M2_0606_P:f544e88da2dd8adb0b3f", + "symbol": "Nmt1", + "description": "N-myristoyltransferase 1; exons 10 and 11, and 3' UTR", + "location": "Chr11: 102.926047", + "mean": "12.261", + "additive": "-0.070", + "lod_score": "2.6", + "lrs_location": "Chr6: 101.797292", + "sample_r": "0.026", + "num_overlap": 67, + "sample_p": "8.375e-01", + "lit_corr": "--", + "tissue_corr": "0.366", + "tissue_pvalue": "6.559e-02" + }, + { + "index": 83, + "trait_id": "1415701_x_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415701_x_at:HC_M2_0606_P:8faa1e92ec8fc8cf33b5", + "symbol": "Rpl23", + "description": "ribosomal protein L23; spans exons 1, 2, 3, 4, and intron 4, and proximal 3' UTR", + "location": "Chr11: 97.639386", + "mean": "16.236", + "additive": "0.067", + "lod_score": "2.7", + "lrs_location": "Chr2: 162.502590", + "sample_r": "0.024", + "num_overlap": 67, + "sample_p": "8.474e-01", + "lit_corr": "--", + "tissue_corr": "-0.036", + "tissue_pvalue": "8.630e-01" + }, + { + "index": 84, + "trait_id": "1415681_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415681_at:HC_M2_0606_P:96ceed972f5f3da9d52d", + "symbol": "Mrpl43", + "description": "mitochondrial ribosomal protein L43", + "location": "Chr19: 45.079983", + "mean": "10.604", + "additive": "-0.058", + "lod_score": "2.1", + "lrs_location": "Chr7: 90.186486", + "sample_r": "-0.021", + "num_overlap": 67, + "sample_p": "8.669e-01", + "lit_corr": "--", + "tissue_corr": "0.362", + "tissue_pvalue": "6.958e-02" + }, + { + "index": 85, + "trait_id": "1415691_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415691_at:HC_M2_0606_P:c6a3213115c205f73f86", + "symbol": "Dlg1", + "description": "discs, large homolog 1 (presynaptic protein SAP97); distal 3' UTR", + "location": "Chr16: 31.872849", + "mean": "11.782", + "additive": "0.088", + "lod_score": "2.9", + "lrs_location": "Chr17: 55.490261", + "sample_r": "-0.020", + "num_overlap": 67, + "sample_p": "8.731e-01", + "lit_corr": "--", + "tissue_corr": "0.015", + "tissue_pvalue": "9.426e-01" + }, + { + "index": 86, + "trait_id": "1415715_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415715_at:HC_M2_0606_P:8c7d719635beb0f7a9f5", + "symbol": "Slbp", + "description": "stem-loop binding protein", + "location": "Chr5: 33.995959", + "mean": "9.003", + "additive": "0.051", + "lod_score": "2.2", + "lrs_location": "Chr11: 69.415410", + "sample_r": "-0.020", + "num_overlap": 67, + "sample_p": "8.749e-01", + "lit_corr": "--", + "tissue_corr": "0.090", + "tissue_pvalue": "6.621e-01" + }, + { + "index": 87, + "trait_id": "1415751_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415751_at:HC_M2_0606_P:d0d8a9fa8a2b142d4374", + "symbol": "Hb1bp3", + "description": "heterochromatin protein 1-binding protein 3", + "location": "Chr4: 137.798500", + "mean": "12.239", + "additive": "-0.168", + "lod_score": "14.7", + "lrs_location": "Chr4: 138.152371", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.773e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 88, + "trait_id": "1415764_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415764_at:HC_M2_0606_P:8a23b78d5d55a0026ceb", + "symbol": "Cpsf7", + "description": "cleavage and polyadenylation specificity factor 7", + "location": "Chr1: 135.516541", + "mean": "11.499", + "additive": "-0.352", + "lod_score": "28.8", + "lrs_location": "Chr1: 135.115363", + "sample_r": "-0.019", + "num_overlap": 67, + "sample_p": "8.787e-01", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 89, + "trait_id": "1415724_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415724_a_at:HC_M2_0606_P:4ff4b2d244043dc3b03e", + "symbol": "Cdc42", + "description": "cell division cycle 42 (activator of Rac); mid-distal 3' UTR", + "location": "Chr4: 136.876012", + "mean": "11.795", + "additive": "-0.120", + "lod_score": "5.5", + "lrs_location": "Chr1: 172.981863", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.792e-01", + "lit_corr": "--", + "tissue_corr": "0.073", + "tissue_pvalue": "7.233e-01" + }, + { + "index": 90, + "trait_id": "1415737_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415737_at:HC_M2_0606_P:c667a35a9b2b78172117", + "symbol": "Rfk", + "description": "riboflavin kinase; distal 3' UTR", + "location": "Chr19: 17.475267", + "mean": "11.552", + "additive": "0.414", + "lod_score": "35.4", + "lrs_location": "Chr19: 16.955950", + "sample_r": "0.019", + "num_overlap": 67, + "sample_p": "8.810e-01", + "lit_corr": "--", + "tissue_corr": "0.117", + "tissue_pvalue": "5.681e-01" + }, + { + "index": 91, + "trait_id": "1415738_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415738_at:HC_M2_0606_P:304349c531fb99926720", + "symbol": "Txndc12", + "description": "thioredoxin domain-containing protein 12; 3' UTR", + "location": "Chr4: 108.534146", + "mean": "9.375", + "additive": "-0.103", + "lod_score": "3.2", + "lrs_location": "Chr1: 172.981863", + "sample_r": "-0.016", + "num_overlap": 67, + "sample_p": "9.004e-01", + "lit_corr": "--", + "tissue_corr": "0.135", + "tissue_pvalue": "5.114e-01" + }, + { + "index": 92, + "trait_id": "1415735_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415735_at:HC_M2_0606_P:f30f5a5f571c8c61d459", + "symbol": "Ddb1", + "description": "damage-specific DNA binding protein 1, 127 kDa", + "location": "Chr19: 10.703737", + "mean": "10.647", + "additive": "-0.085", + "lod_score": "5.1", + "lrs_location": "Chr16: 28.990480", + "sample_r": "0.016", + "num_overlap": 67, + "sample_p": "9.008e-01", + "lit_corr": "--", + "tissue_corr": "0.248", + "tissue_pvalue": "2.217e-01" + }, + { + "index": 93, + "trait_id": "1415684_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415684_at:HC_M2_0606_P:710753b49f7e38406e4b", + "symbol": "Atg5", + "description": "autophagy related 5; mid 3' UTR", + "location": "Chr10: 44.083511", + "mean": "8.854", + "additive": "-0.068", + "lod_score": "2.2", + "lrs_location": "Chr6: 145.406059", + "sample_r": "-0.014", + "num_overlap": 67, + "sample_p": "9.086e-01", + "lit_corr": "--", + "tissue_corr": "-0.109", + "tissue_pvalue": "5.954e-01" + }, + { + "index": 94, + "trait_id": "1415686_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415686_at:HC_M2_0606_P:455a84fffcd7a0997580", + "symbol": "Rab14", + "description": "Rab GTPase family member 14", + "location": "Chr2: 35.036216", + "mean": "12.112", + "additive": "0.110", + "lod_score": "3.6", + "lrs_location": "Chr14: 124.508018", + "sample_r": "-0.013", + "num_overlap": 67, + "sample_p": "9.139e-01", + "lit_corr": "--", + "tissue_corr": "-0.056", + "tissue_pvalue": "7.850e-01" + }, + { + "index": 95, + "trait_id": "1415685_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415685_at:HC_M2_0606_P:60c84786fe2f4a62d13d", + "symbol": "Mtif2", + "description": "mitochondrial translational initiation factor 2", + "location": "Chr11: 29.442428", + "mean": "9.271", + "additive": "-0.367", + "lod_score": "23.1", + "lrs_location": "Chr11: 28.975002", + "sample_r": "0.012", + "num_overlap": 67, + "sample_p": "9.259e-01", + "lit_corr": "--", + "tissue_corr": "-0.358", + "tissue_pvalue": "7.272e-02" + }, + { + "index": 96, + "trait_id": "1415679_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415679_at:HC_M2_0606_P:513339a6b22faab7d8f6", + "symbol": "Psenen", + "description": "presenilin enhancer 2; 5' UTR, all exons, and 3' UTR", + "location": "Chr7: 31.346914", + "mean": "11.480", + "additive": "-0.283", + "lod_score": "19.1", + "lrs_location": "Chr7: 31.505577", + "sample_r": "-0.011", + "num_overlap": 67, + "sample_p": "9.286e-01", + "lit_corr": "--", + "tissue_corr": "-0.002", + "tissue_pvalue": "9.929e-01" + }, + { + "index": 97, + "trait_id": "1415710_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415710_at:HC_M2_0606_P:4b8e32a96cf0e9bb30d3", + "symbol": "Cox18", + "description": "cytochrome c oxidase assembly protein 18; last three exons and proximal 3' UTR", + "location": "Chr5: 90.644087", + "mean": "9.513", + "additive": "0.402", + "lod_score": "33.4", + "lrs_location": "Chr5: 90.500265", + "sample_r": "0.010", + "num_overlap": 67, + "sample_p": "9.360e-01", + "lit_corr": "--", + "tissue_corr": "0.420", + "tissue_pvalue": "3.257e-02" + }, + { + "index": 98, + "trait_id": "1415702_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415702_a_at:HC_M2_0606_P:7ef725f27498e294d14a", + "symbol": "Ctbp1", + "description": "C-terminal binding protein 1; 3' UTR", + "location": "Chr5: 33.590456", + "mean": "12.530", + "additive": "-0.056", + "lod_score": "2.3", + "lrs_location": "Chr12: 76.993653", + "sample_r": "-0.010", + "num_overlap": 67, + "sample_p": "9.372e-01", + "lit_corr": "--", + "tissue_corr": "0.514", + "tissue_pvalue": "7.288e-03" + }, + { + "index": 99, + "trait_id": "1415711_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415711_at:HC_M2_0606_P:f71bb40cdefd07ae95d6", + "symbol": "Arfgef1", + "description": "ADP-ribosylation factor guanine nucleotide-exchange factor 1 (brefeldin A-inhibited); 3' UTR", + "location": "Chr18: 22.122655", + "mean": "11.617", + "additive": "-0.055", + "lod_score": "3.3", + "lrs_location": "Chr2: 50.500580", + "sample_r": "-0.003", + "num_overlap": 67, + "sample_p": "9.802e-01", + "lit_corr": "--", + "tissue_corr": "-0.020", + "tissue_pvalue": "9.216e-01" + }, + { + "index": 100, + "trait_id": "1415726_at", + "dataset": "HC_M2_0606_P", + "hmac": "1415726_at:HC_M2_0606_P:89e8ab5b988a202a2fb0", + "symbol": "Ankrd17", + "description": "ankyrin repeat domain protein 17; last exon and proximal 3' UTR", + "location": "Chr5: 90.657781", + "mean": "11.533", + "additive": "0.046", + "lod_score": "2.0", + "lrs_location": "Chr14: 42.819085", + "sample_r": "0.000", + "num_overlap": 67, + "sample_p": "9.991e-01", + "lit_corr": "--", + "tissue_corr": "0.530", + "tissue_pvalue": "5.382e-03" + } +]
\ No newline at end of file diff --git a/tests/unit/correlation/group_data_test.json b/tests/unit/correlation/group_data_test.json new file mode 100644 index 0000000..9a73a46 --- /dev/null +++ b/tests/unit/correlation/group_data_test.json @@ -0,0 +1,214 @@ +{ + "name":"BXD", + "id":1, + "genetic_type":"riset", + "f1list":"None", + "parlist":"None", + "mapping_id":"1", + "mapping_names":[ + "GEMMA", + "QTLReaper", + "R/qtl" + ], + "species":"mouse", + "samplelist":[ + "BXD1", + "BXD2", + "BXD5", + "BXD6", + "BXD8", + "BXD9", + "BXD11", + "BXD12", + "BXD13", + "BXD14", + "BXD15", + "BXD16", + "BXD18", + "BXD19", + "BXD20", + "BXD21", + "BXD22", + "BXD23", + "BXD24", + "BXD24a", + "BXD25", + "BXD27", + "BXD28", + "BXD29", + "BXD30", + "BXD31", + "BXD32", + "BXD33", + "BXD34", + "BXD35", + "BXD36", + "BXD37", + "BXD38", + "BXD39", + "BXD40", + "BXD41", + "BXD42", + "BXD43", + "BXD44", + "BXD45", + "BXD48", + "BXD48a", + "BXD49", + "BXD50", + "BXD51", + "BXD52", + "BXD53", + "BXD54", + "BXD55", + "BXD56", + "BXD59", + "BXD60", + "BXD61", + "BXD62", + "BXD63", + "BXD64", + "BXD65", + "BXD65a", + "BXD65b", + "BXD66", + "BXD67", + "BXD68", + "BXD69", + "BXD70", + "BXD71", + "BXD72", + "BXD73", + "BXD73a", + "BXD73b", + "BXD74", + "BXD75", + "BXD76", + "BXD77", + "BXD78", + "BXD79", + "BXD81", + "BXD83", + "BXD84", + "BXD85", + "BXD86", + "BXD87", + "BXD88", + "BXD89", + "BXD90", + "BXD91", + "BXD93", + "BXD94", + "BXD95", + "BXD98", + "BXD99", + "BXD100", + "BXD101", + "BXD102", + "BXD104", + "BXD105", + "BXD106", + "BXD107", + "BXD108", + "BXD109", + "BXD110", + "BXD111", + "BXD112", + "BXD113", + "BXD114", + "BXD115", + "BXD116", + "BXD117", + "BXD119", + "BXD120", + "BXD121", + "BXD122", + "BXD123", + "BXD124", + "BXD125", + "BXD126", + "BXD127", + "BXD128", + "BXD128a", + "BXD130", + "BXD131", + "BXD132", + "BXD133", + "BXD134", + "BXD135", + "BXD136", + "BXD137", + "BXD138", + "BXD139", + "BXD141", + "BXD142", + "BXD144", + "BXD145", + "BXD146", + "BXD147", + "BXD148", + "BXD149", + "BXD150", + "BXD151", + "BXD152", + "BXD153", + "BXD154", + "BXD155", + "BXD156", + "BXD157", + "BXD160", + "BXD161", + "BXD162", + "BXD165", + "BXD168", + "BXD169", + "BXD170", + "BXD171", + "BXD172", + "BXD173", + "BXD174", + "BXD175", + "BXD176", + "BXD177", + "BXD178", + "BXD180", + "BXD181", + "BXD183", + "BXD184", + "BXD186", + "BXD187", + "BXD188", + "BXD189", + "BXD190", + "BXD191", + "BXD192", + "BXD193", + "BXD194", + "BXD195", + "BXD196", + "BXD197", + "BXD198", + "BXD199", + "BXD200", + "BXD201", + "BXD202", + "BXD203", + "BXD204", + "BXD205", + "BXD206", + "BXD207", + "BXD208", + "BXD209", + "BXD210", + "BXD211", + "BXD212", + "BXD213", + "BXD214", + "BXD215", + "BXD216", + "BXD217", + "BXD218", + "BXD219", + "BXD220" + ] +}
\ No newline at end of file diff --git a/tests/unit/correlation/my_results.json b/tests/unit/correlation/my_results.json new file mode 100644 index 0000000..2061c6e --- /dev/null +++ b/tests/unit/correlation/my_results.json @@ -0,0 +1,388 @@ +[ + + { + "sample_r_correlation_using_genenetwork3":"Results", + + }, + + { + "index": 1, + "trait_id": "1445813_at", + "dataset": "HC_M2_0606_P", + "hmac": "1445813_at:HC_M2_0606_P:ca1b85915ccba7198af3", + "symbol": "0610012K18Rik", + "description": "RIKEN cDNA 0610012H03 (no human homolog defined)", + "location": "Chr17: 14.966404", + "mean": "6.643", + "additive": "0.042", + "lod_score": "2.6", + "lrs_location": "Chr5: 133.538653", + "sample_r": "-0.694", + "num_overlap": 67, + "sample_p": "7.244e-11", + "lit_corr": "--", + "tissue_corr": "--", + "tissue_pvalue": "--" + }, + { + "index": 2, + "trait_id": "1439910_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1439910_a_at:HC_M2_0606_P:0c4c7a3cb088699af36c", + "symbol": "Tradd", + "description": "TNFRSF1A-associated via death domain", + "location": "Chr8: 107.783836", + "mean": "7.449", + "additive": "0.039", + "lod_score": "1.7", + "lrs_location": "Chr1: 195.987783", + "sample_r": "-0.692", + "num_overlap": 67, + "sample_p": "9.012e-11", + "lit_corr": "--", + "tissue_corr": "-0.285", + "tissue_pvalue": "1.575e-01" + }, + { + "index": 3, + "trait_id": "1421499_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1421499_a_at:HC_M2_0606_P:b807253e0829c2592ceb", + "symbol": "Ptpn14", + "description": "protein tyrosine phosphatase, non-receptor type 14", + "location": "Chr1: 191.689356", + "mean": "6.655", + "additive": "0.049", + "lod_score": "2.4", + "lrs_location": "Chr1: 197.014645", + "sample_r": "-0.691", + "num_overlap": 67, + "sample_p": "1.009e-10", + "lit_corr": "--", + "tissue_corr": "-0.242", + "tissue_pvalue": "2.337e-01" + }, + { + "index": 4, + "trait_id": "1421167_at", + "dataset": "HC_M2_0606_P", + "hmac": "1421167_at:HC_M2_0606_P:d7b29d02c306e1ae105a", + "symbol": "Atp11a", + "description": "ATPase, class VI, type 11A; last four exons and 3' UTR", + "location": "Chr8: 12.856932", + "mean": "7.341", + "additive": "0.050", + "lod_score": "1.7", + "lrs_location": "Chr9: 62.226499", + "sample_r": "-0.690", + "num_overlap": 67, + "sample_p": "1.059e-10", + "lit_corr": "--", + "tissue_corr": "0.154", + "tissue_pvalue": "4.522e-01" + }, + { + "index": 5, + "trait_id": "1436525_at", + "dataset": "HC_M2_0606_P", + "hmac": "1436525_at:HC_M2_0606_P:b36b6c4053c40cc5b25b", + "symbol": "Ap3s2", + "description": "adaptor-related protein complex 3, sigma 2 subunit", + "location": "Chr7: 87.022674", + "mean": "8.227", + "additive": "-0.070", + "lod_score": "3.0", + "lrs_location": "Chr4: 63.346622", + "sample_r": "-0.679", + "num_overlap": 67, + "sample_p": "2.627e-10", + "lit_corr": "--", + "tissue_corr": "-0.059", + "tissue_pvalue": "7.750e-01" + }, + { + "index": 6, + "trait_id": "1450824_at", + "dataset": "HC_M2_0606_P", + "hmac": "1450824_at:HC_M2_0606_P:fa9b15d1d4a2d629decb", + "symbol": "Ptch1", + "description": "patched homolog 1", + "location": "Chr13: 63.612887", + "mean": "7.105", + "additive": "0.070", + "lod_score": "3.9", + "lrs_location": "Chr5: 133.538653", + "sample_r": "-0.679", + "num_overlap": 67, + "sample_p": "2.771e-10", + "lit_corr": "--", + "tissue_corr": "-0.360", + "tissue_pvalue": "7.075e-02" + }, + { + "index": 7, + "trait_id": "1450540_x_at", + "dataset": "HC_M2_0606_P", + "hmac": "1450540_x_at:HC_M2_0606_P:0836630187705e0a98ed", + "symbol": "Krtap5-1", + "description": "keratin associated protein 5-1", + "location": "Chr7: 149.482282", + "mean": "7.584", + "additive": "0.059", + "lod_score": "2.2", + "lrs_location": "Chr5: 140.893042", + "sample_r": "-0.678", + "num_overlap": 67, + "sample_p": "2.828e-10", + "lit_corr": "--", + "tissue_corr": "-0.486", + "tissue_pvalue": "1.174e-02" + }, + { + "index": 8, + "trait_id": "1454403_at", + "dataset": "HC_M2_0606_P", + "hmac": "1454403_at:HC_M2_0606_P:d6625a44bb78d0c9a7bc", + "symbol": "Fgd5", + "description": "FYVE, RhoGEF and PH domain containing 5", + "location": "Chr6: 91.964079", + "mean": "6.447", + "additive": "-0.036", + "lod_score": "1.8", + "lrs_location": "Chr8: 7.701081", + "sample_r": "-0.669", + "num_overlap": 67, + "sample_p": "5.895e-10", + "lit_corr": "--", + "tissue_corr": "-0.209", + "tissue_pvalue": "3.062e-01" + }, + { + "index": 9, + "trait_id": "1444162_at", + "dataset": "HC_M2_0606_P", + "hmac": "1444162_at:HC_M2_0606_P:fea27946a4ed1ee2b47a", + "symbol": "Frs2", + "description": "fibroblast growth factor receptor substrate 2", + "location": "Chr10: 116.521472", + "mean": "5.677", + "additive": "-0.040", + "lod_score": "1.8", + "lrs_location": "Chr4: 66.843058", + "sample_r": "-0.666", + "num_overlap": 67, + "sample_p": "7.946e-10", + "lit_corr": "--", + "tissue_corr": "-0.241", + "tissue_pvalue": "2.352e-01" + }, + { + "index": 10, + "trait_id": "1451876_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1451876_a_at:HC_M2_0606_P:eb879785591c3c2addeb", + "symbol": "Trp63", + "description": "transformation related protein 63", + "location": "Chr16: 25.884897", + "mean": "6.207", + "additive": "0.059", + "lod_score": "2.0", + "lrs_location": "Chr9: 74.382952", + "sample_r": "-0.664", + "num_overlap": 67, + "sample_p": "8.743e-10", + "lit_corr": "--", + "tissue_corr": "-0.187", + "tissue_pvalue": "3.601e-01" + }, + { + "index": 11, + "trait_id": "1457795_at", + "dataset": "HC_M2_0606_P", + "hmac": "1457795_at:HC_M2_0606_P:617d62e702f1f04b065d", + "symbol": "Scamp4", + "description": "secretory carrier membrane protein 4", + "location": "Chr10: 80.076487", + "mean": "7.060", + "additive": "-0.042", + "lod_score": "2.4", + "lrs_location": "Chr11: 58.923978", + "sample_r": "-0.663", + "num_overlap": 67, + "sample_p": "9.806e-10", + "lit_corr": "--", + "tissue_corr": "-0.040", + "tissue_pvalue": "8.462e-01" + }, + { + "index": 12, + "trait_id": "1439472_at", + "dataset": "HC_M2_0606_P", + "hmac": "1439472_at:HC_M2_0606_P:f52f356bf5d00add1ba9", + "symbol": "Gcn1l1", + "description": "general control of amino-acid synthesis 1-like 1", + "location": "Chr5: 116.033483", + "mean": "7.325", + "additive": "0.058", + "lod_score": "3.1", + "lrs_location": "Chr1: 196.404284", + "sample_r": "-0.662", + "num_overlap": 67, + "sample_p": "1.075e-09", + "lit_corr": "--", + "tissue_corr": "-0.205", + "tissue_pvalue": "3.157e-01" + }, + { + "index": 13, + "trait_id": "1422074_at", + "dataset": "HC_M2_0606_P", + "hmac": "1422074_at:HC_M2_0606_P:4acd73cfd3d194327d79", + "symbol": "Cdx2", + "description": "caudal type homeo box 2", + "location": "Chr5: 148.113293", + "mean": "6.415", + "additive": "-0.037", + "lod_score": "1.8", + "lrs_location": "Chr2: 180.825581", + "sample_r": "-0.661", + "num_overlap": 67, + "sample_p": "1.140e-09", + "lit_corr": "--", + "tissue_corr": "0.002", + "tissue_pvalue": "9.926e-01" + }, + { + "index": 14, + "trait_id": "1429140_at", + "dataset": "HC_M2_0606_P", + "hmac": "1429140_at:HC_M2_0606_P:16116d150fd7a8d09687", + "symbol": "Spns3", + "description": "spinster homolog 3; exons 10, 12, and proximal 3' UTR", + "location": "Chr11: 72.311676", + "mean": "7.194", + "additive": "0.050", + "lod_score": "2.1", + "lrs_location": "Chr9: 69.810185", + "sample_r": "-0.661", + "num_overlap": 67, + "sample_p": "1.175e-09", + "lit_corr": "--", + "tissue_corr": "0.557", + "tissue_pvalue": "3.116e-03" + }, + { + "index": 15, + "trait_id": "1437477_at", + "dataset": "HC_M2_0606_P", + "hmac": "1437477_at:HC_M2_0606_P:990d16df933d7bb03428", + "symbol": "Lrrfip1", + "description": "leucine rich repeat (in FLII) interacting protein 1", + "location": "Chr1: 93.011523", + "mean": "7.597", + "additive": "0.068", + "lod_score": "2.3", + "lrs_location": "Chr5: 133.538653", + "sample_r": "-0.658", + "num_overlap": 67, + "sample_p": "1.393e-09", + "lit_corr": "--", + "tissue_corr": "0.132", + "tissue_pvalue": "5.204e-01" + }, + { + "index": 16, + "trait_id": "1440212_at", + "dataset": "HC_M2_0606_P", + "hmac": "1440212_at:HC_M2_0606_P:01ae82e4856177dd9d89", + "symbol": "Slc12a1", + "description": "solute carrier family 12, member 1", + "location": "Chr2: 124.990152", + "mean": "7.061", + "additive": "0.038", + "lod_score": "2.2", + "lrs_location": "Chr1: 193.731996", + "sample_r": "-0.655", + "num_overlap": 67, + "sample_p": "1.769e-09", + "lit_corr": "--", + "tissue_corr": "0.028", + "tissue_pvalue": "8.923e-01" + }, + { + "index": 17, + "trait_id": "1419755_at", + "dataset": "HC_M2_0606_P", + "hmac": "1419755_at:HC_M2_0606_P:15fea7c69b0d5faa1298", + "symbol": "Mfi2", + "description": "antigen p97 (melanoma associated) identified by monoclonal antibodies 133.2 and 96.5", + "location": "Chr16: 31.898518", + "mean": "6.697", + "additive": "-0.038", + "lod_score": "2.0", + "lrs_location": "Chr4: 50.881071", + "sample_r": "-0.654", + "num_overlap": 67, + "sample_p": "1.950e-09", + "lit_corr": "--", + "tissue_corr": "0.244", + "tissue_pvalue": "2.305e-01" + }, + { + "index": 18, + "trait_id": "1425457_a_at", + "dataset": "HC_M2_0606_P", + "hmac": "1425457_a_at:HC_M2_0606_P:669c485b158c0207026c", + "symbol": "Grb10", + "description": "growth factor receptor bound protein 10", + "location": "Chr11: 11.833500", + "mean": "6.515", + "additive": "0.081", + "lod_score": "3.9", + "lrs_location": "Chr5: 133.538653", + "sample_r": "-0.652", + "num_overlap": 67, + "sample_p": "2.295e-09", + "lit_corr": "--", + "tissue_corr": "-0.090", + "tissue_pvalue": "6.617e-01" + }, + { + "index": 19, + "trait_id": "1431329_at", + "dataset": "HC_M2_0606_P", + "hmac": "1431329_at:HC_M2_0606_P:a6df7ed818ea0042c550", + "symbol": "Nphp4", + "description": "nephronophthisis 4 (renal tubular development and function)", + "location": "Chr4: 151.863271", + "mean": "6.191", + "additive": "0.039", + "lod_score": "1.9", + "lrs_location": "ChrX: 112.637353", + "sample_r": "-0.652", + "num_overlap": 67, + "sample_p": "2.330e-09", + "lit_corr": "--", + "tissue_corr": "-0.104", + "tissue_pvalue": "6.144e-01" + }, + { + "index": 20, + "trait_id": "1443987_at", + "dataset": "HC_M2_0606_P", + "hmac": "1443987_at:HC_M2_0606_P:681e6c787b4d652d0c07", + "symbol": "Klhl18", + "description": "kelch-like 18 (Drosophila)", + "location": "Chr9: 110.330597", + "mean": "7.244", + "additive": "-0.070", + "lod_score": "2.1", + "lrs_location": "Chr15: 13.149248", + "sample_r": "-0.650", + "num_overlap": 67, + "sample_p": "2.561e-09", + "lit_corr": "--", + "tissue_corr": "-0.200", + "tissue_pvalue": "3.270e-01" + } +]
\ No newline at end of file diff --git a/tests/unit/correlation/test_correlation_computations.py b/tests/unit/correlation/test_correlation_computations.py new file mode 100644 index 0000000..dbb2587 --- /dev/null +++ b/tests/unit/correlation/test_correlation_computations.py @@ -0,0 +1,65 @@ +"""module for testing correlation/correlation_computations""" + +import unittest +from gn3.correlation.correlation_computations import compute_correlation + + +# mock for calculating correlation function + +def mock_get_loading_page_data(initial_start_vars): + """function to mock filtering input""" + results = {'start_vars': + {'genofile': 'SAMPLE:X', 'dataset': 'HC_M2_0606_P', + 'sample_vals': '{"C57BL/6J":"7.197","DBA/2J":"7.148","B6D2F1":"6.999"}', + 'primary_samples': 'C57BL/6J,DBA/2J,B6D2F1', + 'n_samples': 3, + 'wanted_inputs': "sample_vals,dataset,genofile,primary_samples"}} + + return results + + +class MockCorrelationResults: + """mock class for CorrelationResults""" + + def __init__(self, start_vars): + for _key, value in start_vars.items(): + self.value = value + + self.assert_start_vars(start_vars) + + @staticmethod + def assert_start_vars(start_vars): + """assert data required is supplied""" + assert "wanted_inputs" in start_vars + + def do_correlation(self, start_vars): + """mock method for doing correlation""" + + return { + "results": "success" + } + + +class TestCorrelationUtility(unittest.TestCase): + """tests for correlation computations""" + + def test_compute_correlation(self): + """test function for doing correlation""" + + sample_vals = """{"C57BL/6J":"7.197","DBA/2J":"7.148","B6D2F1":"6.999"}""" + + correlation_input_data = { + "wanted_inputs": "sample_vals,dataset,genofile,primary_samples", + "genofile": "SAMPLE:X", + "dataset": "HC_M2_0606_P", + + "sample_vals": sample_vals, + "primary_samples": "C57BL/6J,DBA/2J,B6D2F1" + + } + correlation_results = compute_correlation( + correlation_input_data=correlation_input_data, + correlation_results=MockCorrelationResults) + results = {"results": "success"} + + self.assertEqual(results,correlation_results) diff --git a/tests/unit/correlation/test_show_corr_results.py b/tests/unit/correlation/test_show_corr_results.py new file mode 100644 index 0000000..4846f5e --- /dev/null +++ b/tests/unit/correlation/test_show_corr_results.py @@ -0,0 +1,226 @@ +"""module contains code for testing creating show correlation object""" + +import unittest +import json +import os +from unittest import mock +from types import SimpleNamespace +from gn3.correlation.show_corr_results import CorrelationResults +from gn3.correlation.show_corr_results import get_header_fields +from gn3.correlation.show_corr_results import generate_corr_json +# pylint: disable=unused-argument + + + +class ObjectMixin: + """object for adding other methods""" + def __str__(self): + raise NotImplementedError + + def get_dict(self): + raise NotImplementedError + +class MockGroup(ObjectMixin): + """mock class for Group""" + + def __init__(self): + self.samplelist = "add a mock for this" + self.parlist = None + + self.filist = None + +class MockCreateTrait(ObjectMixin): + """mock class for create trait""" + + def __init__(self): + pass + + def get_dict(self): + """class for getting dict items""" + return self.__dict__ + + def __str__(self): + return self.__class__.__name__ + + +class MockCreateDataset: + """mock class for create dataset""" + + def __init__(self): + + self.group = MockGroup() + + def get_trait_data(self, sample_keys): + """method for getting trait data""" + raise NotImplementedError() + + def retrieve_genes(self, symbol): + """method for retrieving genes""" + raise NotImplementedError() + + +def file_path(relative_path): + """getting abs path for file """ + # adopted from github + dir_name = os.path.dirname(os.path.abspath(__file__)) + split_path = relative_path.split("/") + new_path = os.path.join(dir_name, *split_path) + return new_path + + +def create_trait(dataset="Temp", name=None, cellid=None): + """mock function for creating trait""" + return "trait results" + + +def create_dataset(dataset_name="Temp", dataset_type="Temp", group_name=None): + """mock function to create dataset """ + return "dataset results" + + +def get_species(self, start_vars): + """ + how this function works is that it sets the self.dataset and self.species and self.this_trait + """ + + with open(file_path("./dataset.json")) as dataset_file: + results = json.load(dataset_file) + self.dataset = SimpleNamespace(**results) + + with open(file_path("./group_data_test.json")) as group_file: + results = json.load(group_file) + self.group = SimpleNamespace(**results) + + self.dataset.group = self.group + + trait_dict = {'name': '1434568_at', 'dataset': self.dataset, 'cellid': None, + 'identification': 'un-named trait', 'haveinfo': True, 'sequence': None} + + trait_obj = SimpleNamespace(**trait_dict) + + self.this_trait = trait_obj + + self.species = "this species data" + + +class TestCorrelationResults(unittest.TestCase): + """unittests for Correlation Results""" + + def setUp(self): + + with open(file_path("./correlation_test_data.json")) as json_file: + self.correlation_data = json.load(json_file) + + def tearDown(self): + + self.correlation_data = "" + + def test_for_assertion(self): + """test for assertion failures""" + with self.assertRaises(AssertionError): + _corr_results_object = CorrelationResults(start_vars={}) + + @mock.patch("gn3.correlation.show_corr_results.CorrelationResults.process_samples") + def test_do_correlation(self, process_samples): + """test for doing correlation""" + process_samples.return_value = None + corr_object = CorrelationResults(start_vars=self.correlation_data) + + with self.assertRaises(Exception) as _error: + + # xtodo;to be completed + + _corr_results = corr_object.do_correlation(start_vars=self.correlation_data, + create_dataset=create_dataset, + create_trait=None, + get_species_dataset_trait=get_species) + + + + def test_get_header_fields(self): + expected = [ + ['Index', + 'Record', + 'Symbol', + 'Description', + 'Location', + 'Mean', + 'Sample rho', + 'N', + 'Sample p(rho)', + 'Lit rho', + 'Tissue rho', + 'Tissue p(rho)', + 'Max LRS', + 'Max LRS Location', + 'Additive Effect'], + + ['Index', + 'ID', + 'Location', + 'Sample r', + 'N', + 'Sample p(r)'] + + ] + result1 = get_header_fields("ProbeSet", "spearman") + result2 = get_header_fields("Other", "Other") + self.assertEqual(result1, expected[0]) + self.assertEqual(result2, expected[1]) + + + + @mock.patch("gn3.utility.hmac.data_hmac") + def test_generate_corr_json(self, mock_data_hmac): + mock_data_hmac.return_value = "hajsdiau" + + dataset = SimpleNamespace(**{"name": "the_name"}) + this_trait = SimpleNamespace(**{"name": "trait_test", "dataset": dataset}) + target_dataset = SimpleNamespace(**{"type": "Publish"}) + corr_trait_1 = SimpleNamespace(**{ + "name": "trait_1", + "dataset": SimpleNamespace(**{"name": "dataset_1"}), + "view": True, + "abbreviation": "T1", + "description_display": "Trait I description", + "authors": "JM J,JYEW", + "pubmed_id": "34n4nn31hn43", + "pubmed_text": "2016", + "pubmed_link": "https://www.load", + "lod_score": "", + "mean": "", + "LRS_location_repr": "BXBS", + "additive": "", + "sample_r": 10.5, + "num_overlap": 2, + "sample_p": 5 + + + + + }) + corr_results = [corr_trait_1] + + dataset_type_other = { + "location": "cx-3-4", + "sample_4": 12.32, + "num_overlap": 3, + "sample_p": 10.34 + } + + expected_results = '[{"index": 1, "trait_id": "trait_1", "dataset": "dataset_1", "hmac": "hajsdiau", "abbreviation_display": "T1", "description": "Trait I description", "mean": "N/A", "authors_display": "JM J,JYEW", "additive": "N/A", "pubmed_id": "34n4nn31hn43", "year": "2016", "lod_score": "N/A", "lrs_location": "BXBS", "sample_r": "10.500", "num_overlap": 2, "sample_p": "5.000e+00"}]' + + results1 = generate_corr_json(corr_results=corr_results, this_trait=this_trait, + dataset=dataset, target_dataset=target_dataset, for_api=True) + self.assertEqual(expected_results, results1) + + + def test_generate_corr_json_view_false(self): + trait = SimpleNamespace(**{"view": False}) + corr_results = [trait] + this_trait = SimpleNamespace(**{"name": "trait_test"}) + dataset = SimpleNamespace(**{"name": "the_name"}) + + results_where_view_is_false = generate_corr_json( + corr_results=corr_results, this_trait=this_trait, dataset={}, target_dataset={}, for_api=False) + self.assertEqual(results_where_view_is_false, "[]")
\ No newline at end of file diff --git a/tests/unit/utility/__init__.py b/tests/unit/utility/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/unit/utility/__init__.py diff --git a/tests/unit/utility/test_chunks.py b/tests/unit/utility/test_chunks.py new file mode 100644 index 0000000..7c42b44 --- /dev/null +++ b/tests/unit/utility/test_chunks.py @@ -0,0 +1,19 @@ +"""Test chunking""" + +import unittest + +from gn3.utility.chunks import divide_into_chunks + + +class TestChunks(unittest.TestCase): + "Test Utility method for chunking" + def test_divide_into_chunks(self): + "Check that a list is chunked correctly" + self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3), + [[1, 2, 7], [3, 22, 8], [5, 22, 333]]) + self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4), + [[1, 2, 7], [3, 22, 8], [5, 22, 333]]) + self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5), + [[1, 2], [7, 3], [22, 8], [5, 22], [333]]) + self.assertEqual(divide_into_chunks([], 5), + [[]]) diff --git a/tests/unit/utility/test_corr_result_helpers.py b/tests/unit/utility/test_corr_result_helpers.py new file mode 100644 index 0000000..ce5891f --- /dev/null +++ b/tests/unit/utility/test_corr_result_helpers.py @@ -0,0 +1,35 @@ +""" Test correlation helper methods """ + +import unittest +from gn3.utility.corr_result_helpers import normalize_values +from gn3.utility.corr_result_helpers import common_keys +from gn3.utility.corr_result_helpers import normalize_values_with_samples + + +class TestCorrelationHelpers(unittest.TestCase): + """Test methods for normalising lists""" + + def test_normalize_values(self): + """Test that a list is normalised correctly""" + self.assertEqual( + normalize_values([2.3, None, None, 3.2, 4.1, 5],\ + [3.4, 7.2, 1.3, None, 6.2, 4.1]), + ([2.3, 4.1, 5], [3.4, 6.2, 4.1], 3) + ) + + def test_common_keys(self): + """Test that common keys are returned as a list""" + test_a = dict(BXD1=9.113, BXD2=9.825, BXD14=8.985, BXD15=9.300) + test_b = dict(BXD1=9.723, BXD3=9.825, BXD14=9.124, BXD16=9.300) + self.assertEqual(sorted(common_keys(test_a, test_b)), + ['BXD1', 'BXD14']) + + def test_normalize_values_with_samples(self): + """Test that a sample(dict) is normalised correctly""" + self.assertEqual( + normalize_values_with_samples( + dict(BXD1=9.113, BXD2=9.825, BXD14=8.985, + BXD15=9.300, BXD20=9.300), + dict(BXD1=9.723, BXD3=9.825, BXD14=9.124, BXD16=9.300)), + (({'BXD1': 9.113, 'BXD14': 8.985}, {'BXD1': 9.723, 'BXD14': 9.124}, 2)) + ) diff --git a/tests/unit/utility/test_hmac.py b/tests/unit/utility/test_hmac.py new file mode 100644 index 0000000..eba25a3 --- /dev/null +++ b/tests/unit/utility/test_hmac.py @@ -0,0 +1,51 @@ +"""Test hmac utility functions""" +# pylint: disable-all +import unittest +from unittest import mock + +from gn3.utility.hmac import data_hmac +from gn3.utility.hmac import url_for_hmac +from gn3.utility.hmac import hmac_creation + + +class TestHmacUtil(): + """Test Utility method for hmac creation""" + + @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"}) + def test_hmac_creation(self): + """Test hmac creation with a utf-8 string""" + self.assertEqual(hmac_creation("ファイ"), "7410466338cfe109e946") + + @mock.patch("utility.hmac.app.config", + {'SECRET_HMAC_CODE': ('\x08\xdf\xfa\x93N\x80' + '\xd9\\H@\\\x9f`\x98d^' + '\xb4a;\xc6OM\x946a\xbc' + '\xfc\x80:*\xebc')}) + def test_hmac_creation_with_cookie(self): + """Test hmac creation with a cookie""" + cookie = "3f4c1dbf-5b56-4260-87d6-f35445bda37e:af4fcf5eace9e7c864ce" + uuid_, _, signature = cookie.partition(":") + self.assertEqual( + hmac_creation(uuid_), + "af4fcf5eace9e7c864ce") + + @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"}) + def test_data_hmac(self): + """Test data_hmac fn with a utf-8 string""" + self.assertEqual(data_hmac("ファイ"), "ファイ:7410466338cfe109e946") + + @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"}) + @mock.patch("utility.hmac.url_for") + def test_url_for_hmac_with_plain_url(self, mock_url): + """Test url_for_hmac without params""" + mock_url.return_value = "https://mock_url.com/ファイ/" + self.assertEqual(url_for_hmac("ファイ"), + "https://mock_url.com/ファイ/?hm=05bc39e659b1948f41e7") + + @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"}) + @mock.patch("utility.hmac.url_for") + def test_url_for_hmac_with_param_in_url(self, mock_url): + """Test url_for_hmac with params""" + mock_url.return_value = "https://mock_url.com/?ファイ=1" + self.assertEqual(url_for_hmac("ファイ"), + "https://mock_url.com/?ファイ=1&hm=4709c1708270644aed79") |