Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Read tree from external file (Read 2118 times)
NP
YaBB Newbies
*
Offline



Posts: 11
Read tree from external file
May 15th, 2008 at 10:56am
 
Hi!

I would like to know if itīs possible to retrieve a tree from an external file, so that I could avoid changing the content of the *.bf file each time I use a different tree.

I am pasting below the code I am using. There I would like to define the variable "tree" by using an external tree in newick format.

Thanks in advance!

Nico.-


Code:
fscanf (classtotal, "Number", len);
fscanf (numDecoys, "Number", numDec);
fscanf (PDBactual, "String", pdb);


REPLACE_TREE_STRUCTURE = 1;
DataSet scpemDataSet = ReadDataFile ("./"+pdb+"_hssp.phy");

tree ="((((((Q6LXC3_MET:1.0,(Q2NE53_MET:1.0,Q8TUF5_MET:1.0):1.0):1.0,((((((A1D3Y9_9EU:1.0,Q1E154_COC:1.0):1.0,((Q4RHC2_TET:1.0,RPC11_MOUS:1.0):1.0,Q55P07_CRY:1.0):1.0):1.0,Q61A37_CAE:1.0):1.0,(Q7QXB3_GIA:1.0,Q61W07_CAE:1.0):1.0):1.0,(Q8ZTX9_PYR:1.0,Q9YEZ3_AER:1.0):1.0):1.0,((Q96YA8_SUL:1.0,RPOM_SULAC:1.0):1.0,(A0WU61_9CR:1.0,Q0Y5C9_THE:1.0):1.0):1.0):1.0):1.0,(Q8U264_PYR:1.0,(O58397_PYR:1.0,Q9UYX7_PYR:1.0):1.0):1.0):1.0,Q5JF34_PYR:1.0):1.0,1qyp:1.0):1.0,Q4TTY9_9EU:1.0);";



/*Define and optimize model = JTT*/

    lkJTT=0;
    for(i=0;i<len;i=i+1){

	  ExecuteCommands("#include \"Jones1.mdl\";");
	  ExecuteCommands("Tree treeh0"+i+" = tree;");
	  ExecuteCommands("DataSetFilter classh0"+i+" = CreateFilter (scpemDataSet,1,\""+i+"\",\"\");");
	  ExecuteCommands("LikelihoodFunction lkh0"+i+"= (classh0"+i+",treeh0"+i+");");
	  ExecuteCommands("Optimize (paramsh0"+i+", lkh0"+i+");");
	  ExecuteCommands("lkJTT = paramsh0"+i+"[1][0] + lkJTT;");
	  ExecuteCommands("fprintf(site-"+pdb+"-JTT.out,paramsh0"+i+"[1][0],\"\n\");");

    }

    ExecuteCommands("fprintf(total-"+pdb+"-JTT.out, lkJTT,\"\n\");");


 

Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Read tree from external file
Reply #1 - May 15th, 2008 at 11:00am
 
Dear Nico,

You can simply call

Code:
fscanf (fileName,"String",tree)
 



Where fileName is a string variable pointing to the file that contains the tree string.

HTH,
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
 
Art Poon
Global Moderator
*****
Offline


Feed your monkey!

Posts: 0
Re: Read tree from external file
Reply #2 - May 15th, 2008 at 11:02am
 
Hi Nico,

To add to Sergei's comment (too fast!), you can replace fileName with PROMPT_FOR_FILE in order to raise an interactive window for selecting a file at runtime.

Cheers,
- Art.
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Read tree from external file
Reply #3 - May 15th, 2008 at 11:10am
 
Tired of conference lectures: sitting in a coffee shop in Santa Fe, watching the rain outside, helping people get HyPhy:)
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
 
NP
YaBB Newbies
*
Offline



Posts: 11
Re: Read tree from external file
Reply #4 - May 15th, 2008 at 11:18am
 
You both are absolutely amazing for such immediate and proper answers!
Thanks a lot indeed.
Back to top
 
 
IP Logged