Skip to content

Conversation

@yhlhhhhh
Copy link
Contributor

新定义了Get_MT(),Get_Simple_MT(length),Get_Y(),Get_Simple_Y(length)四种函数,方便了对于输入单倍群的处理

新定义了Get_MT(),Get_Simple_MT(length),Get_Y(),Get_Simple_Y(length)四种函数,方便了对于输入单倍群的处理
Copy link
Contributor

@xraywu xraywu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 请勿使用全局变量
  2. 实际逻辑有误,比如 Get_Simple_Y() 中 counter 初始化为 0,length != 1 时不可能进入循环,见下方 DEMO
def Get_Simple_Y(length, user_y):
    if len(user_y) == 1:
        Simple_y = user_y
    else:
        letter_list = re.split('\d',user_y)
        number_list = re.split('\D',user_y)
        counter = 0
        Simple_y = ''
        while length - 1 == counter:
            if isinstance(counter,int) == True:
                Simple_y += letter_list[counter]
                counter += 1
            else:
                Simple_y += number_list[counter]
    return Simple_y

print(Get_Simple_Y(2,'E1b1a1a1a2a1a3a2a1a10'))
  1. 实际情况中单倍群命名更复杂,比如 MT 的 L1’2’3’4’5’6、Y 的 CT 等,边缘情况均未处理
  2. 请 follow 项目的代码风格及命名规则

@yhlhhhhh
Copy link
Contributor Author

  1. 请勿使用全局变量
  2. 实际逻辑有误,比如 Get_Simple_Y() 中 counter 初始化为 0,length != 1 时不可能进入循环,见下方 DEMO
def Get_Simple_Y(length, user_y):
    if len(user_y) == 1:
        Simple_y = user_y
    else:
        letter_list = re.split('\d',user_y)
        number_list = re.split('\D',user_y)
        counter = 0
        Simple_y = ''
        while length - 1 == counter:
            if isinstance(counter,int) == True:
                Simple_y += letter_list[counter]
                counter += 1
            else:
                Simple_y += number_list[counter]
    return Simple_y

print(Get_Simple_Y(2,'E1b1a1a1a2a1a3a2a1a10'))
  1. 实际情况中单倍群命名更复杂,比如 MT 的 L1’2’3’4’5’6、Y 的 CT 等,边缘情况均未处理
  2. 请 follow 项目的代码风格及命名规则

好的👌我有时间再改改,谢谢(≧∇≦)/

目前先把get_mt( ),get_y( )和to_markdown_table( )这三个函数加上,先用着吧吧,get_simple_mt( )和get_simple_y( )这两个函数可能还要修改一段时间。
目前先加这三个函数先用着:get_mt( ), get_y( ), to_markdown_table( )
get_simple_mt( ), get_simple_y( )稍后再加
Add 5 functions: get_mt( ), get_y( ), get_simple_mt( ), get_simple_y( ), to_markdown_table( )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants