Nonatomic expression error encountered with Intersection
- To: mathgroup at smc.vnet.net
- Subject: [mg53597] Nonatomic expression error encountered with Intersection
- From: Todd Allen <genesplicer28 at yahoo.com>
- Date: Wed, 19 Jan 2005 02:00:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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 portions of the above nested loops on their own, they seem to work, however things break down once placed in a loop structure. Any thoughts on why a loop or Intersection might generate the Nonatomic expression error?? Thanks for any advice you might have. Best regards, Todd __________________________________ Do you Yahoo!? All your favorites on one personal page ? Try My Yahoo! http://my.yahoo.com
- Follow-Ups:
- Re: Nonatomic expression error encountered with Intersection
- From: DrBob <drbob@bigfoot.com>
- Re: Nonatomic expression error encountered with Intersection