Ron,

Untested, but I believe you need something like the following:

function findmatches theData,theNumber,theTolerance
  put char 1 to -2 of theNumber into myTempNr
  filter theData with "|*" & tab & "*" & tab & myTempNr & "*" & tab
  set the itemDel to tab
  repeat for each line myLine in theData
    if (item 3 of myLine >= theNumber - theTolerance) and \
    (item 3 of myLine <= theNumber + theTolerance) then
    put myLine & cr after myNewData
  end repeat
  return myNewData
end findMatches

I didn't see any brackets in your e-mail, but I did see a "|" at the beginning of each line. Maybe you need to adjust the script for that.

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http;//www.salery.com

Quickly extract data from your HyperCard stacks with DIFfersifier. http://differsifier.economy-x-talk.com


Op 14-jul-2007, om 9:32 heeft Beynon, Rob het volgende geschreven:

I don't want to be accused of passing effort out to the list, but I would like to know, from the experts, the fastest way to execute some code..



I have a file of tab delimited items like so...16,000 lines long read into a single variable. (The right bracket is part of the file, not a quote mark)

<snip data>

I now want to search each line, and match an input number (obsMass) against the third item of each line (pepMass)

If it matches, within a certain tolerance (expressed in parts per million (ppm) - the tolerance changes with the magnitude of the number) I want to do something with that line. Ties (or multiple hits to the same obsMass) are OK.



I then want to repeat that process for several thousand different values of obsMass. In other words, I will evaluate the mass matching loop tens of millions of times.



Some questions - is there advantage in sorting the list by mass first?

Would I gain speed by using integer arithmetic (is that even possible?) or by matching the numbers as strings?



And most importantly..

Is there an elegant rev way of handling this that I don't even know about?!

Thanks

Rob





________________________________

Prof R J Beynon[h]
Proteomics and Functional Genomics Group
Faculty of Veterinary Science
University of Liverpool
Crown Street, Liverpool L69 7ZJ

________________________________

Phone: +44 151 794 4312

Fax: +44 151 794 4243

Email: [EMAIL PROTECTED]

http://www.liv.ac.uk/pfg

________________________________



_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to