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

Decoupling spectral match model from PsmFromTsv #12

Merged
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
10 changes: 6 additions & 4 deletions MetaPAL/Controllers/SpectrumMatchesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
public async Task<IActionResult> Index()
{
// TEMPORARY: remove all spectrum matches from database
//await Task.Run(() => DataOperations.DataOperations.RemoveAll<SpectrumMatch>(_context));
//Task.Run(() => DataOperations.DataOperations.RemoveAll<SpectrumMatch>(_context)).Wait();


if (_context.SpectrumMatch == null)
return Problem("Entity set 'ApplicationDbContext.SpectrumMatch' is null.");
return View(await _context.SpectrumMatch.ToListAsync());
}

// GET: UploadSpectralMatchesForm
public async Task<IActionResult> UploadSpectralMatchesForm()

Check warning on line 38 in MetaPAL/Controllers/SpectrumMatchesController.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return _context.SpectrumMatch != null ?
View() :
Expand All @@ -48,9 +49,10 @@
return Problem("Entity set 'ApplicationDbContext.SpectrumMatch' is null.");
try
{
foreach (var psm in SpectrumMatchTsvReader.ReadTsv(PsmPath, out _))
foreach (var psm in SpectrumMatchTsvReader.ReadTsv(PsmPath, out _)
.Select(SpectrumMatch.FromSpectrumMatchTsv))
{
_context.Add(SpectrumMatch.FromSpectrumMatchTsv(psm));
_context.Add(psm);
}

await _context.SaveChangesAsync();
Expand All @@ -65,7 +67,7 @@


// GET: ShowSearchForm
public async Task<IActionResult> ShowSearchForm()

Check warning on line 70 in MetaPAL/Controllers/SpectrumMatchesController.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return _context.SpectrumMatch != null ?
View() :
Expand All @@ -76,7 +78,7 @@
public async Task<IActionResult> ShowSearchResults(string SearchPhrase)
{
return _context.SpectrumMatch != null ?
View(await _context.SpectrumMatch.Where(b=>b.BaseSeq.Contains(SearchPhrase)).ToListAsync()) :
View(await _context.SpectrumMatch.Where(b=>b.BaseSequence.Contains(SearchPhrase)).ToListAsync()) :
Problem("Entity set 'ApplicationDbContext.SpectrumMatch' is null.");
}
// GET: SpectrumMatches/Details/5
Expand Down
21 changes: 0 additions & 21 deletions MetaPAL/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,6 @@ public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)

protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<SpectrumMatch>()
.Ignore("MatchedIons");
builder.Entity<SpectrumMatch>()
.Ignore("ChildScanMatchedIons");
builder.Entity<SpectrumMatch>()
.Ignore("VariantCrossingIons");
builder.Entity<SpectrumMatch>()
.Property(p => p.IdentifiedSequenceVariations)
.IsRequired(false);
builder.Entity<SpectrumMatch>()
.Property(p => p.IntersectingSequenceVariations)
.IsRequired(false);
builder.Entity<SpectrumMatch>()
.Property(p => p.PEP)
.HasConversion(v => double.IsNaN(v) ? -1 : v,
v => v);
builder.Entity<SpectrumMatch>()
.Property(p => p.PEP_QValue)
.HasConversion(v => double.IsNaN(v) ? -1 : v,
v => v);

base.OnModelCreating(builder);
}

Expand Down
Loading