Mercurial > repos > artbio > repenrich2
comparison RepEnrich2.py @ 8:567549a49eb2 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/main/tools/repenrich2 commit b3b166a8e991f49227e4888b8065b57cec0ba949
author | artbio |
---|---|
date | Thu, 25 Apr 2024 09:06:48 +0000 |
parents | 61e0404f0d76 |
children | 2b61c6407efb |
comparison
equal
deleted
inserted
replaced
7:61e0404f0d76 | 8:567549a49eb2 |
---|---|
108 def run_bowtie(args): | 108 def run_bowtie(args): |
109 ''' | 109 ''' |
110 write to files to save memory | 110 write to files to save memory |
111 ''' | 111 ''' |
112 metagenome, fastqfile = args | 112 metagenome, fastqfile = args |
113 b_opt = "-k 1 -p 1 --quiet --no-hd" | 113 b_opt = "-k 1 -p 1 --quiet --no-hd --no-unal" |
114 command = shlex.split(f"bowtie2 {b_opt} -x {metagenome} {fastqfile}") | 114 command = shlex.split(f"bowtie2 {b_opt} -x {metagenome} {fastqfile}") |
115 bowtie_align = subprocess.run(command, check=True, | 115 bowtie_align = subprocess.run(command, check=True, |
116 capture_output=True, text=True).stdout | 116 capture_output=True, text=True).stdout |
117 bowtie_align = bowtie_align.rstrip('\r\n').split('\n') | 117 bowtie_align = bowtie_align.rstrip('\r\n').split('\n') |
118 with open(f"{metagenome}.reads", "a+") as readfile: | 118 with open(f"{metagenome}.reads", "a+") as readfile: |
146 for repname in metagenome_reads: | 146 for repname in metagenome_reads: |
147 for read in metagenome_reads[repname]: | 147 for read in metagenome_reads[repname]: |
148 repeats_by_reads[read].append(repname) | 148 repeats_by_reads[read].append(repname) |
149 for repname in repeats_by_reads: | 149 for repname in repeats_by_reads: |
150 repeats_by_reads[repname] = list(set(repeats_by_reads[repname])) | 150 repeats_by_reads[repname] = list(set(repeats_by_reads[repname])) |
151 # this repeats_by_reads dictionary is far too big | |
151 | 152 |
152 # 3 dictionnaries and 1 pointer variable to be populated | 153 # 3 dictionnaries and 1 pointer variable to be populated |
153 fractionalcounts = defaultdict(float) | 154 fractionalcounts = defaultdict(float) |
154 familyfractionalcounts = defaultdict(float) | 155 familyfractionalcounts = defaultdict(float) |
155 classfractionalcounts = defaultdict(float) | 156 classfractionalcounts = defaultdict(float) |