You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
index=-1# Since we compare with the previous start at -1 instead of 0 to jump one step and start with the first element as a previous value
# Since we will save the previous value on the current line iteration we need one extra made up value in both lists to make sure the last elment is saved
regions.append('end.extra')
listToCompress.append(['end.extra'])
forlineinregions:
current_region=line.split('.')
current_region=current_region[0]
ifnot(previous_region==[]):
ifprevious_region==current_region:
combine_temp+=listToCompress[index]
else:
combine_temp+=listToCompress[index]
newList.append(combine_temp)
combine_temp= []
index+=1
previous_region=current_region
# Removes the added elements to the input lists
regions.pop()
listToCompress.pop()
returnnewList
Will this not combine regions wrongly, if input regions aren't sorted. And how does this function differ from CombineRegionInfo in CombineRows_generator.py
def CombineRegionInfo(listToCompress, regions):
import re
current_region = []
combine_temp = {}
newList=[]
index=0 # Since we compare with the previous start at -1 instead of 0 to jump one step and start with the first element as a previous value
for line in regions:
current_region = re.split('\.|,|_',line)
if (current_region[0] == 'iSNP' or current_region[0] == 'iIndel' or current_region[0] == 'MSI'):
current_region[0] = "-".join([current_region[0],current_region[1],current_region[2]])
current_region[1] = "-".join([current_region[0],current_region[1],current_region[2]])
current_region[2] = "-".join([current_region[0],current_region[1],current_region[2]])
current_region = current_region[0]
if current_region in combine_temp.keys():
combine_temp[current_region]=combine_temp[current_region]+listToCompress[index]
else:
combine_temp[current_region]=listToCompress[index]
index+=1
newList = [v for v in combine_temp.values()]
# region_name = [k for k in combine_temp.keys()]
return newList
The text was updated successfully, but these errors were encountered:
CARtool/CombRegionInfo.py
Lines 2 to 35 in 9bb6b23
Will this not combine regions wrongly, if input regions aren't sorted. And how does this function differ from CombineRegionInfo in CombineRows_generator.py
The text was updated successfully, but these errors were encountered: