Skip to content

Commit

Permalink
Add paired fastq argument to transformFragments.
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh committed Apr 29, 2021
1 parent 47494a6 commit 1aa2072
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ object TransformFragments extends BDGCommandCompanion {
}

class TransformFragmentsArgs extends Args4jBase with ADAMSaveAnyArgs with ParquetArgs with CramArgs {
@Argument(required = true, metaVar = "INPUT", usage = "The Fragment file to apply the transforms to", index = 0)
@Argument(required = true, metaVar = "INPUT", usage = "The fragment file to convert (e.g. .fq, .ifq, .fastq, .ifastq). If extension is not detected, Parquet is assumed.", index = 0)
var inputPath: String = null

@Argument(required = true, metaVar = "OUTPUT", usage = "Location to write the transformed fragments", index = 1)
@Argument(required = true, metaVar = "OUTPUT", usage = "Location to write ADAM fragment data. If extension is not detected, Parquet is assumed.", index = 1)
var outputPath: String = null

@Args4jOption(required = false, name = "-load_as_alignments", usage = "Treats the input data as alignments")
var loadAsAlignments: Boolean = false

@Args4jOption(required = false, name = "-paired_fastq", usage = "When converting two (paired) FASTQ files, pass the path to the second file here.")
var pairedFastqFile: String = null

@Args4jOption(required = false, name = "-save_as_alignments", usage = "Saves the output data as alignments")
var saveAsAlignments: Boolean = false

Expand Down Expand Up @@ -130,8 +133,9 @@ class TransformFragments(protected val args: TransformFragmentsArgs) extends BDG

args.configureCramFormat(sc)

val rdd = if (args.loadAsAlignments) {
sc.loadAlignments(args.inputPath)
val optPairedFastqFile = Option(args.pairedFastqFile)
val rdd = if (args.loadAsAlignments || optPairedFastqFile.isDefined) {
sc.loadAlignments(args.inputPath, optPathName2 = optPairedFastqFile)
.toFragments
} else {
sc.loadFragments(args.inputPath)
Expand Down

0 comments on commit 1aa2072

Please sign in to comment.