007
header, sequence = fasta.loadSingle(sys.argv[1])
 
 
009
def percentage(region, lookFor):
 
 
011
calculates the percentage of the sequence made up of lookFor
 
 
 
 
015
# iterate over each letter in the sequence, incrementing count if
 
 
017
for letter in region:
 
018
if letter in lookFor:
 
 
 
021
# return the percentage of this region
 
022
return float(count)/len(region)
 
 
024
# compute the number of regions
 
025
regions = (len(sequence)/REGIONSIZE) + 1
 
 
 
 
029
# for each region, get the sequence cooresponding to this region, and
 
 
031
for x in range(regions):
 
032
currentRegion = sequence[x * REGIONSIZE : (x + 1) * REGIONSIZE]
 
033
regionList.append(currentRegion)
 
034
print percentage(currentRegion, BPLOOKFOR)