Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
invert a partition in a batch file (Read 2080 times)
Jennifer Knies
Guest


invert a partition in a batch file
Jun 20th, 2006 at 6:41am
 
Hi,

I would like to be able enter one partition into the Hyphy batch file and then have a second partition that is the inverse of the first.  Is this possible?
Currently, I have code like this:

DataSetFilter             filteredData = CreateFilter (ds,1,"3-7,11-19,21-29,","");

(I have made the partition much smaller than actuality).  Later in this batch file I run another analysis on the inversion of the partition and I want to be able to have  a line that sets a new filter = ds - filteredData.

Thanks, Jen Knies
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: invert a partition in a batch file
Reply #1 - Jun 20th, 2006 at 11:56am
 
Dear Jen,

Something like the code I paste below should do the trick.
The code builds and uses an associative array 'sitesIn' to mark all the sites to be excluded from the inverted partition.

Code:
RequireVersion ("0.9920060601beta");

GetURL 			(dataString,"http://www.hyphy.org/pubs/IntronExon.nex");
DataSet 		ds 			 = ReadFromString (dataString);
DataSetFilter	filteredData = CreateFilter (ds,1,"3-7,11-19,21-29","");

sitesIn	= {};
for (k=0; k<filteredData.sites; k=k+1)
{
	sitesIn[filteredData.site_map[k]] = 1;
}

DataSetFilter	invertedFilter = CreateFilter (ds,1,sitesIn[siteIndex] == 0,"");
 



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