Example #1
0
	def load(self):
		with open(self.std_file,'rU') as f:
		    for i in range(9):
		        f.readline() # remove heads
		    for line in f:
		        split_line = line.split(',')
		        polarity = split_line[4]
		        rts = split_line[9] # observed, not predicted
		        if rts == '-':
		            rt = 0.0
		        else:
		            rt = float(rts)
		        if polarity == '+' and rt > 0.0:
		            name = split_line[2]
		            formula = split_line[3]
		            f = Formula(formula)
		            new_mol = Mol(name,formula,f.compute_exact_mass(),rt*60.0)
		            self.mols.append(new_mol)
			self.mols = sorted(self.mols,key = lambda x: x.mass)