HyPhy message board
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl
Methodology Questions >> How to >> invert a partition in a batch file
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?num=1150810889

Message started by Jennifer Knies on Jun 20th, 2006 at 6:41am

Title: invert a partition in a batch file
Post by Jennifer Knies on 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

Title: Re: invert a partition in a batch file
Post by Sergei on 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,"Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login;
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

HyPhy message board » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.