저는 파이썬을 처음 사용 합니다만, 리눅스 서버 명령 행에서 다음 함수를 실행하고 싶습니다. 다음 스크립트 (test.py)를 실행할 때 아무 것도 인쇄되지 않는 이유를 알아내는 데 도움이됩니까? 실행하려면 python test.py
을 입력하십시오. 고맙습니다.리눅스에서 파이썬 기능 실행
##!/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")
모두 당신이하는 일은 기능을 정의하는 것입니다. 넌 그걸 부르지 않을거야. –
"print"결과는 다음과 같습니다 : ", get_minimal_representation (pos = 1001, ref ="CTCC ", alt ="CCC, C, CCCC ") 아니요? – user3781528
무엇을 실행하고 싶습니까? 함수를 정의하는 것 외에도 함수를 호출해야하며이를 수행하려면 함수에 전달할 3 개의 값이 필요합니다. – chepner