Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Relative rate test on synonymous and non synonymou (Read 4376 times)
Darrell
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 4
Relative rate test on synonymous and non synonymou
Oct 22nd, 2009 at 10:04am
 
Hello
I'm trying to use hyhpy to find the relative rates of 15,229 files.  I created a batch file and can successfully run it on my files. But I have three problems I was hoping you could help me with:

1. I need to use HKY87 global to analyses the files.  I tried to use:

HarvestFrequencies(obsFreqs,filteredData,1,1,1);
HKY85RateMatrix = {{*,b,a,b}{b,*,b,a}{a,b,*,b}{b,a,b,*}};

Model HKY85 = (HKY85RateMatrix, obsFreqs);
UseModel(HKY85);

as my filter and matrix, but I don't get the same result as when I run the
relative rate test from the Hyphy Gui. Is there some kind of UseThisModel( HKY87 ) function I can use to get the default model?  Secondly, tell it which parameters to use?

2. I would like to find the relative rates of synonymous and nonsynonymous versions of the nucleotide data.  I have no Idea how to do this

3. do you have any tips you for speed up the process of running this many files?


Alternative methods:

Is there any way I can run this from the command line using HYPHYMP?

$ HYPHYMP  TemplateBatchFiles/RelativeRate.bf

this works, but I don't know how to add parameters.

Could I use the 'ExportLikelihoodFunction' function, my icon never becomes available when I run the relative rate test.
Back to top
 
 
IP Logged
 
wayne
Global Moderator
*****
Offline


I love YaBB 1G - SP1!

Posts: 57
San Diego, CA
Gender: male
Re: Relative rate test on synonymous and non synonymou
Reply #1 - Oct 22nd, 2009 at 11:25am
 
Hi Darrell

to process multiple files you can use a wrapper file.

Code:
_rrOptions = {};

SetDialogPrompt ( "Provide a list of files to process:" );
fscanf          (PROMPT_FOR_FILE, "Lines", _filesToProcess );

SetDialogPrompt ( "Provide a list of outgroups:" );
fscanf 		(PROMPT_FOR_FILE, "Lines", _outgroups );

_rrOptions ["00"] = "Nucleotide/Protein";

_rrOptions ["03"] = "HKY85";
_rrOptions ["04"] = "Global";

for ( _fileLine = 0; _fileLine < Columns ( _filesToProcess ); _fileLine = _fileLine + 1 ) {
	_rrOptions ["01"] = _filesToProcess [ _fileLine ];
	_rrOptions ["02"] = _outgroups [ -fileLine ];
	ExecuteAFile ("/Applications/hyphy/HYPHY/TemplateBatchFiles/RelativeRate.bf", _rrOptions );
}

 



this file will require two input files: one with the exact paths to the files to process, and another with the outgroups for each of the input files. Obviously these need to be in the same order. To get the first you could use the unix find command.

Code:
 find `pwd` -name "*.nex" > nexus.files  



If the outgroup is the same for all the files you could remove the second fscanf in the wrapper and simply hardcode the name of the outgroup with
Code:
 _rrOptions ["02"] = "myoutgroup";  



and remove the corresponding line from the for loop.

You will also need to edit the location of the batch file in the ExecuteAFile command.

I think that answers your third question.

re the others

1. you need to set the ti/tv parameter to global.

in the case of HKY85 we use

Code:
global R=0.3250146192987597;HKY85={4,4};
HKY85[0][1]:=R*a;
HKY85[0][2]:=a;
HKY85[0][3]:=R*a;
HKY85[1][0]:=R*a;
HKY85[1][2]:=R*a;
HKY85[1][3]:=a;
HKY85[2][0]:=a;
HKY85[2][1]:=R*a;
HKY85[2][3]:=R*a;
HKY85[3][0]:=R*a;
HKY85[3][1]:=a;
HKY85[3][2]:=R*a;

 



here R represents the ti:tv and is shared across all branches. a is a branch length parameter independent for each branch.

2. I'm not sure we have a syn and non-syn relative rates implementation. if you look at the result from ExportLikelihoodFunction there are constraints placed on the branches.

Code:
constrained3TaxaTree.Ingroup2.a=0.05138303096204919;
constrained3TaxaTree.OutGroup.a=0.3247689253900513;
constrained3TaxaTree.Ingroup1.a:=constrained3TaxaTree.Ingroup2.a;
 



in order to do syn and non-syn relative rates tests, you would need to
i. set up a codon model
ii. have separate branch length parameters for syn and nonsyn rates
iii. place constraints on syn and nonsyn rate independently

something like

Code:
constrained3TaxaTree.Ingroup2.synrate=0.05138303096204919;
constrained3TaxaTree.OutGroup.synrate=0.3247689253900513;
constrained3TaxaTree.Ingroup1.synrate:=constrained3TaxaTree.Ingroup2.synrate;

 



