def getPathListFromFile( pathFile ): lPaths = [] pathFileHandler = open( pathFile, "r" ) while True: line = pathFileHandler.readline() if line == "": break iPath = Path() iPath.setFromString( line ) lPaths.append( iPath ) pathFileHandler.close() return lPaths
def convertPathFileIntoSetFile( pathFile, setFile ): pathFileHandler = open( pathFile, "r" ) setFileHandler = open( setFile, "w" ) iPath = Path() while True: line = pathFileHandler.readline() if line == "": break iPath.setFromString( line ) iSet = iPath.getSubjectAsSetOfQuery() iSet.write( setFileHandler ) pathFileHandler.close() setFileHandler.close()
def convertPathFileIntoAlignFile(pathFile, alignFile): pathFileHandler = open( pathFile, "r" ) alignFileHandler = open( alignFile, "w" ) iPath = Path() while True: line = pathFileHandler.readline() if line == "": break iPath.setFromString( line ) iAlign = iPath.getAlignInstance() iAlign.write( alignFileHandler ) pathFileHandler.close() alignFileHandler.close()
def getDictOfListsWithIdAsKeyFromFile( pathFile ): dId2PathList = {} pathFileHandler = open( pathFile, "r" ) while True: line = pathFileHandler.readline() if line == "": break iPath = Path() iPath.setFromString( line ) if dId2PathList.has_key( iPath.id ): dId2PathList[ iPath.id ].append( iPath ) else: dId2PathList[ iPath.id ] = [ iPath ] pathFileHandler.close() return dId2PathList