import re


def extract_rosettad(scfile, pdbname):
	"""Extracts relevant metrics from RosettaMP symdock scorefile"""
	infile = open(scfile, 'r')
	lines = infile.readlines()
	matches = []
	for i in range(2, len(lines)):
		if re.search(pdbname, lines[i]):
			matches.append(lines[i])
	lline = matches[-1] # last line
	data = lline.split()
	total_score = float(data[1])
	#rmsd = float(data[2])
	I_sc = float(data[2])
	#return total_score, rmsd, I_sc
	return total_score, I_sc