Skip to content

Instantly share code, notes, and snippets.

/** Performs the unit of work on a resource of type [A] cleaning up the resource in the case of an exception or upon
* completion.
* @param resource the resource upon which work is performed.
* @param cleanup the clean up method to apply to the resource when the work is complete.
* @param doWork the work to perform on the resource, returning a result of type [B].
* @tparam A the resource type
* @tparam B the result type of the work performed.
* @return Success if the work was performed successfully, Failure otherwise.
*/
@nh13
nh13 / Test.MD
Created May 10, 2017 17:49
Link test

--input r1.fq r2.fq i1.fq --read-structures 5M5S65T 75T 8B

For more information on read structures see: https://github.com/fulcrumgenomics/fgbio/wiki/Read-Structures

The same number of input files and read structures must be provided, with one exception: if supplying exactly 1 or 2 fastq files, both of which are solely template reads, no read structures need be provided.

@nh13
nh13 / Makefile
Created September 6, 2017 18:12 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@nh13
nh13 / HelloWorld.scala
Created November 4, 2017 18:51
Hello World
package com.nilshomer.bfx.examples.utilities
import com.fulcrumgenomics.cmdline.ClpGroups
import com.fulcrumgenomics.sopt.clp
import com.nilshomer.bfx.examples.cmdline.BfxExamplesTool
@clp(
description = "Prints hello world to standard out and exits.",
group = ClpGroups.Utilities
)
@nh13
nh13 / PrintName.scala
Created November 4, 2017 19:04
PrintName
package com.nilshomer.bfx.examples.utilities
import com.fulcrumgenomics.cmdline.ClpGroups
import com.fulcrumgenomics.sopt.{arg, clp}
import com.nilshomer.bfx.examples.cmdline.BfxExamplesTool
@clp(
description = "Prints your name to standard out and exits.",
group = ClpGroups.Utilities
)
@nh13
nh13 / CountReadTypes.scala
Last active November 5, 2017 04:52
Tool to count the number of fragment and paired end reads
package com.nilshomer.bfx.examples.utilities
import com.fulcrumgenomics.bam.api.SamSource
import com.fulcrumgenomics.cmdline.ClpGroups
import com.fulcrumgenomics.sopt.{arg, clp}
import com.nilshomer.bfx.examples.cmdline.BfxExamplesTool
import com.fulcrumgenomics.commons.CommonsDef.{PathToBam, SafelyClosable}
import com.fulcrumgenomics.util.Io
@clp(
@nh13
nh13 / RegenerateNmUqMdTags.scala
Last active November 5, 2017 05:38
A tool to regenerate the NM/UQ/MD tags on a SAM or BAM file
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.sopt.{arg, clp}
import com.fulcrumgenomics.util.Io
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}
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 / 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