Skip to content

Instantly share code, notes, and snippets.

@evanroyrees
Created April 6, 2020 16:36
Show Gist options
  • Save evanroyrees/1579c7158d4a3ff09b12de51ab11abdc to your computer and use it in GitHub Desktop.
Save evanroyrees/1579c7158d4a3ff09b12de51ab11abdc to your computer and use it in GitHub Desktop.
Example temporary script calling only argparse for usage information
import argparse
import logging as logger
import multiprocessing as mp
logger.basicConfig(
format='%(asctime)s : %(name)s : %(levelname)s : %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=logger.DEBUG)
# This is pulled directly from autometa/common/coverage.py
parser = argparse.ArgumentParser(description='Construct contig coverage table given an input assembly and reads.')
# Notice! the usage information resembles the name of the script...
# So you will need to update the usage within the ArgumentParser..
# I.e.
# parser = argparse.ArgumentParser(
# usage='coverage.py',
# description='Construct contig coverage table given an input assembly and reads.')
parser.add_argument('-f','--assembly', help='</path/to/metagenome.fasta>', required=True)
parser.add_argument('-1', '--fwd-reads', help='</path/to/forwards-reads.fastq>', nargs='*')
parser.add_argument('-2', '--rev-reads', help='</path/to/reverse-reads.fastq>', nargs='*')
parser.add_argument('-U', '--se-reads', help='</path/to/single-end-reads.fastq>', nargs='*')
parser.add_argument('--sam', help='</path/to/alignments.sam>')
parser.add_argument('--bam', help='</path/to/alignments.bam>')
parser.add_argument('--lengths', help='</path/to/lengths.tsv>')
parser.add_argument('--bed', help='</path/to/alignments.bed>')
parser.add_argument('--nproc',
help=f'Num processors to use. (default: {mp.cpu_count()})',
default=mp.cpu_count(),
type=int)
parser.add_argument('--from-spades',
help='Extract k-mer coverages from contig IDs. (Input assembly is output from SPAdes)',
action='store_true',
default=False)
parser.add_argument('--out', help='</path/to/coverages.tsv>', required=True)
args = parser.parse_args()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment