1. 你的基因组报告数据:
![](https://img.haomeiwen.com/i23394760/4cf445f891848ef9.png)
![](https://img.haomeiwen.com/i23394760/819d3cb51dc1de55.png)
![](https://img.haomeiwen.com/i23394760/6ceb3e285a279366.png)
2.工具的构建与对应的代码如下:
# Import Module
from tkinter import *
# Create Object
root = Tk()
root.title("R.A.U Genome Coverage Calculator")
#root.configure(bg='#2ECCFA')
# Set height and width
width = 650
height = 250
# Set Geometry and min, max size
root.geometry(f"{width}x{height}")
root.maxsize(width, height)
root.minsize(width, height)
# Create Label
Label(root, text="", font=(
"Helvetica", 18, "bold"), fg="black").pack()
# Funtion will calculate the value of x
def ratio_calculator():
# Get the value of spinbox using get() method
s11 = int(s1.get())
s22 = int(s2.get())
s33 = float(s3.get())
#s44 = int(s4.get())
# Formule Used
value =((s11/s22)*(s33/100), "x")
# change the text of label using config method
value_of_x.config(text=value)
# Create Frame
frame = Frame(root)
frame.pack()
# Create Spin Boxes
s1 = Spinbox(frame, from_=0, to=10000000, width=10,
font=("Helvetica", 14, "bold"),)
s1.pack(side=LEFT, padx=10, pady=10)
s2 = Spinbox(frame, from_=0, to=10000000, width=10,
font=("Helvetica", 14, "bold"))
s2.pack(side=LEFT, padx=10, pady=10)
s3 = Spinbox(frame, from_=0, to=10000000, width=10,
font=("Helvetica", 14, "bold"))
s3.pack(side=LEFT, padx=10, pady=10)
# Add Another Label
Label(frame, text="Genome Coverage", width=30, font=("Helvetica",
12, "bold"),
borderwidth=1, relief="solid").pack(side=LEFT,
padx=10,
pady=10)
# Add Another Frame
frame1 = Frame(root)
frame1.pack()
x_value = Label(frame1, text="The Genome Coverage is:",
font=("Helvetica", 18, "bold"))
x_value.pack(side=LEFT)
value_of_x = Label(frame1, text="",
font=("Helvetica", 18, "bold"))
value_of_x.pack(side=LEFT)
# Create Button
Button(root, text="Click To Calculate", borderwidth=2, width=15,
font=("Helvetica", 14, "bold"),
command=ratio_calculator, fg="red",
bg="#2ECCFA").pack(pady=20)
# Execute Tkinter
root.mainloop()
# 验证数据:
# number_of_bases_sequenced =1377024000
# estimated_genome_size= 4109798
# reads_placed_in_contigs= (1317332892/1377024000)
-
对于去除decimal points 以及对应的概念:
# 对于去除decimal points 以及对应的概念:
#To calculate the genome coverage, divide the number of bases sequenced by the estimated genome size,
# multiplied by % reads placed in contigs
# 如: 1,514,603,088 / 2,100,000 x (96% of reads placed) = 692x
number_of_bases_sequenced =1377024000
estimated_genome_size= 4109798
reads_placed_in_contigs= (1317332892/1377024000)
genome_coverage="{:.2f}".format((number_of_bases_sequenced/estimated_genome_size)*reads_placed_in_contigs)#print 2 decimal places
#format_float = "{:.2f}".format(genome_coverage)
#print(format_float)
print("%reads_placed_in_contigs=", "{:.2f}".format(reads_placed_in_contigs*100), "%") #print 2 decimal places
print("genome_coverage=", genome_coverage, "x")
#print((1377024000/ 4109798) *95.66/100)
-
此时,只需要将三个变量按照顺序输入以下三个框(从左到右即可!)
- number_of_bases_sequenced =1377024000
- estimated_genome_size= 4109798
- reads_placed_in_contigs= (1317332892/1377024000)=95.67
![](https://img.haomeiwen.com/i23394760/d1f78276a9f20280.png)
-
就得到:
![](https://img.haomeiwen.com/i23394760/573cddad9f562925.png)
3.将做好的软件打包成exe文件:
具体过程可以参考我之前的推文https://www.jianshu.com/p/dfb857796e78
即可完成,获得对应的exe程序文件!
网友评论