%%%%%%% 
% bioperms.m
% Author: Lance Harden, Davidson College
% June 2006
% 
% Description: Bioperms is equivalent to signedperms except it removes
% permutations that are molecularly identical.

function [B] = bioperms(k)
B = signedperms(k);
b = length(B)/2;
for i = 1:b
    P = B(i,:);
    G = [fliplr(P(1:k))];
        for f = 1:k
            G(f) = -G(f);
        end
    for j = (i+1):length(B)
        if (B(j,:) == G)
            B(j,:) = [];
            break
        end
    end
end