mirror of
https://github.com/MillironX/beefblup.git
synced 2024-11-14 03:23:09 +00:00
Terminate if there are more contemporary groups than animals
This commit is contained in:
parent
b372608f2e
commit
6743790804
2 changed files with 48 additions and 29 deletions
58
LICENSE.md
58
LICENSE.md
|
@ -1,29 +1,29 @@
|
||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2018, Thomas A. Christensen II
|
Copyright (c) 2018, Thomas A. Christensen II
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
list of conditions and the following disclaimer.
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
this list of conditions and the following disclaimer in the documentation
|
this list of conditions and the following disclaimer in the documentation
|
||||||
and/or other materials provided with the distribution.
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
* Neither the name of the copyright holder nor the names of its
|
* Neither the name of the copyright holder nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
|
@ -33,6 +33,8 @@ animalrow = @(id) find(ids == id);
|
||||||
numanimals = length(ids);
|
numanimals = length(ids);
|
||||||
|
|
||||||
% Store column numbers that need to be deleted
|
% Store column numbers that need to be deleted
|
||||||
|
% Column 6 contains an intermediate Excel calculation and always needs to
|
||||||
|
% be deleted
|
||||||
colstodelete = 6;
|
colstodelete = 6;
|
||||||
|
|
||||||
% Coerce each group to string format
|
% Coerce each group to string format
|
||||||
|
@ -48,3 +50,20 @@ for i = 7:length(headers)
|
||||||
colstodelete = [colstodelete i];
|
colstodelete = [colstodelete i];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
% Delete the appropriate columns from the datasheet and the headers
|
||||||
|
data(:,colstodelete) = [];
|
||||||
|
headers(colstodelete) = [];
|
||||||
|
|
||||||
|
% Determine how many contemporary groups there are
|
||||||
|
numgroups = ones(1, length(headers)-5);
|
||||||
|
for i = 6:length(headers)
|
||||||
|
numgroups(i) = length(unique(data(:,i)));
|
||||||
|
end
|
||||||
|
|
||||||
|
% If there are more groups than animals, then the analysis cannot continue
|
||||||
|
if sum(numgroups) >= numanimals
|
||||||
|
disp('There are more contemporary groups than animals. The analysis will now abort.');
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue