Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Joining low-freq states in just one class (Read 3511 times)
Jose_Patane
YaBB Newbies
*
Offline



Posts: 26
Brazil
Gender: male
Joining low-freq states in just one class
Dec 11th, 2006 at 1:59pm
 
Hi all,

I'm trying to develop a 9x9 state matrix , to work with stems in RNAs... I want to accommodate the not-so-frequent states in just one, separate, class... but so far I've only been able to define 16x16 models in HyPhy. How can I achieve that? I don't know whether the following may interfere with setting up such model or not, but no class have 0 frequency (meaning, I can't simply discard one or more classes from the analyses).
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Joining low-freq states in just one class
Reply #1 - Dec 12th, 2006 at 6:03am
 
Dear Jose,

There should be no difficulty in defining a 9x9 matrix (by simply writing it down) in the batch language code. However you need to 'alias' 7 low-frequency states into 1, which, unfortunately is tedious to do in the current implementation (i.e. one needs to create a temporary dataset in memory which maps 7 states down to 1). I'll write a little example in a short while on how to do that (assuming the RNA alphabet).

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



Posts: 26
Brazil
Gender: male
Re: Joining low-freq states in just one class
Reply #2 - Dec 12th, 2006 at 7:05am
 
Thanks for the attention, Sergei... I'll wait until your example is ready then. Cheers
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Joining low-freq states in just one class
Reply #3 - Dec 13th, 2006 at 8:30am
 
Dear Jose,

Here's a code example for you. You should be able to define the map you need to and after that - the model you need to.

Cheers,
Sergei

Code:
DataSet 	  ds	    = ReadDataFile  ("../DistributionPackages/data/StemRNA.nex");
DataSetFilter rna16filter = CreateFilter (ds,2);

stateMap = {16,1}; /* how to map the states down, from AA,AC,...UU to a smaller state
					  the example here maps all unpaired states down to 1 */

stateMap [0]  = 0; /* AA -> State 0 */
stateMap [1]  = 0; /* AC -> State 0 */
stateMap [2]  = 0; /* AG -> State 0 */
stateMap [3]  = 1; /* AU -> State 1 */
stateMap [4]  = 0; /* CA -> State 0 */
stateMap [5]  = 0; /* CC -> State 0 */
stateMap [6]  = 2; /* CG -> State 2 */
stateMap [7]  = 0; /* CU -> State 0 */
stateMap [8]  = 0; /* GA -> State 0 */
stateMap [9]  = 3; /* GC -> State 3 */
stateMap [10] = 0; /* GG -> State 0 */
stateMap [11] = 4; /* GU -> State 4 */
stateMap [12] = 5; /* UA -> State 5 */
stateMap [13] = 0; /* UC -> State 0 */
stateMap [14] = 6; /* UG -> State 6 */
stateMap [15] = 0; /* UU -> State 0 */

stateCount	   = 7; /* how many states are there */
characterRemap = "ABCDEFGHIJKLMNOP"; /* just a hack to remap the characters */

newFilterString = "";
newFilterString * 128;

indexVector = {1,16} ["_MATRIX_ELEMENT_COLUMN_"];
unitVector  = {1,16} ["1"];
GetDataInfo (uniqueMap,rna16filter);

/* this code will map all ambiguities to ? */

newFilterString * ("$BASESET:\""+characterRemap[0][stateCount]+"\"\n");
newFilterString * ("$TOKEN: \"X\"=\""+characterRemap[0][stateCount]+"\"\n");

for (seq  = 0; seq < rna16filter.species; seq = seq + 1)
{
	GetString (seqI,rna16filter,seq);
	newFilterString * (">" + seqI + "\n");
	for (site = 0 ; site < rna16filter.sites; site = site + 1)
	{
		GetDataInfo (siteInfo, rna16filter,seq,uniqueMap[site]);
		stateCount = (unitVector*siteInfo)[0];
		if (stateCount != 1)
		{
			newFilterString * "X";
		}
		else
		{
			newFilterString * characterRemap[stateMap[(indexVector*siteInfo)[0]]];
		}
	}
	newFilterString * "\n";
}

newFilterString * 0;

DataSet		  reducedRNA	 = ReadFromString (newFilterString);
DataSetFilter reducedRNAFilter = CreateFilter   (reducedRNA,1);
 

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



Posts: 26
Brazil
Gender: male
Re: Joining low-freq states in just one class
Reply #4 - Dec 16th, 2006 at 5:14am
 
Once again, it helped me a lot... cheers
Back to top
 
 
IP Logged