Skip to content

Instantly share code, notes, and snippets.

View bogemad's full-sized avatar

Daniel Bogema bogemad

  • Sydney, Australia
View GitHub Profile
@bogemad
bogemad / convert_to_paired_end.py
Created January 31, 2023 23:44
Converts single end data (e.g. Ion Torrent) to paired end format suitable for pipelines that only accept Illumina input.
#!/usr/bin/env python
from Bio import SeqIO, bgzf
import sys
from gzip import open as gzopen
infile = sys.argv[1]
outprefix = sys.argv[2]
print("Splitting reads...")
#!/usr/bin/env python
import sys, os, re
from Bio import SeqIO
base_dir = sys.argv[1]
keyword = sys.argv[2]
outdir = sys.argv[3]
min_len = int(float(sys.argv[4])*1000000)
@bogemad
bogemad / reorder-ncbi-genome-download.py
Last active April 16, 2019 00:41
Renames and extracts files downloaded using ncbi-genome-download run with the --human-readable option
#!/usr/bin/env python3
import argparse, os, sys, gzip, shutil
parser = argparse.ArgumentParser(description="Reorders and extracts files downloaded using ncbi-genome-download run with the --human-readable option")
parser.add_argument("-o", "--output-directory", required=True, help="Path to the output directory. A directory will be created if one does not exist.", action="store", dest="outdir")
parser.add_argument("-g", "--group-directory", required=True, help="Path to the group (bacteria, viral, etc.) directory from the ncbi-genome-download human-readable output. If refseq genomes were downloaded from the bacteria group then the input should be <ncbi-genome-download-output>/human_readable/refseq/bacteria ", action="store", dest="group_dir")
parser.add_argument("-f", "--force", help="Overwrite files in the output directory.", action='store_true', default=False)
args = parser.parse_args()
#!/usr/bin/env python
import os, sys, subprocess
def main():
conda_base_path = os.path.dirname(os.path.dirname(__file__))
path = sys.argv[1]
env = get_env()
gen_activate_script(path, env, conda_base_path)