Skip to content

Instantly share code, notes, and snippets.

@nh13
nh13 / .bash_profile
Created December 23, 2019 18:23
Bash function for switching AWS profiles
function aws_switch {
last_profile=$(cat ~/.aws/.last_profile | xargs)
last_profile_i=1;
i=1
profiles=()
for profile in $(grep "^\[.*\]$" ~/.aws/credentials | sed -e 's_^\[__' -e 's_\]$__' | sort)
do
echo "[$i] $profile";
profiles+=( "$profile" );
@nh13
nh13 / README.md
Created August 23, 2019 16:18
Mill issues
@nh13
nh13 / primer_list.log
Created August 21, 2019 15:54
All the primers
[2019/08/20 23:31:03 | SortPrimerPairs | Info] Wrote 2,400,000,000 primer pairs. Elapsed time: 07:37:04s. Time for last 2,000,000: 14s. Last read position: chrY:13,479,780
@nh13
nh13 / concatenate_subread_fastqs.sh
Last active August 17, 2019 17:12
DemuxFastqs with multiple FASTQs per sub-read
#!/bin/bash
set -euo pipefail
# Concatenate the FASTQs per sub-read prior to running DemuxFastqs
cat SAMPLE1_S1_L001_R1_001.fastq.gz SAMPLE1_S1_L001_R1_002.fastq.gz > SAMPLE1_S1_L001_R1_COMBINED.fastq.gz;
cat SAMPLE1_S1_L001_R2_001.fastq.gz SAMPLE1_S1_L001_R2_002.fastq.gz > SAMPLE1_S1_L001_R2_COMBINED.fastq.gz;
# Run Demux Fastqs (try `conda install -c bioconda fgbio` to install `fgbio`).
# Note: since we have two sub-reads, we must have two read structures.
#!/bin/bash
set -euo pipefail
fgbio_cmd="java -Xmx8G -jar /Users/nhomer/git/fg/fgbio/target/scala-2.12/fgbio-0.8.0.jar"
function build_it ()
{
local src_build=$1;
local target_build=$2;
>M1
CATAAAAGAACGTAGGTCGCCCGTCCGTAACCTGTCGGATCACCGGAAAGGACCCGTAAAGTGATAATGAT
ATAAAGGCAGTCGCTCTGTAAGCTGTCGATTCACCGGAAAGATGGCGTTACCACGTAAAGTGATAATGATTAT
ATCAAAGAACGTGTAGCCTGTCCGTAATCTAGCGCATTTCACACGAGACCCGCGTAATGGG
CGTAAATAGGTAATGATTATCATTACATATCACAACTAGGGCCGTATTAATCATGATATCATCA
GTCGCTAGAGGCATCGTGAGTCGCTTCCGTACCGCAAGGATGACGAGTCACTTAAAGTGATAAT
CCGTAACCTTCATCGGATCACCGGAAAGGACCCGTAAATAGACCTGATTATCATCTACAT
>M2
CATAAAAGAACGTAGGTCGCCCGTCCGTAACCTGTCGGATCACCGGAAAGGACCCGTAAAGTGATAATGAT
ATAAAGGCAGTCGCTCTGTAAGCTGTCGATTCACCGGAAAGATGGCGTTACCACGTAAAGTGATAATGATTAT
@nh13
nh13 / aws_s3_summarize.py
Created February 26, 2018 20:08
Summarize the sizes of S3 path prefixes
#!/bin/python
import sys
import argparse
from pathlib import Path
from collections import OrderedDict
import math
units_and_size = [
('Bytes', 1),
@nh13
nh13 / SamToFastq.scala
Created December 14, 2017 18:00
Bioinformatic Tool Series: SAM to FASTQ with UMIs and Barcodes
/*
* The MIT License
*
* Copyright (c) 2017 Fulcrum Genomics LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
package com.nilshomer.bfx.examples.utilities
import com.fulcrumgenomics.bam.api.SamSource
import com.fulcrumgenomics.cmdline.ClpGroups
import com.fulcrumgenomics.commons.CommonsDef.{PathToBam, SafelyClosable}
import com.fulcrumgenomics.commons.util.{LazyLogging, NumericCounter, SimpleCounter}
import com.fulcrumgenomics.sopt.{arg, clp}
import com.fulcrumgenomics.util.{Io, ProgressLogger}
import com.nilshomer.bfx.examples.cmdline.BfxExamplesTool
@nh13
nh13 / RegenerateNmUqMdTags.scala
Last active November 5, 2017 06:16
A tool to regenerate the NM/UQ/MD tags on a SAM or BAM file Raw with logging
package com.nilshomer.bfx.examples.utilities
import com.fulcrumgenomics.FgBioDef.PathToFasta
import com.fulcrumgenomics.bam.Bams
import com.fulcrumgenomics.bam.api.{SamOrder, SamSource, SamWriter}
import com.fulcrumgenomics.cmdline.ClpGroups
import com.fulcrumgenomics.commons.CommonsDef.{PathToBam, SafelyClosable}
import com.fulcrumgenomics.commons.util.LazyLogging
import com.fulcrumgenomics.sopt.{arg, clp}
import com.fulcrumgenomics.util.{Io, ProgressLogger}