{"id":19829113,"url":"https://github.com/ssi-dk/bifrost_sp_ecoli","last_synced_at":"2026-06-24T06:34:16.734Z","repository":{"id":256153972,"uuid":"821289438","full_name":"ssi-dk/bifrost_sp_ecoli","owner":"ssi-dk","description":"Ecoli related analysis for the SOFI platform.","archived":false,"fork":false,"pushed_at":"2026-03-18T11:58:34.000Z","size":3647,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-03-18T23:05:35.003Z","etag":null,"topics":["bifrost","ecoli","sofi","typing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssi-dk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-28T08:01:44.000Z","updated_at":"2026-03-18T11:58:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"f462db36-129b-4072-aec2-d58d3e2557e7","html_url":"https://github.com/ssi-dk/bifrost_sp_ecoli","commit_stats":null,"previous_names":["ssi-dk/bifrost_sp_ecoli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssi-dk/bifrost_sp_ecoli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-dk%2Fbifrost_sp_ecoli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-dk%2Fbifrost_sp_ecoli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-dk%2Fbifrost_sp_ecoli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-dk%2Fbifrost_sp_ecoli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssi-dk","download_url":"https://codeload.github.com/ssi-dk/bifrost_sp_ecoli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi-dk%2Fbifrost_sp_ecoli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34720920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bifrost","ecoli","sofi","typing"],"created_at":"2024-11-12T11:17:49.368Z","updated_at":"2026-06-24T06:34:16.726Z","avatar_url":"https://github.com/ssi-dk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bifrost_sp_ecoli\n\nThis component is used to analyze specific samples belonging to the *Escherichia coli* or *Shigella* species and determine shiga toxin subtype(s), O type, H type, Adhesin markers, Virulence markers and other detected genes not classified within these main groups.\n\n## Requirements\n- The component is alignment-based using the tool [KMA](https://bitbucket.org/genomicepidemiology/kma).\n- The versions are described in the [environment.yaml](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/environment.yml)\n- The alignment uses the trimmed reads from another [component](https://github.com/ssi-dk/bifrost_min_read_check/tree/master).\n- The alignment uses a curated reference [database](https://github.com/ssi-dk/bifrost_sp_ecoli/tree/main/bifrost_sp_ecoli/resources).\n- This species-specific analysis can only run on samples that belong to the two (currently) previously mentioned species, which have been determined from another [component](https://github.com/ssi-dk/bifrost_whats_my_species).\n\n## Download\n```bash\ngit clone https://github.com/ssi-dk/bifrost_sp_ecoli.git\ncd bifrost_sp_ecoli\ngit submodule init\ngit submodule update\nbash install.sh -i LOCAL\nconda activate bifrost_sp_ecoli_vx.x.x\nexport BIFROST_INSTALL_DIR='/your/path/'\nBIFROST_DB_KEY=\"/your/key/here/\" python -m bifrost_sp_ecoli -h\n```\n\n## Run the snakemake analysis\nEach component can be run on each sample individually using one snakemake command, replacing the string passed to the **--config sample_name=\" \"** with the appropriate dataset name. The provided **component_name=** takes as an argument *\u003ccomponent_name\u003e__\u003cversion_number\u003e*. The component name aligns with the GitHub repo name, which is structured like *bifrost_\u003ccomponent_name\u003e* (e.g. *bifrost_sp_ecoli* -\u003e component name *sp_ecoli*), and the version number aligns with the current [GitHub tag](https://github.com/ssi-dk/bifrost_sp_ecoli/tags) / or conda environment [version](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/setup.py) (e.g. *v.0.0.2*) defined during the bifrost component setup. \n```bash\nsnakemake -p --nolock --cores 5 -s \u003cpath\u003e/pipeline.smk --config sample_name=\"insert sample name\" component_name=sp_ecoli__v0.0.2 --rerun-incomplete\n```\n\n## Add a species\nIf any additional species need this typing component, the files [config.yaml](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/config.yaml) (describing the species name and abbreviation) and [GeneFilter.yaml](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/GeneFilter.yaml) (containing the allele-specific threshold) needs to be altered. \n\n## Analysis\nTo determine the various groups of marker genes (shiga toxin subtype(s), O type, H type, Adhesin markers, Virulence markers, other genes), the [rule_ecolityping](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/rule__ecolityping.py) defined in the [pipeline](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/pipeline.smk) wrangles the kma results, identifying the gene from the *#Template* column.\n\n### KMA result\nOne example of the aligned kma results *kma.res*\n```bash\n#Template       Score   Expected        Template_length Template_Identity       Template_Coverage       Query_Identity  Query_Coverage  Depth   q_value p_value\n1__wzx__O157__JH959508     78656            1730            1392          100.00          100.00          100.00          100.00           56.60        73613.56        1.0e-26\n2__wzy__O157__JH953200     24223            1532            1185          100.00          100.00          100.00          100.00           20.27        19989.30        1.0e-26\n5__fliC__H7__AF228487     359574            1726            1758          100.00          100.00          100.00          100.00          204.77        354427.40       1.0e-26\n12__eae__eae-42__AF071034         440253            2546            2805          100.00          100.00          100.00          100.00          157.42        432671.71       1.0e-26\n32__ehxA__ehxA-3__AB011549        134647            3574            2997           99.97          100.00           99.97          100.00           45.08        124291.98       1.0e-26\n6__stx2__stx2-a__X07865   305905            1280            1241           99.92          100.00           99.92          100.00          246.78        302085.84       1.0e-26\n7__stx2__stx2-c__AB015057          70033            1552            1241          100.00          100.00          100.00          100.00           56.33        65510.17        1.0e-26\n```\nEach template describes the gene belonging to one of the categories (shiga toxin subtype(s), O type, H type, Adhesin markers, Virulence markers, other genes). \n\n### Gene filtering\nThe following columns *template_cov*, *query_ident*, *Depth* from the KMA result are used for downstream filtering. These values are compared against gene-specific thresholds defined in the [configuration](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/GeneFilter.yaml) file with a list of thresholds for the three columns [#template_cov, query_ident, Depth] as shown below. \n\ne.g.\n```bash\nEscherichia:\n  stx1: [98,98,10]\n  stx2: [98,98,10]\n.\n.\n.\n  ehxA: [98,98,10]\n  other: [90,90,10]\n```\nTo determine any of the described categories, in this example, the Template needs template coverage and query identity above 98%  with a depth of coverage above 10. Only hits that pass the relevant thresholds are retained for downstream typing, helping ensure that the final calls (e.g. *1__wzx__O157__JH959508* → gene = *wzx*, allele = *O157*) accurately reflect the allele pathogenic profile of the analyzed isolate. Any genes not defined within the   marker gene categories (*stx1,stx2,wzx,wzy,wzt,wzm,fliC,fli,fl,eae,ehxA*) will be classified as *other* and thus filtered with a template coverage and identity above 90 and depth of coverage above 10.\n\nOnce the templates have been filtered according to the described thresholds, the various categories are set according to the following criteria:\n\n- **Shiga Toxin:** Only PASSED hits for _stx*_ genes are used to make the toxin call, and alleles are collected separately for *stx1* and *stx2*. Toxin calling is not based on a single best hit — it reports all passing toxin alleles, and only the unique alleles are reported in the final result. Thus, the *Toxin* field (described in the [Final results](#final-results)) is the union of all unique *stx1* and *stx2* alleles that passed.\n\n- **O-type:** Only PASSED hits for _wz*_ genes (`wzx`, `wzy`, `wzt`, `wzm`) are used to build O-type candidates. The candidates are separated into pairs `wzx/wzy` and `wzt/wzm`, and the final column *sero_serotype_finder* (described in the [Final results](#final-results)) is only assigned an O-type if all valid candidate pairs agree on the same allele. Thus, non-concordant PASS hits among _wz*_ genes do not produce an O-type call, but are retained in the `toxin_details` column.\n\n    Examples:\n    1. `wzx/wzy = O157` and `wzt/wzm = O157` → `O_type = O157`\n    2. `wzx/wzy = O157` and `wzt/wzm` is invalid or ambiguous → `O_type = O157`\n    3. `wzx/wzy` is invalid or ambiguous and `wzt/wzm = O157` → `O_type = O157`\n    4. `wzx/wzy = O157` and `wzt/wzm = O26` → `O_type = -`\n    5. Both pairs are ambiguous or mismatching → `O_type = -`\n\n- **H-type:** Only PASSED hits for *fliC* or any _fl*_ alleles used to build the H-type candidates. If *fliC* is present, the H-type is collected, and any _fl*_ allele is disregarded. If *fliC* is absent, the H-type is determined from any  _fl*_ alleles. Thus, the H-typing includes a preference rule using *fliC* with _fl*_ as a fallback and only makes the final call when the results are unambiguous. The determined H-type is then concatenated together with the determined string, extending the value in the final result column *sero_serotype_finder* (described in the [Final results](#final-results))\n\n - **Adhesin-type:** Only PASSED hits for *eae* genes are used to determine Adhesin. The *Adhesin* column (described in the [Final results](#final-results)) is treated as a presence/absence marker, not subtype calls, thus if one or several PASS eae alleles are present, the column is set to *positive* \n\n - **Virulence-type:** Only PASSED hits for *ehx* genes are used to determine Hemolysin. The *Virulence* column (described in the [Final results](#final-results)) is treated as a presence/absence marker, not subtype calls, thus if one or several PASS eae alleles are present, the column is set to *positive*\n\n- **Other:** Any other genes will be assigned to the string within the final results column *toxin_details* (described in the [Final results](#final-results)).\n\n### Final results\nThe pipeline generates numerous output files with filtered genes for each category (e.g. *\u003csample_name\u003e__typing_H.tsv*) , while also creating a final concatenated output file (*\u003csample_name\u003e_typing_final.tsv*), which is stored within the database using the script [datadump](https://github.com/ssi-dk/bifrost_sp_ecoli/blob/main/bifrost_sp_ecoli/datadump.py).\n\nOnce downstream filtering of the original KMA results has been completed, the final results are shown below.\n```bash\nsample_id       Toxin   sero_serotype_finder    Adhesin Virulence       toxin_details\n\"\u003csample_name\u003e\"  stx2-a;stx2-c   O157;H7 positive        positive        toxin:pass:stx2-a_100.00_99.92_246.78;stx2-c_100.00_100.00_56.33|fail:-||Otype:pass:wzx_O157_100.00_100.00_56.60;wzy_O157_100.00_100.00_20.27|fail:-||Htype:pass:fliC_H7_100.00_100.00_204.77|fail:-||adhesin_virulence:pass:eae_eae-42_100.00_100.00_157.42;ehxA_ehxA-3_100.00_99.97_45.08|fail:-||other:pass:-|fail:-\n```\n\nThe **toxin_details** column contains the information regarding the *template_cov*, *query_ident*, *Depth* (from the [KMA result](#kma-result)) for all genes which passed or failed the thresholds. The column string is organized by first describing the shiga toxin details *toxin:pass: ... | fail: ...* followed by the O type, then H type, then adhesin and virulence and finally the remaining genes within the *other:pass: ... | fail: ...*\n\n### Conclusion\nFrom the final results above for this test example, it is possible to determine that this strain *Escherichia coli* O157:H7 is a highly virulent Shiga toxin-producing E. coli (STEC).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi-dk%2Fbifrost_sp_ecoli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssi-dk%2Fbifrost_sp_ecoli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi-dk%2Fbifrost_sp_ecoli/lists"}