Package: covsonar
covSonar2covSonar is a database-driven system for handling genomic sequences and screening genomic profiles.What's new in covSonar V.2New designImprove workflowsPerformance improvementsExciting new featuresSupport multiple pathogensFlexible in adding meta informationNew database designNew database schemaRetrieval efficiencySignificantly smaller than the previous version1. Prerequisites / SetupcovSonar2 has some software-environmental requirements that can most easily be met by building a custom conda environment.Proceed as follows to install covSonar:# download the repository to the current working directory using gitgitclonehttps://github.com/rki-mf1/covsonar# build the custom software environment using conda [recommended]condaenvcreate-nsonar2-fcovsonar/sonar.env.yml# activate the conda evironment if builtcondaactivatesonar2# testing./covsonar/test.sh3. UsageIn covSonar2 there are several tools that can be called via subcommands.subcommandpurposesetupsetup a new database.importimport genome sequences and sample information to the databaselist-propview sample properties added to the databaseadd-propadd a sample property to the databasedelete-propdelete a sample property from the databasematchget mutations profiles for given accessionsrestorerestore sequence(s) from the databaseinfoshow software and database info.optimizeoptimizes the databasedb-upgradeupgrade a database to the latest versionupdate-lineage-infodownload latest lineage informationEach tool provides a help page that can be accessed with the-hoption.# display help page./sonar.py-h# display help page for each tool./sonar.pyimport-h3.1 Setup database (setup ⛽)First, we have to create a new database instance../sonar.pysetup--dbtest.db, or we can create a new database instance with predefined properties../sonar.pysetup--dbtest.db--auto-createBy default, the MN908947.3 (SARS-CoV-2) is used as a reference. If we want to set up database for a different pathogen, we can add--gbkfollowing with Genbank file.example;./sonar.pysetup--dbtest.db--auto-create--gbkEbola.gbnote 📌:how to download genbank file3.2 Property management (list-prop, add-prop, delete-prop)In covSonar2, users now can arbitrarily add meta information or properties into a database to fit a specific project objective.sTo view the added properties, we can use thelist-propcommand to display all information../sonar.pylist-prop--dbtest.dbTo add more properties, we can use theadd-propcommand to add meta information into the database.The required arguments are listed below when we useadd-prop--name, name of sample property--descr, description of the new property--dtype, data type of the new property (e.g., 'integer', 'float', 'text', 'date', 'zip')./sonar.pyadd-prop--dbtest.db--nameSEQ_REASON--dtypetext--descr"seq. reason"tip 🕯️:./sonar.py add-prop -hto see all available   argumentsThedelete-propcommand is used to delete an unwanted property from the database../sonar.pydelete-prop--dbtest.db--nameSEQ_REASONThe program will ask an user for confirmation of the action.Do you really want to delete this property? [YES/no]: YES3.3 Adding genomes and meta information to the database (import)Add sequence with meta information./sonar.pyimport--dbtest.db--fastavalid.fasta--tsvday.tsv--threads64--cachetmp_cache--colssample=IMS_IDUpdate moreexample:./sonar.pyimport--dbtest.db--fastavalid.fasta--tsvday.tsv--threads64--cachetmp_cache--colssample=IMS_ID

