Re: [Open Babel] Count Molecules

2013-08-21 Thread Geoffrey Hutchison
> Note that an output format is not used but something still has to be there. > Writing the functionality as an output format -ocount as suggested by Noel > would be clearer but I didn't find it easy to do. I suspect the op will be slightly faster than an output format due to overhead. -Geoff

Re: [Open Babel] Count Molecules

2013-08-21 Thread Dimitri Maziuk
On 08/21/2013 10:41 AM, Chris Morley wrote: > obabel 10dataset.sdf -onul --count ... > Note that an output format is not used but something still has to be > there. Writing the functionality as an output format -ocount as > suggested by Noel would be clearer but I didn't find it easy to do. Off

Re: [Open Babel] Count Molecules

2013-08-21 Thread Chris Morley
On 17/08/2013 20:09, Chris Swain wrote: Is there a way to simply count the number of molecules in a file? There is an API command OBConversion::NumInputObjects() which works with most multi-molecule formats (although it looks faulty for mol2). It is currently not exposed in the obabel interfa

Re: [Open Babel] Count Molecules

2013-08-21 Thread Maciek Wójcikowski
Hello, For sets that are not extremly big (as it could get quite long), I'd suggest converting to smiles and counting the lines: obabel input.mol2 -o smi | wc -l Pozdrawiam, | Best regards, Maciek Wójcikowski mac...@wojcikowski.pl 2013/8/20 Dimitri Maziuk > On 08/20/2013 12:32 PM, Noe

Re: [Open Babel] Count Molecules

2013-08-20 Thread Dimitri Maziuk
On 08/20/2013 12:32 PM, Noel O'Boyle wrote: > I usually use grep too, but I understand what you're saying - it's a > common task we should automate (e.g. "-ocount"). In the meanwhile, you > could speed it up quite a bit by turning off some of the perception, > i.e. -aT (read title only). python: c

Re: [Open Babel] Count Molecules

2013-08-20 Thread Noel O'Boyle
I usually use grep too, but I understand what you're saying - it's a common task we should automate (e.g. "-ocount"). In the meanwhile, you could speed it up quite a bit by turning off some of the perception, i.e. -aT (read title only). - Noel On 18 August 2013 07:35, Chris Swain wrote: > Hi, >

Re: [Open Babel] Count Molecules

2013-08-17 Thread Chris Swain
Hi, Thanks for the suggestions At the moment I use /usr/local/bin/obabel '/Users/swain/Desktop/acetophenones.sdf' -onul -v 'F' 2>&1 |cut -d " " -f1 Which does work but I was wondering if there was a command I was missing Cheers Chris On 18 Aug 2013, at 03:13, "S.L. Chan" wrote: > If

Re: [Open Babel] Count Molecules

2013-08-17 Thread S.L. Chan
If it is for an SD file and if you are on unix, you could do   fgrep -c "M  END" or   fgrep -c '' Just check that the last line is also '', otherwise you may have to add 1. If it is for a mol2 file, you could do   fgrep -c "@ATOM" If you are on Windows, open a DOS prompt and substit