Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Scripting Language problem (Read 1951 times)
nathanclark111
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 6
Scripting Language problem
Apr 21st, 2008 at 1:55pm
 
Hi, I've got a task that should be simple, but I can't find the correct way to script it.  I'd like to iterate through gene comparisons, and I wrote the following portion of script to demonstrate my problem.


genes = {};  /* an array listing all genes in the analysis */
genes [0] = "gene1";
genes [1] = "gene2";
genes [2] = "gene3";
   n = 2;  /* Scalar of the array. */
fprintf(stdout,"Gene List:",genes,"\n");

fprintf(stdout,"The following comparisons will be made:\n");
for(i=0;i<=n;i=i+1) {
     for(j=i+1;j<=n;j=j+1) {
           fprintf (stdout,genes[i]," versus ",genes[j],"\n");
     }
}


The script should list all genes in the array and then print all comparisons between them. However, it gives me the following output:


Gene List:_hyphyAssociativeArray={};
_hyphyAssociativeArray["0"] = "gene1";
_hyphyAssociativeArray["1"] = "gene2";
_hyphyAssociativeArray["2"] = "gene3";

The following comparisons will be made:
1          0          0         
2          0          0         
3          0          0         


I apologize if this is something basic, but I've struggled with it for a while. (I'm running HYPHY in the Terminal on a MacBook with Intel Core Duo processor).
Thanks for your help,
-Nathan
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Scripting Language problem
Reply #1 - Apr 21st, 2008 at 2:11pm
 
Dear Nathan,

I just tried the code on the latest HyPhy build and got the correct results:

Code:
Gene List:_hyphyAssociativeArray={};
_hyphyAssociativeArray["0"] = "gene1";
_hyphyAssociativeArray["1"] = "gene2";
_hyphyAssociativeArray["2"] = "gene3";

The following comparisons will be made:
gene1 versus gene2
gene1 versus gene3
gene2 versus gene3
 



Could you check that the version of HyPhy that you are running is current?
Anything within the last year or so should be able to run your code correctly.
You can check the version by launching HyPhy from the terminal without any arguments
(from inside the install directory so that the list of standard analyses comes up)
and looking at the top of the screen, e.g.

Code:
	 /HYPHY 1.0020080310beta(MP) for Darwin on i386\
***************** TYPES OF STANDARD ANALYSES *****************
 



The version string also encodes the build date (i.e. 20080310 in this case).

Cheers,
Sergei


Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
nathanclark111
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 6
Re: Scripting Language problem
Reply #2 - Apr 21st, 2008 at 2:50pm
 
Sergei,
I've downloaded the newest Source and am now running:
        /HYPHY 1.0020080414beta for Darwin on i386\   

It seems to have worked. Many thanks for your help!
-Nathan
Back to top
 
 
IP Logged