forked from ethanagb/SiLiCO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindChromosome.py
32 lines (29 loc) · 862 Bytes
/
findChromosome.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#################################
######### SiLiCO v. 1.0 #########
### (c)2016 Ethan A. G. Baker ###
##### ethanagbaker@pitt.edu #####
#################################
def findChromosome(start_pos,names,thresholdDict):
#Figure out which chromosome this is in
chromFound = False
while chromFound == False:
i=-1
while i < len(names):
i+=1
chromName = str(names[i])
if i-1 >= 0:
prevChromName = str(names[i-1])
if thresholdDict[prevChromName] < start_pos <= thresholdDict[chromName]:
selected_chrom = chromName
chromFound = True
if chromFound == True:
break
elif i-1 < 0: #chr1
if 0<=start_pos<=thresholdDict[chromName]:
selected_chrom = chromName
chromFound = True
if chromFound == True:
break
if chromFound == False: ##can be deleted.
sys.exit(2)
return selected_chrom