It wouldn't be too difficult to implement, but may be duplication if it is already done. Sergei is on leave till Monday. Let me bounce it off him when he returns.

hope this helps somewhat

cheers ./w
Back to top
 

Assistant Project Scientist&&Antiviral Research Center&&Department of Pathology&&University of California, San Diego
WWW WWW  
IP Logged
 
wayne
Global Moderator
*****
Offline


I love YaBB 1G - SP1!

Posts: 57
San Diego, CA
Gender: male
Re: Relative rate test on synonymous and non synonymou
Reply #2 - Oct 22nd, 2009 at 11:27am
 
can't understand why you can't export the likelihood function. there is a user actions button in the bottom right. alternatively you can call the batch file directly from /hyphy/trunk/UserAddins

cheers ./w
Back to top
 

Assistant Project Scientist&&Antiviral Research Center&&Department of Pathology&&University of California, San Diego
WWW WWW  
IP Logged
 
Darrell
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 4
Re: Relative rate test on synonymous and non synonymou
Reply #3 - Oct 22nd, 2009 at 12:19pm
 
Thank you for responding so quickly, but I still have a problem.  Each of my files has three sets of nucleotide data.  The first two are ingroups, and the last is the outgroup.  Is there any simple way to tell it to use the third set in each file as the outgroup instead of looking in a different file?  The outgroup name will always begin with ">ENSMUST00".  Also, where can I look at the documentation for the options for RelativeRate.bf?  Thanks again for your help.
Back to top
 
 
IP Logged
 
Art Poon
Global Moderator
*****
Offline


Feed your monkey!

Posts: 0
Re: Relative rate test on synonymous and non synonymou
Reply #4 - Oct 22nd, 2009 at 4:45pm
 
Hi Darrell,

You can also export a likelihood function by using an fprintf statement as follows:

Code:
LIKELIHOOD_FUNCTION_OUTPUT = 7;		/* save LF to file */
fprintf(/* path to file here*/, codon_lf);
LIKELIHOOD_FUNCTION_OUTPUT = 2;		/* reset to default */
 



This is handy in a non-interactive setting when you're applying the same batch script to a lot of files.

As for your other problem, that's more of a challenge because you need an automated method of locating an internal branch in the tree based on, say, a regular expression on taxon names.  Presumably the trees are of different size or topology so you cannot count on the internal node name to be the same in every case.  The first thing that comes to mind is to write a routine that traces parentage up from all tips matching your regular expression until they converge to the same internal node.  Not trivial but do-able.  Smiley

Cheers,
- Art.
Back to top
 
 
IP Logged
 
Art Poon
Global Moderator
*****
Offline


Feed your monkey!

Posts: 0
Re: Relative rate test on synonymous and non synonymou
Reply #5 - Oct 22nd, 2009 at 4:47pm
 
Alternatively if you can assign user-defined internal node names in your tree files outside of HyPhy, and provide that info via some sort of lookup table then you're in business.
And the HBL command you'll need is RerootTree(treeID,branchID).
-A.
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Relative rate test on synonymous and non synonymou
Reply #6 - Oct 23rd, 2009 at 1:29am
 
Hi Darrell,

You can read the name of the third sequence from a file and pass it on to RelativeRates.bf, e.g.

Code:
DataSet myAlignment = ReadDataFile (path_to_file);
GetString (thirdTaxon, myAlignment,2);
 



If you add this to the code that Wayne pasted in, you should be able to have a functional wrapper.

RelativeRate.bf has some really old documentation at Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login

Cheers,
Sergei

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
 
Darrell
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 4
Re: Relative rate test on synonymous and non synonymou
Reply #7 - Oct 23rd, 2009 at 11:45am
 
Yay, it works, and by using:
_rrOptions ["00"] = "Codon";
_rrOptions ["01"] = "Universal";
_rrOptions ["04"] = "GY94";
_rrOptions ["05"] = "Local";
_rrOptions ["06"] = "nonSynRate";

LIKELIHOOD_FUNCTION_OUTPUT = 1;

I can get my non-synonymous rates too.  You guys should post a documentation about making wrapper batch files on the Hyphy website, along with a few examples, its much easier than editing the existing files. 

Thanks for all the help
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Relative rate test on synonymous and non synonymou
Reply #8 - Oct 24th, 2009 at 12:44am
 
Dear Darrell,

Glad our suggestions helped.
We realize that HyPhy documentation is the weakest component of the package, and hope to improve that aspect in the next year or so.

The best HyPhy reference that exists now (including a section of writing wrapper files), can be found in two book chapters:

Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login and
Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login

Best,
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