diff options
author | zsloan | 2019-06-05 16:13:41 -0500 |
---|---|---|
committer | zsloan | 2019-06-05 16:13:41 -0500 |
commit | 38dd85ae47819190c5a3cc9e9a7269b44e92bb38 (patch) | |
tree | 76f56a6a18b207d08744c77d0e9ede0ead4d30e5 | |
parent | 067fb003a7ea9893d63454762183a514829069b1 (diff) | |
download | genenetwork2-38dd85ae47819190c5a3cc9e9a7269b44e92bb38.tar.gz |
Needed to replace single quotes with double quotes for JSON output
-rw-r--r-- | wqflask/wqflask/api/router.py | 290 |
1 files changed, 145 insertions, 145 deletions
diff --git a/wqflask/wqflask/api/router.py b/wqflask/wqflask/api/router.py index 707e4e65..aab3d660 100644 --- a/wqflask/wqflask/api/router.py +++ b/wqflask/wqflask/api/router.py @@ -22,7 +22,7 @@ version = "pre1" @app.route("/api/v_{}/".format(version)) def hello_world(): - return flask.jsonify({'hello':'world'}) + return flask.jsonify({"hello":"world"}) @app.route("/api/v_{}/species".format(version)) def get_species_list(): @@ -31,10 +31,10 @@ def get_species_list(): species_list = [] for species in the_species: species_dict = { - 'Id' : species[0], - 'Name' : species[1], - 'FullName' : species[2], - 'TaxonomyId' : species[3] + "Id" : species[0], + "Name" : species[1], + "FullName" : species[2], + "TaxonomyId" : species[3] } species_list.append(species_dict) @@ -45,14 +45,14 @@ def get_species_list(): def get_species_info(species_name, file_format = "json"): results = g.db.execute("""SELECT SpeciesId, Name, FullName, TaxonomyId FROM Species - WHERE (Name='{0}' OR FullName='{0}' OR SpeciesName='{0}');""".format(species_name)) + WHERE (Name="{0}" OR FullName="{0}" OR SpeciesName="{0}");""".format(species_name)) the_species = results.fetchone() species_dict = { - 'Id' : the_species[0], - 'Name' : the_species[1], - 'FullName' : the_species[2], - 'TaxonomyId' : the_species[3] + "Id" : the_species[0], + "Name" : the_species[1], + "FullName" : the_species[2], + "TaxonomyId" : the_species[3] } return flask.jsonify(species_dict) @@ -61,14 +61,14 @@ def get_species_info(species_name, file_format = "json"): @app.route("/api/v_{}/<path:species_name>/groups".format(version)) def get_groups_list(species_name=None): if species_name: - results = g.db.execute("""SELECT InbredSet.InbredSetId, InbredSet.SpeciesId, InbredSet.InbredSetName, - InbredSet.Name, InbredSet.FullName, InbredSet.public, + results = g.db.execute("""SELECT InbredSet.InbredSetId, InbredSet.SpeciesId, InbredSet.InbredSetName, + InbredSet.Name, InbredSet.FullName, InbredSet.public, InbredSet.MappingMethodId, InbredSet.GeneticType FROM InbredSet, Species WHERE InbredSet.SpeciesId = Species.Id AND - (Species.Name = '{0}' OR - Species.FullName='{0}' OR - Species.SpeciesName='{0}');""".format(species_name)) + (Species.Name = "{0}" OR + Species.FullName="{0}" OR + Species.SpeciesName="{0}");""".format(species_name)) else: results = g.db.execute("""SELECT InbredSet.InbredSetId, InbredSet.SpeciesId, InbredSet.InbredSetName, InbredSet.Name, InbredSet.FullName, InbredSet.public, @@ -80,14 +80,14 @@ def get_groups_list(species_name=None): groups_list = [] for group in the_groups: group_dict = { - 'Id' : group[0], - 'SpeciesId' : group[1], - 'DisplayName' : group[2], - 'Name' : group[3], - 'FullName' : group[4], - 'public' : group[5], - 'MappingMethodId' : group[6], - 'GeneticType' : group[7] + "Id" : group[0], + "SpeciesId" : group[1], + "DisplayName" : group[2], + "Name" : group[3], + "FullName" : group[4], + "public" : group[5], + "MappingMethodId" : group[6], + "GeneticType" : group[7] } groups_list.append(group_dict) @@ -106,32 +106,32 @@ def get_group_info(group_name, species_name = None, file_format = "json"): InbredSet.MappingMethodId, InbredSet.GeneticType FROM InbredSet, Species WHERE InbredSet.SpeciesId = Species.Id AND - (InbredSet.InbredSetName = '{0}' OR - InbredSet.Name = '{0}' OR - InbredSet.FullName = '{0}') AND - (Species.Name = '{1}' OR - Species.FullName='{1}' OR - Species.SpeciesName='{1}');""".format(group_name, species_name)) + (InbredSet.InbredSetName = "{0}" OR + InbredSet.Name = "{0}" OR + InbredSet.FullName = "{0}") AND + (Species.Name = "{1}" OR + Species.FullName="{1}" OR + Species.SpeciesName="{1}");""".format(group_name, species_name)) else: results = g.db.execute("""SELECT InbredSet.InbredSetId, InbredSet.SpeciesId, InbredSet.InbredSetName, InbredSet.Name, InbredSet.FullName, InbredSet.public, InbredSet.MappingMethodId, InbredSet.GeneticType FROM InbredSet - WHERE (InbredSet.InbredSetName = '{0}' OR - InbredSet.Name = '{0}' OR - InbredSet.FullName = '{0}');""".format(group_name)) + WHERE (InbredSet.InbredSetName = "{0}" OR + InbredSet.Name = "{0}" OR + InbredSet.FullName = "{0}");""".format(group_name)) group = results.fetchone() if group: group_dict = { - 'Id' : group[0], - 'SpeciesId' : group[1], - 'DisplayName' : group[2], - 'Name' : group[3], - 'FullName' : group[4], - 'public' : group[5], - 'MappingMethodId' : group[6], - 'GeneticType' : group[7] + "Id" : group[0], + "SpeciesId" : group[1], + "DisplayName" : group[2], + "Name" : group[3], + "FullName" : group[4], + "public" : group[5], + "MappingMethodId" : group[6], + "GeneticType" : group[7] } return flask.jsonify(group_dict) @@ -150,9 +150,9 @@ def get_datasets_for_group(group_name, species_name=None): FROM ProbeSetFreeze, ProbeFreeze, InbredSet, Species WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id AND ProbeFreeze.InbredSetId = InbredSet.Id AND - (InbredSet.Name = '{0}' OR InbredSet.InbredSetName = '{0}' OR InbredSet.FullName = '{0}') AND + (InbredSet.Name = "{0}" OR InbredSet.InbredSetName = "{0}" OR InbredSet.FullName = "{0}") AND InbredSet.SpeciesId = Species.Id AND - (Species.SpeciesName = '{1}' OR Species.MenuName = '{1}' OR Species.FullName = '{1}'); + (Species.SpeciesName = "{1}" OR Species.MenuName = "{1}" OR Species.FullName = "{1}"); """.format(group_name, species_name)) else: results = g.db.execute(""" @@ -163,7 +163,7 @@ def get_datasets_for_group(group_name, species_name=None): FROM ProbeSetFreeze, ProbeFreeze, InbredSet WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id AND ProbeFreeze.InbredSetId = InbredSet.Id AND - (InbredSet.Name = '{0}' OR InbredSet.InbredSetName = '{0}' OR InbredSet.FullName = '{0}'); + (InbredSet.Name = "{0}" OR InbredSet.InbredSetName = "{0}" OR InbredSet.FullName = "{0}"); """.format(group_name)) the_datasets = results.fetchall() @@ -172,17 +172,17 @@ def get_datasets_for_group(group_name, species_name=None): datasets_list = [] for dataset in the_datasets: dataset_dict = { - 'Id' : dataset[0], - 'ProbeFreezeId' : dataset[1], - 'AvgID' : dataset[2], - 'Short_Abbreviation' : dataset[3], - 'Long_Abbreviation' : dataset[4], - 'FullName' : dataset[5], - 'ShortName' : dataset[6], - 'CreateTime' : dataset[7], - 'public' : dataset[8], - 'confidentiality' : dataset[9], - 'DataScale' : dataset[10] + "Id" : dataset[0], + "ProbeFreezeId" : dataset[1], + "AvgID" : dataset[2], + "Short_Abbreviation" : dataset[3], + "Long_Abbreviation" : dataset[4], + "FullName" : dataset[5], + "ShortName" : dataset[6], + "CreateTime" : dataset[7], + "public" : dataset[8], + "confidentiality" : dataset[9], + "DataScale" : dataset[10] } datasets_list.append(dataset_dict) @@ -197,7 +197,7 @@ def get_datasets_for_group(group_name, species_name=None): def get_dataset_info(dataset_name, group_name = None, file_format="json"): #ZS: First get ProbeSet (mRNA expression) datasets and then get Phenotype datasets - datasets_list = [] #ZS: I figure I might as well return a list if there are multiple matches, though I don't know if this will actually happen in practice + datasets_list = [] #ZS: I figure I might as well return a list if there are multiple matches, though I don"t know if this will actually happen in practice probeset_query = """ SELECT ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName, @@ -212,12 +212,12 @@ def get_dataset_info(dataset_name, group_name = None, file_format="json"): """ if dataset_name.isdigit(): where_statement += """ - ProbeSetFreeze.Id = '{}' + ProbeSetFreeze.Id = "{}" """.format(dataset_name) else: where_statement += """ - (ProbeSetFreeze.Name = '{0}' OR ProbeSetFreeze.Name2 = '{0}' OR - ProbeSetFreeze.FullName = '{0}' OR ProbeSetFreeze.ShortName = '{0}') + (ProbeSetFreeze.Name = "{0}" OR ProbeSetFreeze.Name2 = "{0}" OR + ProbeSetFreeze.FullName = "{0}" OR ProbeSetFreeze.ShortName = "{0}") """.format(dataset_name) probeset_query += where_statement @@ -226,16 +226,16 @@ def get_dataset_info(dataset_name, group_name = None, file_format="json"): if dataset: dataset_dict = { - 'dataset_type' : "mRNA expression", - 'id' : dataset[0], - 'name' : dataset[1], - 'full_name' : dataset[2], - 'short_name' : dataset[3], - 'data_scale' : dataset[4], - 'tissue_id' : dataset[5], - 'tissue' : dataset[6], - 'public' : dataset[7], - 'confidential' : dataset[8] + "dataset_type" : "mRNA expression", + "id" : dataset[0], + "name" : dataset[1], + "full_name" : dataset[2], + "short_name" : dataset[3], + "data_scale" : dataset[4], + "tissue_id" : dataset[5], + "tissue" : dataset[6], + "public" : dataset[7], + "confidential" : dataset[8] } datasets_list.append(dataset_dict) @@ -249,7 +249,7 @@ def get_dataset_info(dataset_name, group_name = None, file_format="json"): WHERE PublishXRef.InbredSetId = InbredSet.Id AND PublishXRef.PhenotypeId = Phenotype.Id AND PublishXRef.PublicationId = Publication.Id AND - InbredSet.Name = '{0}' AND PublishXRef.Id = '{1}' + InbredSet.Name = "{0}" AND PublishXRef.Id = "{1}" """.format(group_name, dataset_name) logger.debug("QUERY:", pheno_query) @@ -260,25 +260,25 @@ def get_dataset_info(dataset_name, group_name = None, file_format="json"): if dataset: if dataset[5]: dataset_dict = { - 'dataset_type' : "phenotype", - 'id' : dataset[0], - 'name' : dataset[1], - 'description' : dataset[2], - 'pubmed_id' : dataset[5], - 'title' : dataset[6], - 'year' : dataset[7] + "dataset_type" : "phenotype", + "id" : dataset[0], + "name" : dataset[1], + "description" : dataset[2], + "pubmed_id" : dataset[5], + "title" : dataset[6], + "year" : dataset[7] } elif dataset[4]: dataset_dict = { - 'dataset_type' : "phenotype", - 'id' : dataset[0], - 'name' : dataset[3], - 'description' : dataset[4] + "dataset_type" : "phenotype", + "id" : dataset[0], + "name" : dataset[3], + "description" : dataset[4] } else: dataset_dict = { - 'dataset_type' : "phenotype", - 'id' : dataset[0] + "dataset_type" : "phenotype", + "id" : dataset[0] } datasets_list.append(dataset_dict) @@ -290,11 +290,11 @@ def get_dataset_info(dataset_name, group_name = None, file_format="json"): else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") -@app.route("/api/v_{}/traits/<path:dataset_name>".format(version), methods=('GET',)) -@app.route("/api/v_{}/traits/<path:dataset_name>.<path:file_format>".format(version), methods=('GET',)) +@app.route("/api/v_{}/traits/<path:dataset_name>".format(version), methods=("GET",)) +@app.route("/api/v_{}/traits/<path:dataset_name>.<path:file_format>".format(version), methods=("GET",)) def fetch_traits(dataset_name, file_format = "json"): trait_ids, trait_names, data_type, dataset_id = get_dataset_trait_ids(dataset_name) - if ('ids_only' in request.args) and (len(trait_ids) > 0): + if ("ids_only" in request.args) and (len(trait_ids) > 0): if file_format == "json": filename = dataset_name + "_trait_ids.json" return flask.jsonify(trait_ids) @@ -308,7 +308,7 @@ def fetch_traits(dataset_name, file_format = "json"): output.headers["Content-Disposition"] = "attachment; filename=" + filename output.headers["Content-type"] = "text/csv" return output - elif ('names_only' in request.args) and (len(trait_ids) > 0): + elif ("names_only" in request.args) and (len(trait_ids) > 0): if file_format == "json": filename = dataset_name + "_trait_names.json" return flask.jsonify(trait_names) @@ -332,7 +332,7 @@ def fetch_traits(dataset_name, file_format = "json"): FROM ProbeSet, ProbeSetXRef WHERE - ProbeSetXRef.ProbeSetFreezeId = '{0}' AND + ProbeSetXRef.ProbeSetFreezeId = "{0}" AND ProbeSetXRef.ProbeSetId = ProbeSet.Id ORDER BY ProbeSet.Id @@ -346,7 +346,7 @@ def fetch_traits(dataset_name, file_format = "json"): FROM Geno, GenoXRef WHERE - GenoXRef.GenoFreezeId = '{0}' AND + GenoXRef.GenoFreezeId = "{0}" AND GenoXRef.GenoId = Geno.Id ORDER BY Geno.Id @@ -422,8 +422,8 @@ def all_sample_data(dataset_name, file_format = "csv"): LEFT JOIN ProbeSetSE ON (ProbeSetSE.DataId = ProbeSetData.Id AND ProbeSetSE.StrainId = ProbeSetData.StrainId) WHERE - ProbeSetXRef.ProbeSetFreezeId = '{0}' AND - ProbeSetXRef.ProbeSetId = '{1}' AND + ProbeSetXRef.ProbeSetFreezeId = "{0}" AND + ProbeSetXRef.ProbeSetId = "{1}" AND ProbeSetXRef.DataId = ProbeSetData.Id AND ProbeSetData.StrainId = Strain.Id ORDER BY @@ -438,8 +438,8 @@ def all_sample_data(dataset_name, file_format = "csv"): LEFT JOIN GenoSE ON (GenoSE.DataId = GenoData.Id AND GenoSE.StrainId = GenoData.StrainId) WHERE - GenoXRef.GenoFreezeId = '{0}' AND - GenoXRef.GenoId = '{1}' AND + GenoXRef.GenoFreezeId = "{0}" AND + GenoXRef.GenoId = "{1}" AND GenoXRef.DataId = GenoData.Id AND GenoData.StrainId = Strain.Id ORDER BY @@ -457,8 +457,8 @@ def all_sample_data(dataset_name, file_format = "csv"): (NStrain.DataId = PublishData.Id AND NStrain.StrainId = PublishData.StrainId) WHERE - PublishXRef.InbredSetId = '{0}' AND - PublishXRef.PhenotypeId = '{1}' AND + PublishXRef.InbredSetId = "{0}" AND + PublishXRef.PhenotypeId = "{1}" AND PublishData.Id = PublishXRef.DataId AND PublishData.StrainId = Strain.Id ORDER BY @@ -511,9 +511,9 @@ def trait_sample_data(dataset_name, trait_name, file_format = "json"): LEFT JOIN ProbeSetSE ON (ProbeSetSE.DataId = ProbeSetData.Id AND ProbeSetSE.StrainId = ProbeSetData.StrainId) WHERE - ProbeSet.Name = '{0}' AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSet.Name = "{0}" AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetFreeze.Name = '{1}' AND + ProbeSetFreeze.Name = "{1}" AND ProbeSetXRef.DataId = ProbeSetData.Id AND ProbeSetData.StrainId = Strain.Id ORDER BY @@ -527,13 +527,13 @@ def trait_sample_data(dataset_name, trait_name, file_format = "json"): sample_list = [] for sample in sample_data: sample_dict = { - 'sample_name' : sample[0], - 'sample_name_2' : sample[1], - 'value' : sample[2], - 'data_id' : sample[3], + "sample_name" : sample[0], + "sample_name_2" : sample[1], + "value" : sample[2], + "data_id" : sample[3], } if sample[4]: - sample_dict['se'] = sample[4] + sample_dict["se"] = sample[4] sample_list.append(sample_dict) return flask.jsonify(sample_list) @@ -559,9 +559,9 @@ def trait_sample_data(dataset_name, trait_name, file_format = "json"): NStrain.StrainId = PublishData.StrainId) WHERE PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND - PublishData.Id = PublishXRef.DataId AND PublishXRef.Id = '{1}' AND - (PublishFreeze.Id = '{0}' OR PublishFreeze.Name = '{0}' OR - PublishFreeze.ShortName = '{0}' OR PublishXRef.InbredSetId = '{0}') AND + PublishData.Id = PublishXRef.DataId AND PublishXRef.Id = "{1}" AND + (PublishFreeze.Id = "{0}" OR PublishFreeze.Name = "{0}" OR + PublishFreeze.ShortName = "{0}" OR PublishXRef.InbredSetId = "{0}") AND PublishData.StrainId = Strain.Id ORDER BY Strain.Name @@ -574,15 +574,15 @@ def trait_sample_data(dataset_name, trait_name, file_format = "json"): sample_list = [] for sample in sample_data: sample_dict = { - 'sample_name' : sample[0], - 'sample_name_2' : sample[1], - 'value' : sample[2], - 'data_id' : sample[3] + "sample_name" : sample[0], + "sample_name_2" : sample[1], + "value" : sample[2], + "data_id" : sample[3] } if sample[4]: - sample_dict['se'] = sample[4] + sample_dict["se"] = sample[4] if sample[5]: - sample_dict['n_cases'] = sample[5] + sample_dict["n_cases"] = sample[5] sample_list.append(sample_dict) return flask.jsonify(sample_list) @@ -596,15 +596,15 @@ def trait_sample_data(dataset_name, trait_name, file_format = "json"): def get_trait_info(dataset_name, trait_name, file_format = "json"): probeset_query = """ SELECT - ProbeSet.Id, ProbeSet.Name, ProbeSet.Symbol, ProbeSet.description, ProbeSet.Chr, ProbeSet.Mb, ProbeSet.alias, + ProbeSet.Id, ProbeSet.Name, ProbeSet.Symbol, ProbeSet.description, ProbeSet.Chr, ProbeSet.Mb, ProbeSet.alias, ProbeSetXRef.mean, ProbeSetXRef.se, ProbeSetXRef.Locus, ProbeSetXRef.LRS, ProbeSetXRef.pValue, ProbeSetXRef.additive FROM ProbeSet, ProbeSetXRef, ProbeSetFreeze WHERE - ProbeSet.Name = '{0}' AND + ProbeSet.Name = "{0}" AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetFreeze.Name = '{1}' + ProbeSetFreeze.Name = "{1}" """.format(trait_name, dataset_name) probeset_results = g.db.execute(probeset_query) @@ -612,19 +612,19 @@ def get_trait_info(dataset_name, trait_name, file_format = "json"): trait_info = probeset_results.fetchone() if trait_info: trait_dict = { - 'id' : trait_info[0], - 'name' : trait_info[1], - 'symbol' : trait_info[2], - 'description' : trait_info[3], - 'chr' : trait_info[4], - 'mb' : trait_info[5], - 'alias' :trait_info[6], - 'mean' : trait_info[7], - 'se' : trait_info[8], - 'locus' : trait_info[9], - 'lrs' : trait_info[10], - 'p_value' : trait_info[11], - 'additive' : trait_info[12] + "id" : trait_info[0], + "name" : trait_info[1], + "symbol" : trait_info[2], + "description" : trait_info[3], + "chr" : trait_info[4], + "mb" : trait_info[5], + "alias" :trait_info[6], + "mean" : trait_info[7], + "se" : trait_info[8], + "locus" : trait_info[9], + "lrs" : trait_info[10], + "p_value" : trait_info[11], + "additive" : trait_info[12] } return flask.jsonify(trait_dict) @@ -639,8 +639,8 @@ def get_trait_info(dataset_name, trait_name, file_format = "json"): FROM PublishXRef WHERE - PublishXRef.Id = '{0}' AND - PublishXRef.InbredSetId = '{1}' + PublishXRef.Id = "{0}" AND + PublishXRef.InbredSetId = "{1}" """.format(trait_name, group_id) pheno_results = g.db.execute(pheno_query) @@ -648,17 +648,17 @@ def get_trait_info(dataset_name, trait_name, file_format = "json"): trait_info = pheno_results.fetchone() if trait_info: trait_dict = { - 'id' : trait_info[0], - 'locus' : trait_info[1], - 'lrs' : trait_info[2], - 'additive' : trait_info[3] + "id" : trait_info[0], + "locus" : trait_info[1], + "lrs" : trait_info[2], + "additive" : trait_info[3] } return flask.jsonify(trait_dict) else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") -@app.route("/api/v_{}/correlation".format(version), methods=('GET',)) +@app.route("/api/v_{}/correlation".format(version), methods=("GET",)) def get_corr_results(): results = correlation.do_correlation(request.args) @@ -667,12 +667,12 @@ def get_corr_results(): else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") -@app.route("/api/v_{}/mapping".format(version), methods=('GET',)) +@app.route("/api/v_{}/mapping".format(version), methods=("GET",)) def get_mapping_results(): results = mapping.do_mapping_for_api(request.args) if len(results) > 0: - filename = "mapping_" + datetime.datetime.utcnow().strftime('%b_%d_%Y_%I:%M%p') + ".csv" + filename = "mapping_" + datetime.datetime.utcnow().strftime("%b_%d_%Y_%I:%M%p") + ".csv" si = StringIO.StringIO() csv_writer = csv.writer(si) @@ -692,28 +692,28 @@ def get_genotypes(group_name, file_format="csv"): if file_format == "csv" or file_format == "geno": filename = group_name + ".geno" - if os.path.isfile('{0}/{1}.geno'.format(flat_files('genotype'), group_name)): + if os.path.isfile("{0}/{1}.geno".format(flat_files("genotype"), group_name)): output_lines = [] - with open('{0}/{1}.geno'.format(flat_files('genotype'), group_name)) as genofile: + with open("{0}/{1}.geno".format(flat_files("genotype"), group_name)) as genofile: for line in genofile: if line[0] == "#" or line[0] == "@": output_lines.append([line.strip()]) else: output_lines.append(line.split()) - csv_writer = csv.writer(si, delimiter = '\t', escapechar = "\\", quoting = csv.QUOTE_NONE) + csv_writer = csv.writer(si, delimiter = "\t", escapechar = "\\", quoting = csv.QUOTE_NONE) else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") else: filename = group_name + ".bimbam" - if os.path.isfile('{0}/{1}.geno'.format(flat_files('genotype'), group_name)): + if os.path.isfile("{0}/{1}.geno".format(flat_files("genotype"), group_name)): output_lines = [] - with open('{0}/{1}_geno.txt'.format(flat_files('genotype/bimbam'), group_name)) as genofile: + with open("{0}/{1}_geno.txt".format(flat_files("genotype/bimbam"), group_name)) as genofile: for line in genofile: output_lines.append([line.strip() for line in line.split(",")]) - csv_writer = csv.writer(si, delimiter = ',') + csv_writer = csv.writer(si, delimiter = ",") else: return return_error(code=204, source=request.url_rule.rule, title="No Results", details="") @@ -747,7 +747,7 @@ def get_dataset_trait_ids(dataset_name): WHERE Geno.Id = GenoXRef.GenoId AND GenoXRef.GenoFreezeId = GenoFreeze.Id AND - GenoFreeze.Name = '{0}' + GenoFreeze.Name = "{0}" """.format(dataset_name) results = g.db.execute(query).fetchall() @@ -768,7 +768,7 @@ def get_dataset_trait_ids(dataset_name): FROM PublishXRef WHERE - PublishXRef.InbredSetId = '{0}' + PublishXRef.InbredSetId = "{0}" """.format(dataset_id) results = g.db.execute(query).fetchall() @@ -787,7 +787,7 @@ def get_dataset_trait_ids(dataset_name): WHERE ProbeSet.Id = ProbeSetXRef.ProbeSetId AND ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetFreeze.Name = '{0}' + ProbeSetFreeze.Name = "{0}" """.format(dataset_name) results = g.db.execute(query).fetchall() @@ -857,7 +857,7 @@ def get_group_id(group_name): query = """ SELECT InbredSet.Id FROM InbredSet - WHERE InbredSet.Name = '{}' + WHERE InbredSet.Name = "{}" """.format(group_name) group_id = g.db.execute(query).fetchone() |