Package: refgenDetector
EGA - RefgenDetectorRefgenDetector is a python tool that infers the reference genome assembly used during the read alignment for BAM and
CRAM files. The proposed tool is designed to facilitate the analysis of genomic data with incomplete metadata
annotation. RefgenDetector can differentiate between major human reference genome releases, as well as commonly used
flavors, by utilizing the LN and SN mandatory fields in the BAM and CRAM headers. The tool includes dictionaries with
information on contig names and lengths, enabling it to accurately identify unique contigs and differentiate between
different flavors of the reference genome.DescriptionRefgenDetector is able to infer the following reference genomes:NCBI35/hg17NCBI36.1/hg18GRCh37hg19b37hs37d5GRCh38Verily's GRCh38hs38DH_extraT2TRequirementsPython 3.10.6Depending on how you want to install the package:pip 23.1.2Docker version 24.0.2InstallationCloning this repositoryClone this repository$ cd PATH_WHERE_YOU_CLONED_THE_REPOSITORY/src/refgenDetector$ python3 refgenDetector.py -hFrom pypiAll the information can be foundhere$ pip install refgenDetectorDockerAll the instructions to run refgenDetector in a Docker container can be foundhere.UsageYou can get the help menu by running:$ refgenDetector -husage: INFERRING THE REFERENCE GENOME USED TO ALIGN BAM OR CRAM FILE
       [-h] -p PATH -t {BAM/CRAM,Headers} [-m] [-a]

options:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  Path to main txt. It will consist of the paths to the
                        files to be analyzed (one path per line)
  -t {BAM/CRAM,Headers}, --type {BAM/CRAM,Headers}
                        All the files in the txt provided in --path must be
                        BAM/CRAMs or headers in a txt. Choose -tdepending on
                        the type of files you are going to analyze
  -m, --md5             [OPTIONAL] If you want to obtain the md5 of the
                        contigs present in the header, add --md5 to your
                        command. This will print the md5 values if the field
                        M5 was present in your header
  -a, --assembly        [OPTIONAL] If you want to obtain the assembly declared
                        in the header add --assembly to your command. This
                        will print the assembly if the field AS was present in
                        your headerIn the main file (-p argument) you should add the paths to all the files you want to analyze. RefgenDetector
works with complete BAM and CRAMs and with txt files containing only the headers. The txt can be uncompressed, gzip
compressed, and with encodings utf-8 and iso-8859-1.All the files included in this argument must be the same type, meaning, you should run RefgenDetector to analyze only
BAM/CRAMs or only headers.Test RefgenDetectorIn the folderexamplesyou can find headers, BAM and CRAMs to test the working of RefgenDetector.All this files belong to thesynthetics data cohortfrom the European
Genome-Phenome Archive (EGA).Test with headers in a TXTIn the folder TEST_HEADERS there are four headers obtained from synthetic BAM an CRAMs stored in the EGA. Each one of
them belongs to a different synthetic study:Test Study for EGA using data from 1000 Genomes Project - Phase
3EGAS00001005042.Synthetic data - Genome in a Bottle -EGAS00001005591.Human genomic and phenotypic synthetic data for the study of rare
diseases -EGAS00001005702.CINECA synthetic data.Please note: This study contains synthetic data (with cohort “participants” / ”subjects” marked
with FAKE) has no identifiable data and cannot be used to make any inference about cohort data or
results -EGAS00001002472.Further information about them can be found in the filewhere_to_find_this_files.txt, saved in the same folder.To run RefgenDetector with the files:Modify the txtpath_to_headersso the paths match those in your computer.Run:$ refgenDetector -p /PATH_WHERE_YOU_CLONED_THE_REPOSITORY/refgenDetector/examples/path_to_headers -t HeadersCheck your installation has been successful by checking the test results are correct:PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_HEADERS/EGAF00001753746, b37
PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_HEADERS/EGAF00005469864, hg19
PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_HEADERS/EGAF00005572695.gz, hs37d5
PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_HEADERS/EGAF00007462306, hs38DH_extraTest with BAM and CRAMsIn the folder TEST_BAM_CRAM there are a BAM and a CRAM obtained from synthetic BAM an CRAMs stored in the EGA. They
belong to the synthetic study - Test Study for EGA using data from 1000 Genomes Project - Phase
3EGAS00001005042.Further information about them can be found in the filewhere_to_find_this_files.txt, saved in the same folder.To run RefgenDetector with the files:Modify the txtpath_to_bam_cramso the paths match those in your computer.Run:$ refgenDetector -p /PATH_WHERE_YOU_CLONED_THE_REPOSITORY/refgenDetector_pip-master/examples/path_to_bam_cram-t BAM/CRAMCheck your installation has been successful by checking the test results are correct:PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_BAM_CRAM/HG00096.GRCh38DH__1097r__10.10000-10100__21.5000000-5050000.bam, hs38DH_extra
PATH_TO_YOUR_COMPUTER_SETUP/refgenDetector_pip-master/examples/TEST_BAM_CRAM/HG00096.GRCh38DH__1097r__10.10000-10100__21.5000000-5050000.cram, hs38DH_extraLicence and fundingRefgenDetector is released under GNU General Public License v3.0.It was funded by ELIXIR, the research infrastructure for life-science data (ELIXIR Beacon Implementation Studies
2019-2021 and 2022-2023).