Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package dl.tmp;
 
 
 
public class CheckInChIAgreement {

Parameters:
args
Throws:
java.lang.Exception
	public static void main(String[] argsthrows Exception {
		BufferedReader inputReference = new BufferedReader(
						"C:/My Documents/OPSIN/TrainingSets/monomerNamesAndInChINew.txt"));
		BufferedReader inputSMILES = new BufferedReader(
						"C:/My Documents/OPSIN/resources/newMonomerNamesReferenceSMILES.txt"));	
		BufferedReader inputOPSIN = new BufferedReader(
						"C:/My Documents/OPSIN/resources/newMonomerNamesInChIs.txt"));
		BufferedReader inputChemDraw = new BufferedReader(
						"C:/My Documents/OPSIN/resources/newMonomerNamesInchisFromChemDraw.txt"));
		BufferedWriter output = new BufferedWriter(
						"C:/My Documents/OPSIN/resources/monomerNamesResults.txt"));
		try {
			String line = null;
			int totalNames=0;
			while ((line = inputReference.readLine()) != null) {
				String opsinInChIOrg =inputOPSIN.readLine();
				String opsinInChI = InchiPruner.mainAndChargeLayers(opsinInChIOrg);
				String chemDrawInChIOrg = inputChemDraw.readLine();
				String chemDrawInChI = InchiPruner.mainAndChargeLayers(chemDrawInChIOrg);
				String smiles = inputSMILES.readLine();
				String referenceInChI= InchiPruner.mainAndChargeLayers(line.split("\t")[1]);
				totalNames++;
				if (!opsinInChI.equals("") && !chemDrawInChI.equals("")){
					if (!opsinInChI.equals(referenceInChI) && !chemDrawInChI.equals(referenceInChI)){
						if (opsinInChI.equals(chemDrawInChI)){
							output.write("Incorrect SMILES?:\t");
							output.write(smiles);
							output.write("\t" +opsinInChIOrg);
							output.write("\t" +chemDrawInChIOrg);
							output.write("\n");
						}
						else{
							output.write("Ambiguous name?:\t");
							output.write(smiles);
							output.write("\t" +opsinInChIOrg);
							output.write("\t" +chemDrawInChIOrg);
							output.write("\n");
						}
					}
				}
			}
finally {
			inputReference.close();
			inputOPSIN.close();
			inputChemDraw.close();
			output.close();
		}
	}
New to GrepCode? Check out our FAQ X