TITLE: SOP - Routine SARS-CoV-2 sequencing data administration 
AUTHORS: Mateusz Jundzill, Riccardo Spott, Mara Lohde, Martin Hölzer, Adrian Viehweger, Christian Brandt

[DESCRIPTION]
This is a step-by-step standard operating protocol (SOP) for data administration using the MongoDB database for routine SARS-CoV-2 sequencing. 
The collapsed note blocks contain command-line solutions that are usually faster but require more advanced IT knowledge.
Additionally, we have enclosed a Github repository with a code and script approach to automate multiple data administration procedures. 
Please note that since these codes are specifically made to be used with the SARS-CoV-2 internal database, they will require adjustments to work with other databases. In this protocol, we have focused on using the MongoDB Compass GUI, but there are other solutions available. We recommend choosing the most suited solution for your needs.

[STEPS]
SECTION: Creating New Entries
1. Sample arrives from external or internal partner. 
SECTION: Creating New Entries
2. Sample entry creation. Fill the template CSV file with the given information and import it through MongoDB Compass. 

Example of a template CSV:
 
  
Select Import File and choose a file for data upload. Pick CSV in the Select Input FileType option.

If the file is in proper format, a table with the headline Specify Fields and Types should appear, providing an overview of the imported data and allowing you to specify key types. Confirm by selecting Import.
   
 




SECTION: Sequencing preparation
3. Select samples for laboratory work. Access database using MongoDB Compass and search for samples that have an empty Status field.

Search query example:
 
 
Fill the Status field with a short personal identifier and a sample barcode number.

Example:
 


SECTION: Sequencing preparation
4. (Optional) Export the sample list as a CSV file.  Search for the desired samples using MongoDB Compass and then export the results to a CSV file. 

The exported CSV can also be used to update entries at a later step (see step 6).

Example of a queary that searches for a status that contais 'BC' (barcode).
 

 
Command line export approach:  
 

SECTION: Database entry update
7. Update MongoDB database with new results. There are three available solutions:
1. Manually update entries in MongoDB Compass. 
Switch to the optimal data view in the application (table-like or JSON-like), depending on how many entries you need to view. Then, turn on the edit mode and in case you would like to add a new key-value pair select the small plus sign. This will create a new key-value pair that you can modify. To modify an existing value, double-click on value you wish to modify. Confirm your changes by choosing Update.


2. Pure CSV solution. Export the list of analyzed samples by querying the common Status field fragment e.g. BC (Barcode): 
 

Update the exported CSV with new information and change the status of failed sequencing runs to fail. Then, delete the preexisting database entry and import the updated CSV file using MongoDB Compass.

 


SECTION: Database entry update
8. Check data integrity. This could be performed in multiple ways:

1. Go to the MongoDB Compass Schema tab, select Analyze Schema and check your data for any discrepancies (such as numerical values out of bonds, repeated values, unusual data formats, etc.)
2. Prepare MongoDB Charts data overview that works in a similar but customized way as MongoDB Compass Schema.
3. Use sanity scripts similar to the 'field_mod_exec.sh' script provided in the Github repository The script can also create a new field based on the given information. Please note that the provided scripts require modification and adjustments to work with databases other than the internal Routine SARS-CoV-2 sequencing database.
SECTION: Prepare a report file
9. Prepare report file for external partners. Prepare results for the report by searching the database for the desired data, such as by Analysis Date or any other required field Then export the list with selected fields to a CSV file via MongoDB Compass.

Example to filter data by date of analysis:
 

 


SECTION: Sample analysis
6. (Optional) Analyze the results your experiment and update the list prepared in    with any data that you want to store in the database.

SECTION: Sequencing preparation
5. Print out  the sample for the laboratory work.