Skip to content

Commit

Permalink
Change formulas for the following integral numeric characteristics:
Browse files Browse the repository at this point in the history
Entropy (Amount of information / identification information).
Descriptive information amount.
And as a consequence Uniformity and Regularity
characteristics calculation also changed.

Also refactored almost all integral characteristics calculators
and fixed some tests.
  • Loading branch information
ChainsManipulator committed Oct 28, 2024
1 parent 9d5d8f3 commit ff25e2c
Show file tree
Hide file tree
Showing 66 changed files with 410 additions and 418 deletions.
215 changes: 109 additions & 106 deletions Libiada.Core.Tests/Core/ChainsStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,111 +25,109 @@ public static class ChainsStorage
/// </summary>
public static List<Chain> Chains =>
[
// B B A A C B A C C B
// _ _ A A _ _ A _ _ _
// B B _ _ _ B _ _ _ B
// _ _ _ _ C _ _ C C _
new Chain("BBAACBACCB"), // 0

// A C T T G A T A C G
// A _ _ _ _ A _ A _ _
// _ C _ _ _ _ _ _ C _
// _ _ T T _ _ T _ _ _
// _ _ _ _ G _ _ _ _ G
new Chain("ACTTGATACG"), // 1

// C C A C G C T T A C
// C C _ C _ C _ _ _ C
// _ _ A _ _ _ _ _ A _
// _ _ _ _ G _ _ _ _ _
// _ _ _ _ _ _ T T _ _
new Chain("CCACGCTTAC"), // 2

// C G
// C _
// _ G
new Chain("CG"), // 3

// C C C C
// C C C C
new Chain("CCCC"), // 4

// A C G T
// A _ _ _
// _ C _ _
// _ _ G _
// _ _ _ T
new Chain("ACGT"), // 5

// A A A A C G T
// A A A A _ _ _
// _ _ _ _ C _ _
// _ _ _ _ _ G _
// _ _ _ _ _ _ T
new Chain("AAAACGT"), // 6

// T A
// T _
// _ A
new Chain("TA"), // 7

// T T T T
// T T T T
new Chain("TTTT"), // 8

// A B C A B C A B C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ C _ _ C _ _ C
new Chain("ABCABCABC"), // 9

// C B C A B C A B C
// - _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// C _ C _ _ C _ _ C
new Chain("CBCABCABC"), // 10

// A B A A B C A B C
// A _ A A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ _ _ _ C _ _ C
new Chain("ABAABCABC"), // 11

// A B B A B C A B C
// A _ _ A _ _ A _ _
// _ B B _ B _ _ B _
// _ _ _ _ _ C _ _ C
new Chain("ABBABCABC"), // 12

// A B C A B B A B C
// A _ _ A _ _ A _ _
// _ B _ _ B B _ B _
// _ _ C _ _ _ _ _ C
new Chain("ABCABBABC"), // 13

// A B C A B C A A C
// A _ _ A _ _ A A _
// _ B _ _ B _ _ _ _
// _ _ C _ _ C _ _ C
new Chain("ABCABCAAC"), // 14

// A B C A B C A C C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ _ _
// _ _ C _ _ C _ C C
new Chain("ABCABCACC"), // 15

// A B C A B C A B B
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B B
// _ _ C _ _ C _ _ _
new Chain("ABCABCABB"), // 16

// A B C A B C A B C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ C _ _ C _ _ C
new Chain("ABCABCABC"), // 17
// 0 B B A A C B A C C B
// _ _ A A _ _ A _ _ _
// B B _ _ _ B _ _ _ B
// _ _ _ _ C _ _ C C _
new Chain("BBAACBACCB"),

// 1 A C T T G A T A C G
// A _ _ _ _ A _ A _ _
// _ C _ _ _ _ _ _ C _
// _ _ T T _ _ T _ _ _
// _ _ _ _ G _ _ _ _ G
new Chain("ACTTGATACG"),

// 2 C C A C G C T T A C
// C C _ C _ C _ _ _ C
// _ _ A _ _ _ _ _ A _
// _ _ _ _ G _ _ _ _ _
// _ _ _ _ _ _ T T _ _
new Chain("CCACGCTTAC"),

// 3 C G
// C _
// _ G
new Chain("CG"),

// 4 C C C C
new Chain("CCCC"),

// 5 A C G T
// A _ _ _
// _ C _ _
// _ _ G _
// _ _ _ T
new Chain("ACGT"),

// 6 A A A A C G T
// A A A A _ _ _
// _ _ _ _ C _ _
// _ _ _ _ _ G _
// _ _ _ _ _ _ T
new Chain("AAAACGT"),

// 7 T A
// T _
// _ A
new Chain("TA"),

// 8 T T T T
new Chain("TTTT"),

// 9 A B C A B C A B C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ C _ _ C _ _ C
new Chain("ABCABCABC"),

// 10 C B C A B C A B C
// - _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// C _ C _ _ C _ _ C
new Chain("CBCABCABC"),

// 11 A B A A B C A B C
// A _ A A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ _ _ _ C _ _ C
new Chain("ABAABCABC"),

// 12 A B B A B C A B C
// A _ _ A _ _ A _ _
// _ B B _ B _ _ B _
// _ _ _ _ _ C _ _ C
new Chain("ABBABCABC"),

// 13 A B C A B B A B C
// A _ _ A _ _ A _ _
// _ B _ _ B B _ B _
// _ _ C _ _ _ _ _ C
new Chain("ABCABBABC"),

// 14 A B C A B C A A C
// A _ _ A _ _ A A _
// _ B _ _ B _ _ _ _
// _ _ C _ _ C _ _ C
new Chain("ABCABCAAC"),

// 15 A B C A B C A C C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ _ _
// _ _ C _ _ C _ C C
new Chain("ABCABCACC"),

// 16 A B C A B C A B B
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B B
// _ _ C _ _ C _ _ _
new Chain("ABCABCABB"),

// 17 A B C A B C A B C
// A _ _ A _ _ A _ _
// _ B _ _ B _ _ B _
// _ _ C _ _ C _ _ C
new Chain("ABCABCABC"),

// 18 _ _ _ _ _ _ _ _ _ _
new Chain(
Expand Down Expand Up @@ -189,7 +187,12 @@ public static class ChainsStorage
// 29 _ _ _ _ _ C _ _ _ _
new Chain(
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[NullValue.Instance(), Elements["C"]])
[NullValue.Instance(), Elements["C"]]),

// 30 A B A A B
// A _ A A _
// _ B _ _ B
new Chain("ABAAB")

];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public class ElementsCountTests : CongenericCalculatorsTests<ElementsCount>
/// The value.
/// </param>
[TestCase(0, 3)]
[TestCase(1, 3)]
[TestCase(2, 3)]
[TestCase(3, 3)]
[TestCase(1, 4)]
[TestCase(2, 1)]
[TestCase(3, 1)]
[TestCase(4, 3)]
[TestCase(5, 3)]
[TestCase(5, 5)]
public void CongenericCalculationTest(int index, double value)
{
CongenericChainCharacteristicTest(0, Link.NotApplied, value);
CongenericChainCharacteristicTest(index, Link.NotApplied, value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class AverageRemotenessTests : FullCalculatorsTests<AverageRemoteness>
[TestCase(0, Link.End, 1.017)]
[TestCase(0, Link.Both, 1.0828)]
[TestCase(0, Link.Cycle, 1.234)]
[TestCase(30, Link.Start, 0.7169925)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(index, link, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public class DescriptiveInformationTests : FullCalculatorsTests<DescriptiveInfor
/// <param name="value">
/// The value.
/// </param>
[TestCase(0, Link.None, 2.8845)]
[TestCase(0, Link.Start, 2.9917)]
[TestCase(0, Link.End, 2.9473)]
[TestCase(0, Link.Both, 2.9865)]
[TestCase(0, Link.None, 2.37956557896877)]
[TestCase(0, Link.Start, 2.58645791024)]
[TestCase(0, Link.End, 2.383831871)]
[TestCase(0, Link.Both, 2.52382717296366)]
[TestCase(0, Link.Cycle, 2.971)]
[TestCase(30, Link.Start, 1.71450693)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(index, link, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ public class GeometricMeanTests : FullCalculatorsTests<GeometricMean>
[TestCase(0, Link.End, 2.0237)]
[TestCase(0, Link.Both, 2.1182)]
[TestCase(0, Link.Cycle, 2.3522)]
[TestCase(30, Link.Start, 1.6437518295)]
public void CalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public class IdentificationInformationTests : FullCalculatorsTests<Identificatio
/// <param name="value">
/// The value.
/// </param>
[TestCase(0, Link.None, 1.5283)]
[TestCase(0, Link.Start, 1.581)]
[TestCase(0, Link.End, 1.5594)]
[TestCase(0, Link.Both, 1.5785)]
[TestCase(0, Link.None, 1.25069821459)]
[TestCase(0, Link.Start, 1.3709777)]
[TestCase(0, Link.End, 1.2532824857)]
[TestCase(0, Link.Both, 1.335618955)]
[TestCase(0, Link.Cycle, 1.571)]
[TestCase(30, Link.Start, 0.77779373752225)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(index, link, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void ChainCalculationTest(int index, Link link, double value)
/// <param name="value">
/// The value.
/// </param>
[TestCase(3, Link.None, 0)]
[TestCase(5, Link.None, 0)]
[TestCase(7, Link.None, 0)]
[TestCase(3, Link.None, 1)]
[TestCase(5, Link.None, 1)]
[TestCase(7, Link.None, 1)]
public void NoIntervalsTest(int index, Link link, double value)
{
ChainCharacteristicTest(index, link, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public class RegularityTests : FullCalculatorsTests<Regularity>
/// <param name="value">
/// The value.
/// </param>
[TestCase(0, Link.None, 0.7051)]
[TestCase(0, Link.Start, 0.7203)]
[TestCase(0, Link.End, 0.6866)]
[TestCase(0, Link.Both, 0.70926)]
[TestCase(0, Link.None, 0.8547)]
[TestCase(0, Link.Start, 0.8332)]
[TestCase(0, Link.End, 0.8489)]
[TestCase(0, Link.Both, 0.8393)]
[TestCase(0, Link.Cycle, 0.7917)]
[TestCase(30, Link.Start, 0.9587)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(index, link, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessDispersionTests : FullCalculatorsTests<RemotenessDispersi
[TestCase(0, Link.Cycle, 1.1161)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessKurtosisCoefficientTests : FullCalculatorsTests<Remotenes
[TestCase(0, Link.Cycle, 1.337076)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessKurtosisTests : FullCalculatorsTests<RemotenessKurtosis>
[TestCase(0, Link.Cycle, 1.6655934)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessSkewnessCoefficientTests : FullCalculatorsTests<Remotenes
[TestCase(0, Link.Cycle, -0.1356234)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessSkewnessTests : FullCalculatorsTests<RemotenessSkewness>
[TestCase(0, Link.Cycle, -0.1599169)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RemotenessStandardDeviationTests : FullCalculatorsTests<RemotenessS
[TestCase(0, Link.Cycle, 1.0564604)]
public void ChainCalculationTest(int index, Link link, double value)
{
ChainCharacteristicTest(0, link, value);
ChainCharacteristicTest(index, link, value);
}

/// <summary>
Expand Down
Loading

0 comments on commit ff25e2c

Please sign in to comment.