A simple Python GUI applictation for construction of sequencing sample sheets.
This is a pet-project, made for composing sample sheets for the GeneMind Biosciences next generation sequencer "Genolab-M" without jumping through various hoops like awkward manual editing of sample sheets composed in other software. Also made to help me practice programming in Python.
In no particular oreder:
- graphical interface
- several ways of data input:
- .tsv/.csv
- MS Excel (or any other program that can edit .xlsx)
- fetching from google document
- management and concatenation of several groups of samples
- support for barcode ID to sequence conversion across multiple indexing sets
- On the spot data validation (basically, checks for anything the sequencing software will refuse to accept):
- illegal characters and name lenghts in seqid
- duplicate seqIDs and barcodes
- quality of life things like presets and automatic spike-in sample addition
- expandable and adaptable: presets, barcodes, sample sheet templates can all be modified to match your requirements and/or append new items as needed.
No installation required - download the entire folder and the application should run on any Windows 10 machine (Windows 11 not tested, but should porbably work as well). Other operating systems are not supported.
Use the bottom bar to navigate though several "pages" of data input and validation. The help menu is always there to help you (currently only available in Russian).
The parser logic for manual data input is fairly simple: First column WIP[what bout name?] of the table becomes sampleID. Any subsequent column becomes the barcodes column if it contains either barcode IDs(matching those in the program's collection) or DNA sequences for barcodes.
To be properly parsed, a google sheets table should meet the following criteria:
- Have a Google service account set up (instructions below) and granted access to the document
- Have a preset in presets.ini corresponding to the sheet you are trying to open
- ? Have non-empty validation columns with column names exactly as in 'RequiredCols' parameter of DEFAULT or specific preset.
To pull sample data from Google sheets, one needs to setup their Google acounts and recieve API access to said sheets. A service account is a an account created for a non-human user (i.e. a bot or an application) to interact with Google services. It acts as a separate account and needs proper authenticattion and be authorization to access data in Google drive. Service accounts are created in and tied to projects in Google Cloud for management.
Enable API Access for a Project:
-
Log in to your Google account, enter Google Developers Console and create a new project by clicking "create a new project" (or select a project you already have).
-
Open the “APIs and Services” tab and use the search box there to find “Google Drive API” and “Google Sheets API” and enable both by clicking "Enable" on their respective pages.
Create a Service Account:
-
To make one, go to “APIs & Services > Credentials” of your project from the previous step and select “Create credentials > Service account”.
-
Fill out the form that popped up: service account's name and their ID used in an email adress tied to that account (other fields are not needed in this case). Click "Done" to finalize the creation of a service account.
-
Select the newly created service account ("APIs & Services > Credentials > Service Accounts"). Go to "Keys" and create a new key for Google services access: "ADD KEY > Create a key > Key type:JSON".
-
The key should have been have automatically downloaded to your PC (if it hasn't, try troubleshooting your browser's downloads settings). Move it to the SamSheetMaker's resources folder and rename it to "API_credentials.json".
-
Congratulations, you've enabled Google API access to SamSheetMaker. Now you need to share any worksheet you want it to be able to access. To do so, go to the the "persmissions" tab of the document and add the e-mail of the service account, same way yould you would do with any other user. Also, note, that for the program to read the document, there also needs to be a corresponding preset in the presets.ini (explained below).
(linkshare bug sorta) There is a known issue that if you have "Access with a link" enabled for a document, deleting a user from the list of users whared with does not actually remove their rights to access the document (google drive automatically saves the link). To remove a document from the service account's accessible documents, you need to both remove it from the users list and close link access. You are free to open the link access immediately afterwards - this should not affect anyone but the users who accessed the document through their "shared with" tab of goolge drive without being on the shared with list (they are free to access the document again through the link).
The fields are listed below. Each individual preset should start with a [NAME] and include at least Keyword and Mask fields:
Keyword [word] - identification keyword that makes it possible to assign a preset to a worksheet, should be a part of the worksheet's name (example: keyword "Onco" for table named "Oncogenetics"). Also serves as a handle for this worksheet during sample selection
Mask [regexp] - regular expression to filter out sheets from the entire workbook: '^' = start of line, '\d' = digit
RequiredCols [...] - columns which would be checked for presence of data to find sample rows on the sheet, separated by semicolon ';'
Phix' [yes/no] - add spike-in automatically
Bundle [n] - number of samples to bundle in a single batch, 0 and 1 make no batches
Mode [mode] - sequencing mode, PE (paired end) or SE (single end) + read lenght
SaveTo [location] - location where to save the end sample sheet
The application will look for spike in sample (sample used to improve data qulity, e.g. PhiX) in the 'resources/' folder, grabbing the .first tsv file with "spike-in" in its name. If that fails for whatever reason, it will default to the one emebedded in the SAMPLE_SHEET template.