linux上执行python,在Linux上执行python函数

我是Python新手,但真的很想在Linux服务器命令行上执行以下功能。请帮忙找出当我执行下面的脚本(test.py)时为什么没有打印出来?执行我键入python test.py。谢谢。在Linux上执行python函数

##!/usr/bin/python

def get_minimal_representation(pos, ref, alt):

"""

Get the minimal representation of a variant, based on the ref + alt alleles in a VCF

This is used to make sure that multiallelic variants in different datasets,

with different combinations of alternate alleles, can always be matched directly.

Note that chromosome is ignored here - in xbrowse, we'll probably be dealing with 1D coordinates

Args:

pos (int): genomic position in a chromosome (1-based)

ref (str): ref allele string

alt (str): alt allele string

Returns:

tuple: (pos, ref, alt) of remapped coordinate

"""

pos = int(pos)

# If it's a simple SNV, don't remap anything

if len(ref) == 1 and len(alt) == 1:

return pos, ref, alt

else:

# strip off identical suffixes

while(alt[-1] == ref[-1] and min(len(alt),len(ref)) > 1):

alt = alt[:-1]

ref = ref[:-1]

# strip off identical prefixes and increment position

while(alt[0] == ref[0] and min(len(alt),len(ref)) > 1):

alt = alt[1:]

print "Alt: ", alt

ref = ref[1:]

print "Ref: ", ref

pos += 1

print "Pos: ", pos

return pos, ref, alt

print "the result is: ", get_minimal_representation(pos = 1001, ref = "CTCC", alt = "CCC,C,CCCC")

+2

所有你正在做的是定义一个函数。你不叫它。 –

+0

我想我在这里调用它:'print'结果是:“,get_minimal_representation(pos = 1001,ref =”CTCC“,alt =”CCC,C,CCCC“)'否? –

+0

你想执行它什么?除了定义它之外,你必须调用函数,为了达到这个目的,你需要3个值传递给函数。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值