如何安装 Python 模块 "color_gradient"
How to install Python module "color_gradient"
我正在扩展用 HTML、Javascript 和 Python 编写的基于 Web 的生物信息学工具。当 运行 应用程序时,其中一个脚本给出了错误:
[Fri Feb 27 13:22:27.528636 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: Traceback (most recent call last):, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528757 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: File "/var/www/localhost/cgi-bin/circular_handler_beta_v2.py", line 10, in <module>, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528787 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: import color_gradient, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528828 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: ImportError: No module named color_gradient, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.538274 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] End of script output before headers: circular_handler_beta_v2.py, referer: http://localhost/circular/index.html
问题是无法导入调用 "color_gradient" 的模块。我尝试在 Google 上搜索在哪里可以找到并安装此模块,但没有得到令人满意且明确的答案。
有人知道在哪里可以找到和安装这个模块吗?
完整的脚本太渴望分享了,这里是模块使用的函数:
def get_genes(nc_code,strand,color):
cursor1 = conn.cursor()
if (strand == "+" or strand == "-"):
# print ("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + " AND strand = " + '"' + strand + '"' + ";")
cursor1.execute("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + " AND strand = " + '"' + strand + '"' + ";")
else:
# print("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + ";")
cursor1.execute("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + ";")
data = cursor1.fetchall()
# print data
context_genes = []
for row in data:
start,stop,strand,locus_tag,gi_code,cog,synonym,product = row
# print row
add_data = ""
cog_categories = []
gene_color = color
if color == "cog":
gene_color,cog_categories = get_cog_color(cog)
if color == "scl":
scl,gene_color = get_scl(nc_code,gi_code)
if gene_color == None:
#Like unknown, but lighter grey
gene_color = "#a9a7aa"
if color== "Custom":
if str(gi_code) in imported_custom_colors.keys():
gene_color = imported_custom_colors[str(gi_code)]
else:
gene_color = "white"
if feature == "gc_p":
gcp, gcp_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = gcp
if color == "scale_red_green":
gene_color = gcp_color
if feature == "gc_skew":
gc_skew, gc_skew_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = gc_skew
if color == "scale_red_green":
gene_color = gc_skew_color
if feature == "at_skew":
at_skew, at_skew_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = at_skew
if color == "scale_red_green":
gene_color = at_skew_color
if feature == "numeric_data":
try:
add_data = float(numeric_data_data[str(gi_code)][0])
gene_color = numeric_data_data[str(gi_code)][1]
except:
add_data = 0
gene_color = "white"
context_genes.append([start,stop,strand,locus_tag,gi_code,gene_color,synonym,product,cog_categories,add_data])
# print context_genes # empty
return context_genes
我理解的是规则:
if str(gi_code) in imported_custom_colors.keys():
gene_color = imported_custom_colors[str(gi_code)]
正在使用该模块。
同样的问题我问了那个做申请的人,他自己开发了模块,我还没拿到模块。
我正在扩展用 HTML、Javascript 和 Python 编写的基于 Web 的生物信息学工具。当 运行 应用程序时,其中一个脚本给出了错误:
[Fri Feb 27 13:22:27.528636 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: Traceback (most recent call last):, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528757 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: File "/var/www/localhost/cgi-bin/circular_handler_beta_v2.py", line 10, in <module>, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528787 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: import color_gradient, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.528828 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] AH01215: ImportError: No module named color_gradient, referer: http://localhost/circular/index.html
[Fri Feb 27 13:22:27.538274 2015] [cgi:error] [pid 1267] [client 127.0.0.1:45930] End of script output before headers: circular_handler_beta_v2.py, referer: http://localhost/circular/index.html
问题是无法导入调用 "color_gradient" 的模块。我尝试在 Google 上搜索在哪里可以找到并安装此模块,但没有得到令人满意且明确的答案。
有人知道在哪里可以找到和安装这个模块吗?
完整的脚本太渴望分享了,这里是模块使用的函数:
def get_genes(nc_code,strand,color):
cursor1 = conn.cursor()
if (strand == "+" or strand == "-"):
# print ("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + " AND strand = " + '"' + strand + '"' + ";")
cursor1.execute("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + " AND strand = " + '"' + strand + '"' + ";")
else:
# print("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + ";")
cursor1.execute("SELECT start,stop,strand,locus_tag,ncbi_gi,cog,synonym,product FROM gene WHERE nc_accession = " + '"' + nc_code + '"' + ";")
data = cursor1.fetchall()
# print data
context_genes = []
for row in data:
start,stop,strand,locus_tag,gi_code,cog,synonym,product = row
# print row
add_data = ""
cog_categories = []
gene_color = color
if color == "cog":
gene_color,cog_categories = get_cog_color(cog)
if color == "scl":
scl,gene_color = get_scl(nc_code,gi_code)
if gene_color == None:
#Like unknown, but lighter grey
gene_color = "#a9a7aa"
if color== "Custom":
if str(gi_code) in imported_custom_colors.keys():
gene_color = imported_custom_colors[str(gi_code)]
else:
gene_color = "white"
if feature == "gc_p":
gcp, gcp_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = gcp
if color == "scale_red_green":
gene_color = gcp_color
if feature == "gc_skew":
gc_skew, gc_skew_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = gc_skew
if color == "scale_red_green":
gene_color = gc_skew_color
if feature == "at_skew":
at_skew, at_skew_color = get_gene_statistical_data(nc_code,gi_code,feature)
add_data = at_skew
if color == "scale_red_green":
gene_color = at_skew_color
if feature == "numeric_data":
try:
add_data = float(numeric_data_data[str(gi_code)][0])
gene_color = numeric_data_data[str(gi_code)][1]
except:
add_data = 0
gene_color = "white"
context_genes.append([start,stop,strand,locus_tag,gi_code,gene_color,synonym,product,cog_categories,add_data])
# print context_genes # empty
return context_genes
我理解的是规则:
if str(gi_code) in imported_custom_colors.keys():
gene_color = imported_custom_colors[str(gi_code)]
正在使用该模块。
同样的问题我问了那个做申请的人,他自己开发了模块,我还没拿到模块。