Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed decoy order #809

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions mzLib/Test/DatabaseTests/TestDatabaseLoaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ public void LoadingIsReproducible(string fileName, DecoyType decoyType)

// check are equivalent lists of proteins
Assert.AreEqual(proteins1.Count, proteins2.Count);
// Because decoys are written in a parallel environment, there is no guarantee that the orders will be the same
CollectionAssert.AreEquivalent(proteins1.Select(p => p.Accession), proteins2.Select(p => p.Accession));
CollectionAssert.AreEquivalent(proteins1.Select(p => p.BaseSequence), proteins2.Select(p => p.BaseSequence));
// Because decoys are sorted before they are returned, the order should be identical
Assert.AreEqual(proteins1, proteins2);
}

[Test]
Expand Down
2 changes: 2 additions & 0 deletions mzLib/UsefulProteomicsDatabases/DecoyProteinGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ private static List<Protein> GenerateReverseDecoys(List<Protein> proteins, int m

lock (decoyProteins) { decoyProteins.Add(decoyProtein); }
});
decoyProteins = decoyProteins.OrderBy(p => p.Accession).ToList();
return decoyProteins;
}

Expand Down Expand Up @@ -359,6 +360,7 @@ private static List<Protein> GenerateSlideDecoys(List<Protein> proteins, int max
protein.Name, protein.FullName, true, protein.IsContaminant, null, decoyVariationsSlide, null, protein.SampleNameForVariants, decoy_disulfides_slide, spliceSitesSlide, protein.DatabaseFilePath);
lock (decoyProteins) { decoyProteins.Add(decoyProteinSlide); }
});
decoyProteins = decoyProteins.OrderBy(p => p.Accession).ToList();
return decoyProteins;
}

Expand Down
Loading