./sonar.pyimport--dbtest.db--fastavalid.fasta--tsvday.tsv--threads64--cachetmp_cache--colssample=IMS_IDsample3.4 Query genome sequences based on profiles (match)Genomic profiles can be defined to align genomes. For this purpose, the variants related to the complete genome of the SARS-CoV-2 isolate Wuhan-Hu-1 (NC_045512.2) must be expressed as follows:typenucleotide levelamino acid levelSNPref_nucfollowed byref_posfollowed byalt_nuc (e.g. A3451T)protein_symbol:ref_aafollowed byref_posfollowed byalt_aa (e.g. S:N501Y)deletiondel:ref_pos:length_in_bp (e.g. del:3001:8)protein_symbol:del:ref_pos:length_in_aa (e.g. ORF1ab:del:3001:21)insertionref_nucfollowed byref_posfollowed byalt_nucs (e.g. A3451TGAT)protein_symbol:ref_aafollowed byref_posfollowed byalt_aas (e.g. N:A34AK)The positions refer to the reference (first nucleotide in the genome is position 1). Using the option--profile, multiple variant definitions can be combined into a nucleotide, amino acid or mixed profile, which means that matching genomes must have all those variations in common. In contrast, alternative variations can be defined by multiple--profileoptions. As an example,--profile S:N501Y S:E484Kmatches genomes sharing theNellyANDErikvariation while--profile S:N501Y --profile S:E484Kmatches to genomes that share either theNellyORErikvariationORboth. Accordingly, using the option^profiles can be defined that have not to be present in the matched genomes.There are additional options to adjust the matching.optiondescription--countcount matching genomes onlyexample;./sonar.pymatch--profileS:E484K--LINEAGEB.1.1.7--dbtest.db# matching B.1.1.7 genomes in DB 'test.db' that share an additional "Erik" mutation./sonar.pymatch--profileS:E484K--LINEAGEB.1.1.7--dbtest.db# as before but matching genomes are counted only./sonar.pymatch--profileS:E484K--LINEAGEB.1.1.7--count--dbtest.db# matching genomes in DB 'test.db' sharing the "Nelly" mutation# and that were sampled in 2020./sonar.pymatch--profileS:N501Y--DATE2020-01-01:2020-12-31--dbtest.db# matching genomes in DB 'mydb' sharing the "Nelly" and the "Erik" mutation but not# belonging to the B.1.1.7 lineage./sonar.pymatch-profileS:N501YS:E484K--LINEAGE^B.1.1.7--dbtest.dbExport to CSV/TSV/VCF filecovSonar can return results in different formats:--format ["csv", "tsv", "vcf"]# example command./sonar.pymatch--profileS:N501YS:E484K--LINEAGE^B.1.1.7--dbtest.db--formatcsv-oout.csv# in vcf format./sonar.pymatch-iS:N501YS:E484K--lineageQ.1--dbtest.db--formatvcf-oout.vcf# example of --sample-file./sonar.pymatch--sample-fileaccessions.txt--dbtest.db--formatvcf-oout.vcfParent-Child relationship⚠️ This function we only test on SARS-CoV-2If we want to search all sublineages with a given lineage, covSonar offers--with-sublineage PROP_COLUMN(PROP_COLUMN  means the property name that we added to our database)../sonar.pymatch--profleS:E484K--LINEAGEB.1.1.7--with-sublineageLINEAGE--count--dbtest.db--debugThis query will return results ('B.1.1.7', 'Q.4', 'Q.5', 'Q.3', 'Q.6', 'Q.1', 'Q.7', 'Q.2', 'Q.8').By default, we use SARS-CoV-2 lineages for this search and the file name must belineage.all.tsv.lineage-update function for SARS-CoV-2 (COVID-19) ❗Runupdate-lineage-infoflag, it will download the latest version of lineages fromhttps://github.com/cov-lineages/pango-designation/and install it inlib/lineage.all.tsv# example command./sonar.pyupdate-lineage-info3.5 Show infos about the used sonar system and database (info)Detailed infos about the used sonar system (e.g. version, reference,  number of imported genomes, unique sequences, available metadata).# Show infos about the used sonar system and database 'test.db'./sonar.pyinfo--dbtest.db3.6 Restore genome sequences from the database (restore)Genome sequences can be restored from the database based on their accessions.
The restored sequences are combined with their original FASTA header and  shown on the screen. The screen output can be redirected to a file easily by using>.# Restore genome sequences linked to accessions 'mygenome1' and 'mygenome2' from the# database 'test.db' and write these to a fasta file named 'restored.fasta'./sonar.pyrestore--samplemygenome1mygenome2--dbtest.db>restored.fasta# as before, but consider all accessions from 'accessions.txt' (the file has to# contain one accession per line)./sonar.pyrestore--sample-fileaccessions.txt--dbtest.db>restored.fasta3.7 Database management (db-upgrade, optimize)Sometimes you might need theoptimizecommand to clean theproblemsfrom database operation (e.g., unused data block or storage overhead ).# Show infos about the used sonar system./sonar.pyoptimize--dbtest.dbWhen the newest version of covSonar use an old database version, covSonar will return  the following error;Compatibilityerror:thegivendatabaseisnotcompatiblewiththisversionofsonar(Currentdatabaseversion:XXX;Supporteddatabaseversion:XXX)Pleaserun'sonar.py  db-upgrade'toupgradedatabaseWe provide our database upgrade assistant to solve the problem.# RUN./sonar.pydb-upgrade--dbtest.db# OutputWarning:Backupdbfilebeforeupgrading,PressEntertocontinue...## after pressing the Enter keyCurrentversion:3Upgradeto:4PerformtheUpgrade:file:mydb.db
Databasenowversion:4Success:Databaseupgradewassuccessfullycompleted⚠️ Warning: Backup the db file before upgrade.How to contribute 🏗️covSonar has been very carefully programmed and tested, but is still in an early stage of development. You can contribute to this project by reporting problems 🐛 or writing feature requests to theissue section👨‍💻Your feedback is very welcome 👨‍🔧!ContactFor business inquiries or professional support requests 🍺 please contactDr. Stephan Fuchs