From c203a3be8bb168d9aa9fe0ba5e6e9f365b4bfa9b Mon Sep 17 00:00:00 2001 From: Kirill Bessonov Date: Thu, 7 Nov 2024 16:30:08 -0500 Subject: [PATCH] Updated bowtie2 setting to be compatible with long reads --- ectyper/genomeFunctions.py | 4 +++- ectyper/predictionFunctions.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ectyper/genomeFunctions.py b/ectyper/genomeFunctions.py index fd57562..ebef144 100644 --- a/ectyper/genomeFunctions.py +++ b/ectyper/genomeFunctions.py @@ -232,8 +232,10 @@ def assemble_reads(reads, bowtie_base, combined_fasta, temp_dir, cores=1): bowtie_run = [ 'bowtie2', '--threads',f'{cores}', + '--local', '--score-min L,1,-0.5', '--np 5', + '--no-unal', '-x', bowtie_base, '-U', reads, '-S', sam_reads @@ -248,7 +250,7 @@ def assemble_reads(reads, bowtie_base, combined_fasta, temp_dir, cores=1): 'samtools', 'view', '--threads', f'{cores}', '-S', - '-F 4', + '-F 4', #filter out the unmapped reads '-q 1', '-b', '-o', bam_reads, diff --git a/ectyper/predictionFunctions.py b/ectyper/predictionFunctions.py index b01fc83..797d64a 100644 --- a/ectyper/predictionFunctions.py +++ b/ectyper/predictionFunctions.py @@ -534,7 +534,6 @@ def get_prediction(per_genome_df): #find pairwise distance between all alleles indentified by BLAST search and find alleles with IDENTICAL O-antigen score #Note that difference in score of 0 between O antigens is considered to be identical - identicalscorestupleslist = [(orow, ocol, abs(i - j)) for ocol, i in scorestupleslist for orow, j in scorestupleslist if i - j == 0 and (orow == selectedOantigen or ocol == selectedOantigen) and (orow != ocol)] @@ -548,7 +547,7 @@ def get_prediction(per_genome_df): if highsimilarity_oantigens: - mixedoantigen = [selectedOantigen] + highsimilarity_oantigens + mixedoantigen = sorted([selectedOantigen] + highsimilarity_oantigens, key = lambda x: re.search('O(\d+)',x).group(1), reverse=True) serotype['O']['serogroup'] = "/".join(mixedoantigen) LOG.info("Highly similar O-antigen candidates were found for {}".format(mixedoantigen)) elif selectedOantigen != "":