📄 miner.java
字号:
for (mol = this.mols; mol != null; mol = mol.succ) { if (not != null) { /* if normal description */ if (norm) mol.makeCanonic(new MaxSrcExt(0, 0, null)); out.println(mol.id +"," +mol.group +"," +not.format(mol)); } else { /* if description in logic */ mol.toLogic(out); /* print molecule description */ out.println(((mol.group <= 0) ? "" : "in") +"active(\"" +mol.id +"\")."); out.println(); /* print activity indicator and */ } /* leave a line empty between mols. */ if ((++n & 0xff) == 0) { /* count all molecules and */ s = " " +n; /* if it is divisible by 256 */ System.err.print(s.substring(s.length()-8)); System.err.print("\b\b\b\b\b\b\b\b"); } /* print the number of molecules */ } /* that have been printed */ } /* print() */ /*------------------------------------------------------------------*/ private static int[] getRingSizes (String s) { /* --- get min. and max. ring size */ int i, n; /* loop variable */ int[] sizes; /* minimum and maximum ring size */ for (n = s.length(), i = 0; i < n; i++) if (s.charAt(i) == ':') /* try to find the separator for */ break; /* the minimum and maximum size */ sizes = new int[2]; /* create ring sizes vector */ if (i >= n) /* if there is only one number */ sizes[0] = sizes[1] = Integer.parseInt(s); else { /* if there are two numbers */ sizes[0] = Integer.parseInt(s.substring(0,i)); sizes[1] = Integer.parseInt(s.substring(i+1)); } /* parse minimum and maximum size */ if ((sizes[1] > 256) || (sizes[0] > sizes[1])) sizes[0] = sizes[1] = -1; /* check the given ring sizes */ return sizes; /* return the ring size range */ } /* getRingSizes() */ /*------------------------------------------------------------------*/ public void init (String args[]) throws IOException { /* --- init. a substructure miner */ int i, k = 0; /* indices, loop variables */ long t; /* for time measurements */ String s; /* to traverse the arguments */ String fn_mol = "moss.dat";/* name of molecule file */ String fn_sub = "moss.sub";/* name of substructure file */ String fn_ids = null; /* name of identifier file */ boolean logic = false; /* flag for Prolog description gen. */ boolean trans = false; /* flag for language translation */ float thresh = 0.5F; /* threshold for split */ boolean invert = false; /* whether to invert the split */ float psupp = 10.0F; /* minimum support of embedding */ float pcomp = 2.0F; /* maximum support in complement */ int smin = 1; /* min. and max. size of substructure */ int smax = Integer.MAX_VALUE; int smode = BONDEXT|PR_DEFAULT; /* default search mode */ int[] sizes = null; /* minimum and maximum size of rings */ int maxepm = 0; /* max. number of embeddings per mol. */ boolean kekule = true; /* convert Kekule reps. to aromatic */ String format = "smiles"; /* format for seed description */ String input = "smiles"; /* input format for molecules */ String output = "smiles"; /* output format for substructures */ String desc = ""; /* description of (seed) molecule */ String exat = ""; /* excluded atom types */ String exsd = ""; /* excluded seed types */ int matom, mbond; /* type masks for atoms and bonds */ int mrgat, mrgbd; /* type masks for atoms and bonds */ /* --- print startup/usage message --- */ if (args.length > 0) { /* if no arguments are given */ System.err.print (this.getClass().getName()); System.err.println(" - " +description); System.err.println(version +" " +copyright); } else { /* if no arguments are given */ System.out.print ("usage: java " +this.getClass().getName()); System.out.println(" [options] <seed> [<in>] [<out>] [<ids>]"); System.out.println(description); System.out.println(version +" " +copyright); System.out.print ("-t# threshold value for split "); System.out.println(" (default: " +thresh +")"); System.out.print ("-z invert split"); System.out.println(" (> versus <= instead of <= versus >)"); System.out.print ("-s# minimum support in focus "); System.out.println(" (default: " +psupp +"%)"); System.out.print ("-S# maximum support in complement "); System.out.println(" (default: " +pcomp +"%)"); System.out.print ("-m# minimum size of substructure "); System.out.println(" (default: " +smin +" atom(s))"); System.out.print ("-n# maximum size of substructure "); System.out.println(" (default: no limit)"); System.out.print ("-g use rightmost path extensions "); System.out.println(" (default: max. source)"); System.out.print ("+/-a match/ignore aromaticity of atoms"); System.out.println(" (default: ignore)"); System.out.print ("+/-c match/ignore charge of atoms "); System.out.println(" (default: ignore)"); System.out.print ("+/-d match/ignore atom type "); System.out.println(" (default: match)"); System.out.print ("+/-D match/ignore atom type in rings "); System.out.println(" (default: match)"); System.out.print ("+/-: upgrade/downgrade aromatic bonds "); System.out.println(" (default: extra type)"); System.out.print ("+/-b match/ignore bond type "); System.out.println(" (default: match)"); System.out.print ("+/-B match/ignore bond type in rings "); System.out.println(" (default: match)"); System.out.print ("-r#:# mark rings of size # to # bonds "); System.out.println(" (default: no marking)"); System.out.print ("-R extend with rings of marked sizes"); System.out.println(" (default: indiv. bonds)"); System.out.print ("-E bond-by-bond support-filtered"); System.out.println(" ring extensions (includes -O)"); System.out.print ("-O do not record fragments with open"); System.out.println(" rings of marked sizes"); System.out.print ("-K do not convert Kekule"); System.out.println(" representations to aromatic rings"); System.out.print ("-C find and match variable length"); System.out.println(" chains of carbon atoms"); System.out.print ("-x# atom types to exclude"); System.out.println(" (as a molecule, in seed format)"); System.out.print ("-y# seed types to exclude"); System.out.println(" (as a molecule, in seed format)"); System.out.print ("+/-P partial perfect extension pruning"); System.out.println(" (default: no /-)"); System.out.print ("+/-p full perfect extension pruning"); System.out.println(" (default: yes/+)"); System.out.print ("+/-e equivalent sibling pruning "); System.out.println(" (default: no /-)"); System.out.print ("+/-q canonical form pruning "); System.out.println(" (default: yes/+)"); System.out.print ("-f# seed format (smiles or sln) "); System.out.println(" (default: "+format+")"); System.out.print ("-i# input format (smiles or sln) "); System.out.println(" (default: "+input+")"); System.out.print ("-o# output format (smiles or sln) "); System.out.println(" (default: "+output+")"); System.out.print ("-M# maximal number of embeddings per "); System.out.println(" molecule (to save memory)"); System.out.print ("-N normalize fragment output form"); System.out.println(" (for result comparisons)"); System.out.print ("-v verbose output during search"); System.out.println(" (show search tree)"); System.out.print ("seed description of seed structure"); System.out.println(" to start from"); System.out.print ("in name of molecule input file "); System.out.println(" (default: \"" +fn_mol +"\")"); System.out.print ("out name of substructure output file "); System.out.println(" (default: \"" +fn_sub +"\")"); System.out.print ("ids name of molecule identifier file "); System.out.println(" (default: none)"); throw new IOException("no arguments given"); } /* print a usage message */ /* --- evaluate arguments --- */ matom = mrgat = Atom.TYPEMASK; /* set default masks */ mbond = mrgbd = Bond.TYPEMASK|Bond.RINGBOND; for (i = 0; i < args.length; i++) { s = args[i]; /* traverse the arguments */ if ((s.length() > 0) /* if the argument is an option */ && (s.charAt(0) == '-')) { if (s.length() < 2) /* check for an option letter */ throw new IOException("missing option"); switch (s.charAt(1)) { /* evaluate option */ case 't': thresh = Float.parseFloat(s.substring(2)); break; case 'z': invert = true; break; case 's': psupp = Float.parseFloat(s.substring(2)); break; case 'S': pcomp = Float.parseFloat(s.substring(2)); break; case 'm': smin = Integer.parseInt(s.substring(2)); break; case 'n': smax = Integer.parseInt(s.substring(2)); break; case 'g': smode |= RIGHTEXT; break; case 'a': matom &= ~Atom.AROMATIC; break; case 'c': matom &= ~Atom.CHARGEMASK; break; case 'd': matom &= ~Atom.TYPEMASK; mrgat &= ~Atom.TYPEMASK; break; case 'D': mrgat &= ~Atom.TYPEMASK; break; case ':': mbond &= Bond.DOWNGRADE; mrgbd &= Bond.DOWNGRADE; break; case 'b': mbond &= ~Bond.SAMETYPE; mrgbd &= ~Bond.SAMETYPE; break; case 'B': mrgbd &= ~Bond.SAMETYPE; break; case 'r': sizes = getRingSizes(s.substring(2)); break; case 'R': smode |= RINGEXT; break; case 'E': smode |= RINGEXT|MERGERINGS | CLOSERINGS|PR_UNCLOSE; break; case 'O': smode |= CLOSERINGS|PR_UNCLOSE; break; case 'K': kekule = false; break; case 'C': smode |= CHAINEXT; break; case 'x': exat = s.substring(2); break; case 'y': exsd = s.substring(2); break; case 'P': smode &= ~PR_PARTIAL; break; case 'p': smode &= ~PR_PERFECT; break; case 'e': smode &= ~PR_EQUIV; break; case 'q': smode &= ~PR_CANONIC; break; case 'l': trans = true; break; case 'L': logic = true; break; case 'f': format = s.substring(2); break; case 'i': input = s.substring(2); break; case 'o': output = s.substring(2); break; case 'M': maxepm = Integer.parseInt(s.substring(2)); break; case 'N': smode |= NORMFORM; break; case 'v': smode |= VERBOSE; break; default : throw new IOException( "unknown option -" +s.charAt(1)); } } /* set option variables */ else if ((s.length() > 0) /* if the argument is an option */ && (s.charAt(0) == '+')) { if (s.length() < 2) /* check for an option letter */ throw new IOException("missing option"); switch (s.charAt(1)) { /* evaluate option */ case 'a': matom |= Atom.AROMATIC; break; case 'c': matom |= Atom.CHARGEMASK; break; case 'd': matom |= Atom.TYPEMASK; mrgat |= Atom.TYPEMASK; break; case 'D': mrgat |= Atom.TYPEMASK; break; case ':': mbond &= Bond.UPGRADE; mrgbd &= Bond.UPGRADE; break; case 'b': mbond |= Bond.TYPEMASK; mrgbd |= Bond.TYPEMASK; break; case 'B': mrgbd |= Bond.TYPEMASK; break; case 'P': smode |= PR_PARTIAL; smode &= ~PR_PERFECT; break; case 'p': smode |= PR_PERFECT; smode &= ~PR_PARTIAL; break; case 'e': smode |= PR_EQUIV; break; case 'q': smode |= PR_CANONIC; break; default : throw new IOException( "unknown option +" +s.charAt(1)); } } /* set option variables */ else { /* if the argument is no option */ switch (k++) { /* evaluate non-option */ case 0: desc = s; break; case 1: fn_mol = s; break; case 2: fn_sub = s; break; case 3: fn_ids = s; break; default: throw new IOException("too many arguments"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -