/usr/share/hyphy/DatapanelAddIns/Compare Subsets is in hyphy-common 2.2.7+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | RequireVersion ("0.9920060426");
_idx = "`HYPHY_LIB_DIRECTORY`TemplateBatchFiles`DIRECTORY_SEPARATOR`Utility`DIRECTORY_SEPARATOR`GrabBag.bf";
ExecuteCommands ("#include\"`_idx`\";");
_seqCount = Columns(_DATAPANEL_SELECTED_SEQUENCES_);
_selFilters = Columns(_DATAPANEL_SELECTED_FILTERS_);
if (_seqCount == 0 || _selFilters > 1 || _seqCount == _DATAPANEL_DATAFILTER_.species)
{
fprintf (stdout, "ERROR: This plug in-needs one selected data filter and some (but not all) selected sequences\n");
return 0;
}
if (_selFilters == 1)
{
_baseName = _DATAPANEL_SELECTED_FILTERS_[0];
}
else
{
_baseName = _DATAPANEL_DATASET_NAME_;
}
_sequenceMapping = {};
for (_idx = 0; _idx < _seqCount; _idx = _idx + 1)
{
_sequenceMapping[_DATAPANEL_SELECTED_SEQUENCES_[_idx]] = 1;
}
_unitSize = _DATAPANEL_UNIT_SIZE_[0];
_exclusions = _DATAPANEL_EXCLUSIONS_[0];
DataSetFilter _subset1 = CreateFilter (_DATAPANEL_DATAFILTER_,_unitSize,"",_sequenceMapping[speciesIndex] == 1,_exclusions);
DataSetFilter _subset2 = CreateFilter (_DATAPANEL_DATAFILTER_,_unitSize,"",_sequenceMapping[speciesIndex] == 0,_exclusions);
_svl = VERBOSITY_LEVEL;
VERBOSITY_LEVEL = -1;
_siteTypes = {};
_siteTypes["Fixed and same in both subsets"] = {};
_siteTypes["Fixed and different in both subsets"] = {};
_siteTypes["Fixed in selected sequences only"] = {};
_siteTypes["Fixed in excluded sequences only"] = {};
_siteTypes["Polymorphic in both subsets"] = {};
for (_idx = 0; _idx < _DATAPANEL_DATAFILTER_.sites; _idx = _idx + 1)
{
if (_unitSize > 1)
{
_siteSpec = Format (_idx*_unitSize,20,0) + "-" + Format ((1+_idx)*_unitSize-1,20,0)
}
else
{
_siteSpec = Format (_idx,20,0);
}
DataSetFilter _aSite = CreateFilter (_subset1, _unitSize, _siteSpec,"",_exclusions);
HarvestFrequencies (_freqs1, _aSite, _unitSize, _unitSize, 0);
DataSetFilter _aSite = CreateFilter (_subset2, _unitSize, _siteSpec,"",_exclusions);
HarvestFrequencies (_freqs2, _aSite, _unitSize, _unitSize, 0);
_f = Abs (_freqs1-_freqs2);
if (_f == Sqrt(2))
{
(_siteTypes["Fixed and different in both subsets"])[Abs(_siteTypes["Fixed and different in both subsets"])] = _idx;
}
else
{
if (_f == 0)
{
(_siteTypes["Fixed and same in both subsets"])[Abs(_siteTypes["Fixed and same in both subsets"])] = _idx;
}
else
{
if (Abs (_freqs1) == 1)
{
(_siteTypes["Fixed in selected sequences only"])[Abs(_siteTypes["Fixed in selected sequences only"])] = _idx;
}
else
{
if (Abs(_freqs2) == 1)
{
(_siteTypes["Fixed in excluded sequences only"])[Abs(_siteTypes["Fixed in excluded sequences only"])] = _idx;
}
else
{
(_siteTypes["Polymorphic in both subsets"])[Abs(_siteTypes["Polymorphic in both subsets"])] = _idx;
}
}
}
}
}
VERBOSITY_LEVEL = _svl;
_countMatrix = Abs (_siteTypes);
_idx = avlToLabels (_siteTypes,"Kind",";");
_labels = {{"Count","`_idx`"}};
_types = Rows (_siteTypes);
_plotMx = {Columns(_types),1};
_DATAPANEL_RETURNED_FILTERS_ = {};
for (_idx = 0; _idx < Columns (_types); _idx = _idx + 1)
{
_plotMx [_idx] = Abs(_siteTypes[_types[_idx]]);
_f = {};
_f ["SITES"] = avlToRow (_siteTypes[_types[_idx]],_DATAPANEL_DATAFILTER_.site_map,_unitSize);
if (Columns(_f["SITES"]))
{
_DATAPANEL_RETURNED_FILTERS_ [_baseName+_types[_idx]] = _f;
}
/*_f = avlToString (_siteTypes[_types[_idx]],",");
fprintf (stdout, "\n", _types[_idx], "\n", _f ,"\n");*/
}
OpenWindow (CHARTWINDOW,{{"Site type comparison"}
{"_labels"}
{"_plotMx"}
{"Pie Chart"}
{"Count"}
{"Count"}
{""}
{""}
{""}
{"1"}
{""}
{"-1;-1"}
{"10;1.309;0.785398"}
{"Times:12:0;Times:10:0;Times:12:2"}
{"0;0;13816530;16777215;0;0;6579300;11842740;13158600;14474460;0;3947580;16777215;15670812;6845928;16771158;2984993;9199669;7018159;1460610;16748822;11184810;14173291"}
{"16,0,0"}
},
"700;700;50;50");
|