Mercurial > repos > artbio > repenrich
comparison RepEnrich_setup.py @ 14:bf866bedd4b4 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/main/tools/repenrich commit 205141a3f695f202d5c3e01e6ab3b2b869fe62b5
| author | artbio |
|---|---|
| date | Sat, 20 Apr 2024 12:13:52 +0000 |
| parents | 530626b0757c |
| children | 2e3d976e7d5d |
comparison
equal
deleted
inserted
replaced
| 13:530626b0757c | 14:bf866bedd4b4 |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 import argparse | 2 import argparse |
| 3 import csv | 3 import csv |
| 4 import os | |
| 5 import shlex | 4 import shlex |
| 6 import subprocess | 5 import subprocess |
| 7 import sys | 6 import sys |
| 8 from collections import defaultdict | 7 from collections import defaultdict |
| 9 from concurrent.futures import ProcessPoolExecutor | 8 from concurrent.futures import ProcessPoolExecutor |
| 45 gapl = args.gaplength | 44 gapl = args.gaplength |
| 46 flankingl = args.flankinglength | 45 flankingl = args.flankinglength |
| 47 annotation_file = args.annotation_file | 46 annotation_file = args.annotation_file |
| 48 genomefasta = args.genomefasta | 47 genomefasta = args.genomefasta |
| 49 cpus = args.cpus | 48 cpus = args.cpus |
| 50 | |
| 51 # check that the programs we need are available | |
| 52 try: | |
| 53 subprocess.call(shlex.split("bowtie --version"), | |
| 54 stdout=open(os.devnull, 'wb'), | |
| 55 stderr=open(os.devnull, 'wb')) | |
| 56 except OSError: | |
| 57 print("Error: Bowtie not available in the path") | |
| 58 raise | |
| 59 | 49 |
| 60 | 50 |
| 61 def starts_with_numerical(list): | 51 def starts_with_numerical(list): |
| 62 try: | 52 try: |
| 63 if len(list) == 0: | 53 if len(list) == 0: |
| 113 metagenome = '' | 103 metagenome = '' |
| 114 # iterating coordinate list by block of 3 (chr, start, end) | 104 # iterating coordinate list by block of 3 (chr, start, end) |
| 115 block = 3 | 105 block = 3 |
| 116 for i in range(0, len(rep_coords[repname]) - block + 1, block): | 106 for i in range(0, len(rep_coords[repname]) - block + 1, block): |
| 117 batch = rep_coords[repname][i:i+block] | 107 batch = rep_coords[repname][i:i+block] |
| 118 print(batch) | |
| 119 chromosome = batch[0] | 108 chromosome = batch[0] |
| 120 start = max(int(batch[1]) - flankingl, 0) | 109 start = max(int(batch[1]) - flankingl, 0) |
| 121 end = min(int(batch[2]) + flankingl, | 110 end = min(int(batch[2]) + flankingl, |
| 122 int(genome[chromosome]['length'])-1) + 1 | 111 int(genome[chromosome]['length'])-1) + 1 |
| 123 metagenome = ( | 112 metagenome = ( |
