From pmr at ebi.ac.uk Fri Mar 28 12:03:37 2008 From: pmr at ebi.ac.uk (Peter Rice) Date: Fri, 28 Mar 2008 16:03:37 +0000 Subject: [emboss-dev] [EMBOSS] list and label values In-Reply-To: <47ECFE1B.30109@unil.ch> References: <47ECFE1B.30109@unil.ch> Message-ID: <47ED16D9.4020906@ebi.ac.uk> Sebastien Moretti wrote (to emboss at open-bio.org): > Hi, > > I am looking for a way to use labels/alias for values in a list: > > variable: matrixpath "/usr/molbio/share" > > list: matrix [ > default: "$(matrixpath)/Hs.smat" > minimum: 1 > maximum: 1 > values: "Human:$(matrixpath)/Hs.smat, > Arabidopsis:$(matrixpath)/At.smat, Rat:$(matrixpath)/Rn.smat, > Drosophila:$(matrixpath)/Dm.smat, Chicken:$(matrixpath)/Gga.smat, > Mouse:$(matrixpath)/Mm.smat, Zebrafish:$(matrixpath)/Dr.smat" > delimiter: "," > codedelimiter: ":" > comment: "defaults" > prompt: "Score matrices file, species specific" > information: "Score matrices file, species specific" > ] > > > So, when I select 'Human', I would like that "$(matrixpath)/Hs.smat" > appears in command line. The values string is unchanged in EMBOSS 5.0.0 You need to resolve the variable (the $(matrixpath) in two places. In ajax/ajacd.c function acdListPrompt add an extra acdVarResolve call once "value" has been assigned: ajStrAssignS(&value, acdAttrValue(thys, "value")); acdVarResolve(&value); .. this will resolve the variables for the prompt (if you define standard: "Y" for matrix) and the same in acdListValue so the variables are resolved when the user value is tested. The same changes are needed for acdSelectPrompt and acdSelectValue if you use a selection instead of a list. But there is another way ... in general, we define the path separately as ACD type "directory" if we allow the user to change it, or hard code it and use a Unix environment variable if the user needs to customize it. In your case you obviously have a fixed path, but it has to be hardcoded somewhere because what is passed to the application is the string "Human". One more change ... with a long "short value" like "Arabidopsis" the printed list looks untidy. For the next release we can test for the longest name and adjust the margin. Hope that helps Peter From pmr at ebi.ac.uk Fri Mar 28 16:03:37 2008 From: pmr at ebi.ac.uk (Peter Rice) Date: Fri, 28 Mar 2008 16:03:37 +0000 Subject: [emboss-dev] [EMBOSS] list and label values In-Reply-To: <47ECFE1B.30109@unil.ch> References: <47ECFE1B.30109@unil.ch> Message-ID: <47ED16D9.4020906@ebi.ac.uk> Sebastien Moretti wrote (to emboss at open-bio.org): > Hi, > > I am looking for a way to use labels/alias for values in a list: > > variable: matrixpath "/usr/molbio/share" > > list: matrix [ > default: "$(matrixpath)/Hs.smat" > minimum: 1 > maximum: 1 > values: "Human:$(matrixpath)/Hs.smat, > Arabidopsis:$(matrixpath)/At.smat, Rat:$(matrixpath)/Rn.smat, > Drosophila:$(matrixpath)/Dm.smat, Chicken:$(matrixpath)/Gga.smat, > Mouse:$(matrixpath)/Mm.smat, Zebrafish:$(matrixpath)/Dr.smat" > delimiter: "," > codedelimiter: ":" > comment: "defaults" > prompt: "Score matrices file, species specific" > information: "Score matrices file, species specific" > ] > > > So, when I select 'Human', I would like that "$(matrixpath)/Hs.smat" > appears in command line. The values string is unchanged in EMBOSS 5.0.0 You need to resolve the variable (the $(matrixpath) in two places. In ajax/ajacd.c function acdListPrompt add an extra acdVarResolve call once "value" has been assigned: ajStrAssignS(&value, acdAttrValue(thys, "value")); acdVarResolve(&value); .. this will resolve the variables for the prompt (if you define standard: "Y" for matrix) and the same in acdListValue so the variables are resolved when the user value is tested. The same changes are needed for acdSelectPrompt and acdSelectValue if you use a selection instead of a list. But there is another way ... in general, we define the path separately as ACD type "directory" if we allow the user to change it, or hard code it and use a Unix environment variable if the user needs to customize it. In your case you obviously have a fixed path, but it has to be hardcoded somewhere because what is passed to the application is the string "Human". One more change ... with a long "short value" like "Arabidopsis" the printed list looks untidy. For the next release we can test for the longest name and adjust the margin. Hope that helps Peter