-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from unipept/feature/reference-proteomes
Add ability to build custom databases from UniProt reference proteomes
- Loading branch information
Showing
17 changed files
with
697 additions
and
169 deletions.
There are no files selected for viewing
386 changes: 330 additions & 56 deletions
386
src/components/custom-database/CreateCustomDatabase.vue
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
DROP TABLE analysis_source; | ||
CREATE TABLE analysis_source ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
type TEXT CHECK( type in ('online', 'custom_db') ) NOT NULL, | ||
/** | ||
* If the type of the AnalysisSource is online, this field indicates which API endpoint was used for the analysis. | ||
*/ | ||
endpoint TEXT, | ||
/* UniProt version that was used to process the underlying data (e.g. 2022.02). */ | ||
uniprot_version TEXT NOT NULL, | ||
/** | ||
* Comma-delimited list of NCBI taxon ID's that are used for filtering in this database. This field will only be | ||
* used if the type of this analysis source is "custom_db". | ||
*/ | ||
selected_taxa TEXT, | ||
/** | ||
* Comma-delimited list of databases (or database sources) that are used to construct this database. This list | ||
* could include things like swissprot, trembl or reference proteome identifiers. | ||
*/ | ||
sources TEXT | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
CREATE TABLE studies ( | ||
id TEXT PRIMARY KEY, | ||
name TEXT NOT NULL | ||
); | ||
|
||
CREATE TABLE assays ( | ||
id TEXT PRIMARY KEY, | ||
name TEXT NOT NULL, | ||
study_id TEXT NOT NULL, | ||
configuration_id INT NOT NULL, | ||
/* | ||
AnalysisSource that was last selected for this assay. This endpoint does not necessarily need to be the same as the one | ||
selected for the storage_metadata table. This endpoint is only used to detect whether the assay needs to be | ||
recomputed or not. | ||
*/ | ||
analysis_source_id INTEGER, | ||
FOREIGN KEY(study_id) REFERENCES studies(id), | ||
FOREIGN KEY(configuration_id) REFERENCES search_configuration(id), | ||
FOREIGN KEY(analysis_source_id) REFERENCES analysis_source(id) | ||
); | ||
|
||
CREATE TABLE search_configuration ( | ||
id INTEGER PRIMARY KEY, | ||
equate_il INT NOT NULL, | ||
filter_duplicates INT NOT NULL, | ||
missing_cleavage_handling INT NOT NULL | ||
); | ||
|
||
CREATE TABLE peptide_trust ( | ||
assay_id TEXT NOT NULL, | ||
missed_peptides TEXT NOT NULL, | ||
matched_peptides INT NOT NULL, | ||
searched_peptides INT NOT NULL, | ||
PRIMARY KEY(assay_id) | ||
); | ||
|
||
CREATE TABLE storage_metadata ( | ||
assay_id TEXT NOT NULL, | ||
configuration_id INT NOT NULL, | ||
/* | ||
Hash of the files that are stored on the local filesystem. This hash can be used to verify the integrity of the | ||
files containing the offline result data on the filesystem. Value for this column is the concatenation of | ||
the hash for both the data buffer and index buffer files. | ||
*/ | ||
data_hash TEXT, | ||
analysis_date TEXT, | ||
analysis_source_id INTEGER, | ||
PRIMARY KEY(assay_id), | ||
FOREIGN KEY(configuration_id) REFERENCES search_configuration(id), | ||
FOREIGN KEY(analysis_source_id) REFERENCES analysis_source(id) | ||
); | ||
|
||
CREATE TABLE analysis_source ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
type TEXT CHECK( type in ('online', 'custom_db') ) NOT NULL, | ||
/** | ||
* If the type of the AnalysisSource is online, this field indicates which API endpoint was used for the analysis. | ||
*/ | ||
endpoint TEXT, | ||
/* UniProt version that was used to process the underlying data (e.g. 2022.02). */ | ||
uniprot_version TEXT NOT NULL, | ||
/** | ||
* Comma-delimited list of NCBI taxon ID's that are used for filtering in this database. This field will only be | ||
* used if the type of this analysis source is "custom_db". | ||
*/ | ||
selected_taxa TEXT, | ||
/** | ||
* Comma-delimited list of databases (or database sources) that are used to construct this database. This list | ||
* could include things like swissprot, trembl or reference proteome identifiers. | ||
*/ | ||
sources TEXT | ||
); | ||
|
||
CREATE TABLE database_metadata ( | ||
application_version TEXT NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* This class is a helper utility for async operations. It provides a method that can be used if multiple async | ||
* requests can be made simultaneously, but only the last result should actually be used. | ||
*/ | ||
export default class AsyncHelper<T> { | ||
private asyncCount: number = 0; | ||
private executing: boolean = false; | ||
|
||
/** | ||
* Use this method if a specific async operation could be executed more than once, but only the result of the final | ||
* call should be retained and used. Note that the final call is defined as the one that was last called by this | ||
* method, it is not necessarily the one that finishes last. | ||
* | ||
* @param asyncResult The function that can be executed multiple times and for which only the results of the final | ||
* evocation should be retained. | ||
* @param mutation A mutation that should be performed upon receiving the results of the async function. This will | ||
* only be executed if the results of the final invocation of this method are available. | ||
*/ | ||
public async performIfLast( | ||
asyncResult: () => Promise<T>, | ||
mutation: (result: T) => void | ||
): Promise<void> { | ||
this.executing = true; | ||
this.asyncCount++; | ||
const count = this.asyncCount; | ||
|
||
const result = await asyncResult(); | ||
|
||
if (count === this.asyncCount) { | ||
mutation(result); | ||
this.executing = false; | ||
} | ||
} | ||
|
||
/** | ||
* Is this helper currently waiting for a call to finish or not? | ||
*/ | ||
public isExecuting(): boolean { | ||
return this.executing; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { NcbiId } from "unipept-web-components"; | ||
|
||
export default class Proteome { | ||
constructor( | ||
// String that uniquely identifies this reference proteome. | ||
public readonly id: string, | ||
// Name of the organism to which this proteome is associated. | ||
public readonly organismName: string, | ||
// NCBI ID of the organism to which this proteome is associated. | ||
public readonly organismId: NcbiId, | ||
// The amount of proteins that are present in this reference proteome. | ||
public readonly proteinCount: number | ||
) {} | ||
} |
Oops, something went wrong.