REpost: Nonatomic error associated with Intersection
- To: mathgroup at smc.vnet.net
- Subject: [mg53618] REpost: Nonatomic error associated with Intersection
- From: Todd Allen <genesplicer28 at yahoo.com>
- Date: Thu, 20 Jan 2005 03:48:11 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
(Re-post of previous message due to garbled characters...sorry for that (and thanks to Dr. Bob for the heads up on proper copy-paste methods). Hi everyone, I was hoping the usergroup might have some thoughts on a peculiar error message I have been receiving from Mathematica V 5.1(win XP). I have a set of nested loops where I try to compare the elements of two matrices using Intersection, and if there is indeed an intersection, make a change to one of the matrices. The code generates an error message: Intersection::normal: "Nonatomic expression expected at position 1....... I believe the Head of the two lists I am comparing are in fact lists, however perhaps I am missing something as to how mathemamatica parses the input. Below is the basic code: temp={{"CEST-01-A-01", "CEST-17-A-06"}, {"CEST-01-A-02", "CEST-01-A-06", "CEST-02-C-06", "CEST-03-B-03", "CEST-03-G-07", "CEST-05-C-11", "CEST-06-A-09", "CEST-08-B-07", "CEST-09-A-02", "CEST-12-A-06", "CEST-12-G-11", "CEST-16-C-02", "CEST-16-H-04", "CEST-17-A-04", "CEST-18-D-05", "CEST-19-C-01", "CEST-19-D-04", "CEST-19-G-01", "CEST-20-C-09", "CEST-20-G-08", "CEST-22-D-07", "CEST-22-D-11", "CEST-23-C-09", "CEST-26-G-08", "CEST-27-E-04", "CEST-27-E-12", "CEST-30-C-08", "CEST-30-E-03", "CEST-34-C-06", "CEST-34-F-04", "CEST-35-G-09", "CEST-36-A-01", "CEST-36-B-01", "CEST-37-F-03", "CEST-37-F-06", "CEST-45-A-10", "CEST-45-H-05", "CEST-46-D-03", "CEST-46-D-11", "CEST-48-D-01", "CEST-48-E-01", "CEST-50-E-09", "CEST-51-A-01", "CEST-51-C-09", "CEST-53-G-01", "CEST-54-C-12", "CEST-54-H-11", "CEST-55-E-01", "CEST-55-G-06", "CEST-57-C-12", "CEST-57-E-12", "CEST-59-F-05"}, {"CEST-01-A-04"}}; acontology={{"AEST-01-A-01", "blank", "None", "None"}, {"AEST-01-A-02", "CEST-01-A-01", "enzyme / ion transporter", "cell growth and/or maintenance / transport / ion transport"}, {"AEST-01-A-03", "CEST-01-A-02", "translation regulator / translation factor", "cell growth and/or maintenance / metabolism / biosynthesis"}}; outerindex = 1; innerindex = 1; While[outerindex <= Length[acontology], While[innerindex <= Length[temp], If[Length[Intersection[acontology[[outerindex]], temp[[innerindex]]]] == 1, acontology = Append[acontology[[outerindex]], temp[[innerindex]]]; innerindex = Length[temp] + 1, innerindex++]]; outerindex++; innerindex = 1]; The output I am hoping for is to progressively match components of each list to output as follows: Given input: Append[acontology[[2]], temp[[1]]] Desired output: {"AEST-01-A-02", "CEST-01-A-01", "enzyme / ion transporter", "cell growth and/or maintenance / transport / ion transport", {"CEST-01-A-01", "CEST-17-A-06"}} When I have used various statements contained within the above nested loops on their own, they seem to work fine....however things fall apart onces put inside a loop structure. Any thoughts on why a loop or Intersection might generate the Nonatomic expression error? Thanks again for any thoughts!! Best regards, Todd __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
- Follow-Ups:
- Re: REpost: Nonatomic error associated with Intersection
- From: DrBob <drbob@bigfoot.com>
- Re: REpost: Nonatomic error associated with Intersection