Skip to content

Commit

Permalink
Clean up CLI operation categories and names, and add documentation fo…
Browse files Browse the repository at this point in the history
…r CLI.

* Removed CalculateDepth command.
* Clean up argument doc in TransformFeatures.
* Move OUTPUT to an option for Flagstat.
* Remove some output saving arguments in the View command that don't exactly
  make sense.
* Remove unused Vcf2ADAM/ADAM2Vcf -dict option and
  `org.bdgenomics.adam.cli.DictionaryCommand` trait.
* Remove WigFix2ADAM command.
* Move away from ParquetLoadSaveArgs.
* Move reads2coverage to actions.
* Reads2Coverage does not only write to Parquet, so clean up docs.
* Clean up fragments<->reads argument names.
  • Loading branch information
fnothaft authored and heuermh committed Nov 17, 2016
1 parent cd73a78 commit 8fef9a7
Show file tree
Hide file tree
Showing 25 changed files with 532 additions and 444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import org.bdgenomics.utils.cli._
import org.bdgenomics.utils.misc.Logging
import org.kohsuke.args4j.{ Argument, Option => Args4JOption }

class ADAM2FastaArgs extends ParquetLoadSaveArgs {
class ADAM2FastaArgs extends Args4jBase {
@Argument(required = true, metaVar = "ADAM", usage = "The Parquet file to convert", index = 0)
var inputPath: String = null
@Argument(required = true, metaVar = "FASTA", usage = "Location to write the FASTA to", index = 1)
var outputPath: String = null
@Args4JOption(required = false, name = "-coalesce", usage = "Choose the number of partitions to coalesce down to.")
var coalesce: Int = -1
@Args4JOption(required = false, name = "-force_shuffle_coalesce", usage = "Force shuffle while partitioning, default false.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import org.bdgenomics.formats.avro.AlignmentRecord
import org.bdgenomics.utils.cli._
import org.kohsuke.args4j.{ Argument, Option => Args4JOption }

class ADAM2FastqArgs extends ParquetLoadSaveArgs {
class ADAM2FastqArgs extends Args4jBase {
@Argument(required = true, metaVar = "INPUT", usage = "The read file to convert", index = 0)
var inputPath: String = null
@Argument(required = true, metaVar = "OUTPUT", usage = "Location to write the FASTQ to", index = 1)
var outputPath: String = null
@Argument(required = false, metaVar = "SECOND_OUTPUT", usage = "When writing FASTQ data, all second-in-pair reads will go here, if this argument is provided", index = 2)
var outputPath2: String = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ object ADAM2Vcf extends BDGCommandCompanion {
}

class ADAM2VcfArgs extends Args4jBase with ParquetArgs {
@Args4jOption(required = false, name = "-dict", usage = "Reference dictionary")
var dictionaryFile: File = _

@Argument(required = true, metaVar = "ADAM", usage = "The ADAM variant files to convert", index = 0)
var adamFile: String = _
Expand All @@ -64,17 +62,13 @@ class ADAM2VcfArgs extends Args4jBase with ParquetArgs {
var single: Boolean = false
}

class ADAM2Vcf(val args: ADAM2VcfArgs) extends BDGSparkCommand[ADAM2VcfArgs] with DictionaryCommand with Logging {
class ADAM2Vcf(val args: ADAM2VcfArgs) extends BDGSparkCommand[ADAM2VcfArgs] with Logging {
val companion = ADAM2Vcf

def run(sc: SparkContext) {
require(!(args.sort && args.sortLexicographically),
"Cannot set both -sort_on_save and -sort_lexicographically_on_save.")

var dictionary: Option[SequenceDictionary] = loadSequenceDictionary(args.dictionaryFile)
if (dictionary.isDefined)
log.info("Using contig translation")

val adamGTs = sc.loadParquetGenotypes(args.adamFile)

val coalesce = if (args.coalesce > 0) {
Expand Down
14 changes: 5 additions & 9 deletions adam-cli/src/main/scala/org/bdgenomics/adam/cli/ADAMMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ object ADAMMain {
CommandGroup(
"ADAM ACTIONS",
List(
CalculateDepth,
CountReadKmers,
CountContigKmers,
Transform,
ADAM2Fastq,
TransformFeatures,
Flatten,
MergeShards
MergeShards,
Reads2Coverage
)
),
CommandGroup(
Expand All @@ -49,20 +49,16 @@ object ADAMMain {
VcfAnnotation2ADAM,
Fasta2ADAM,
ADAM2Fasta,
TransformFeatures,
WigFix2Bed,
ADAM2Fastq,
Fragments2Reads,
Reads2Fragments,
Reads2Coverage
Reads2Fragments
)
),
CommandGroup(
"PRINT",
List(
PrintADAM,
FlagStat,
ListDict,
AlleleCount,
View
)
)
Expand Down
81 changes: 0 additions & 81 deletions adam-cli/src/main/scala/org/bdgenomics/adam/cli/AlleleCount.scala

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.bdgenomics.utils.misc.Logging
import org.kohsuke.args4j.{ Argument, Option => Args4jOption }

object CountContigKmers extends BDGCommandCompanion {
val commandName = "count_contig_kmers"
val commandName = "countContigKmers"
val commandDescription = "Counts the k-mers/q-mers from a read dataset."

def apply(cmdLine: Array[String]) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.bdgenomics.utils.misc.Logging
import org.kohsuke.args4j.{ Argument, Option => Args4jOption }

object CountReadKmers extends BDGCommandCompanion {
val commandName = "count_kmers"
val commandName = "countKmers"
val commandDescription = "Counts the k-mers/q-mers from a read dataset."

def apply(cmdLine: Array[String]) = {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ object FlagStat extends BDGCommandCompanion {
}
}

class FlagStatArgs extends Args4jBase with ParquetArgs {
class FlagStatArgs extends Args4jBase {
@Argument(required = true, metaVar = "INPUT", usage = "The ADAM data to return stats for", index = 0)
val inputPath: String = null
@Argument(required = false, metaVar = "OUTPUT", usage = "Optionally write the stats to this file.", index = 1)
@Args4jOption(required = false, name = "-o", usage = "Optionally write the stats to this file.")
val outputPath: String = null
@Args4jOption(required = false, name = "-stringency", usage = "Set the parsing stringency: SILENT, LENIENT, STRICT.")
val stringency: String = "SILENT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ object Fragments2Reads extends BDGCommandCompanion {
}

class Fragments2ReadsArgs extends Args4jBase with ADAMSaveAnyArgs with ParquetArgs {
@Argument(required = true, metaVar = "INPUT", usage = "The Fragment file to apply the transforms to", index = 0)
@Argument(required = true, metaVar = "FRAGMENTS", usage = "The Fragment file to apply the transforms to", index = 0)
var inputPath: String = null
@Argument(required = true, metaVar = "OUTPUT", usage = "Location to write the transformed data in ADAM/Parquet format", index = 1)
@Argument(required = true, metaVar = "READS", usage = "Location to write the transformed data as reads", index = 1)
var outputPath: String = null
@Args4jOption(required = false, name = "-single", usage = "Saves OUTPUT as single file")
var asSingleFile: Boolean = false
Expand Down
Loading

0 comments on commit 8fef9a7

Please sign in to comment.