<commit_before>package oneoffs.fromer

import org.broadinstitute.sting.queue.extensions.gatk._
import org.broadinstitute.sting.queue.QScript

import org.broadinstitute.sting.gatk.DownsampleType


class ReadDepthCNVanalysis extends QScript {
  qscript =>

  @Input(doc = "bam input, as .bam or as a list of files", shortName = "I", required = true)
  var bams: File = _

  @Argument(doc = "gatk jar file", shortName = "J", required = true)
  var gatkJarFile: File = _

  @Argument(shortName = "R", doc = "ref", required = true)
  var referenceFile: File = _

  @Argument(shortName = "L", doc = "Intervals", required = false)
  var intervals: String = _

  @Input(doc = "level of parallelism for BAM DoC.   By default is set to 0 [no scattering].", shortName = "scatter", required = false)
  var scatterCountInput = 0

  @Output(doc = "DoC file to output", shortName = "o", required = true)
  var outputDoC: File = _

  @Input(doc = "Maximum depth (before GATK down-sampling kicks in...)", shortName = "MAX_DEPTH", required = false)
  var MAX_DEPTH = 20000

  trait CommandLineGATKArgs extends CommandLineGATK {
    this.intervalsString = List(qscript.intervals)
    this.jarFile = qscript.gatkJarFile
    this.reference_sequence = qscript.referenceFile
    //this.memoryLimit = Some(3)
    this.logging_level = "INFO"
  }

  def script = {
    add(new DepthOfCoverage(bams, outputDoC))
  }

  class DepthOfCoverage(bam: File, docOutPath: File) extends org.broadinstitute.sting.queue.extensions.gatk.DepthOfCoverage with CommandLineGATKArgs {
    this.omitIntervalStatistics = false
    this.omitDepthOutputAtEachBase = true
    this.omitLocusTable = true

    this.minBaseQuality = Some(0)
    this.minMappingQuality = Some(0)

    this.out = docOutPath
    this.input_file :+= bam

    this.dcov = Some(MAX_DEPTH)
    this.downsampling_type = Some(DownsampleType.BY_SAMPLE)

    this.scatterCount = scatterCountInput

    override def dotString = "DOC: " + bam.getName<commit_msg>Updated script to properly bin DoC values so that down-sampling corresponds to range of DoC values obtainable<commit_after>package oneoffs.fromer

import org.broadinstitute.sting.queue.extensions.gatk._
import org.broadinstitute.sting.queue.QScript

import org.broadinstitute.sting.gatk.DownsampleType


class ReadDepthCNVanalysis extends QScript {
  qscript =>

  @Input(doc = "bam input, as .bam or as a list of files", shortName = "I", required = true)
  var bams: File = _

  @Argument(doc = "gatk jar file", shortName = "J", required = true)
  var gatkJarFile: File = _

  @Argument(shortName = "R", doc = "ref", required = true)
  var referenceFile: File = _

  @Argument(shortName = "L", doc = "Intervals", required = false)
  var intervals: String = _

  @Input(doc = "level of parallelism for BAM DoC.   By default is set to 0 [no scattering].", shortName = "scatter", required = false)
  var scatterCountInput = 0

  @Output(doc = "DoC file to output", shortName = "o", required = true)
  var outputDoC: File = _

  @Input(doc = "Maximum depth (before GATK down-sampling kicks in...)", shortName = "MAX_DEPTH", required = false)
  var MAX_DEPTH = 20000

  @Input(doc = "Number of read-depth bins", shortName = "NUM_BINS", required = false)
  var NUM_BINS = 200

  @Input(doc = "Starting value of read-depth bins", shortName = "START_BIN", required = false)
  var START_BIN = 1

  trait CommandLineGATKArgs extends CommandLineGATK {
    this.intervalsString = List(qscript.intervals)
    this.jarFile = qscript.gatkJarFile
    this.reference_sequence = qscript.referenceFile
    //this.memoryLimit = Some(3)
    this.logging_level = "INFO"
  }

  def script = {
    add(new DepthOfCoverage(bams, outputDoC))
  }

  class DepthOfCoverage(bam: File, docOutPath: File) extends org.broadinstitute.sting.queue.extensions.gatk.DepthOfCoverage with CommandLineGATKArgs {
    this.omitIntervalStatistics = false
    this.omitDepthOutputAtEachBase = true
    this.omitLocusTable = true

    this.minBaseQuality = Some(0)
    this.minMappingQuality = Some(0)

    this.out = docOutPath
    this.input_file :+= bam

    this.dcov = Some(MAX_DEPTH)
    this.downsampling_type = Some(DownsampleType.BY_SAMPLE)

    this.start = Some(START_BIN)
    this.stop = Some(MAX_DEPTH)
    this.nBins = Some(NUM_BINS)

    this.scatterCount = scatterCountInput

    override def dotString = "DOC: " + bam.getName
{'fraction_non_alphanumeric': 0.1048423937871174, 'fraction_numerical': 0.00548195523069895, 'mean_word_length': 3.9424379232505644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2977409', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1430, 'n_words': 370}