Skip to content

Commit

Permalink
Respond to review
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed Apr 10, 2024
1 parent 47d0ee4 commit acc9276
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ object AggregateSvPileupToBedPE {
*
* Future compatibility could be implemented for supporting [10x flavored BEDPE files](https://github.com/igvteam/igv/wiki/BedPE-Support).
*
* Note that the field `score` is allowed to be a string per bedtools!
*
* @param chrom1 The reference sequence name for the first interval.
* @param start1 The 0-based position for the start of the first interval.
* @param end1 The 0-based half-open position for the end of the first interval.
Expand All @@ -63,7 +61,7 @@ object AggregateSvPileupToBedPE {
start2: Int,
end2: Int,
name: String,
score: String,
score: Int,
strand1: Strand,
strand2: Strand,
) extends Metric
Expand All @@ -81,36 +79,18 @@ object AggregateSvPileupToBedPE {
start2 = pileup.right_min_pos,
end2 = pileup.right_max_pos + 1,
name = pileup.id,
score = pileup.total.toString,
score = pileup.total,
strand1 = Strand.decode(pileup.left_strand),
strand2 = Strand.decode(pileup.right_strand),
)
}

/** A writer class for writing [[BedPE]] records. */
/** A writer class for writing [[BedPE]] records since BEDPE files do not by default have a header. */
class BedPEWriter(val out: BufferedWriter) extends Writer[BedPE] {

/** Write a [[BedPE]] record to the underlying writer. */
override def write(record: BedPE): Unit = {
out.write(record.chrom1)
out.write('\t')
out.write(Integer.toString(record.start1))
out.write('\t')
out.write(Integer.toString(record.end1))
out.write('\t')
out.write(record.chrom2)
out.write('\t')
out.write(Integer.toString(record.start2))
out.write('\t')
out.write(Integer.toString(record.end2))
out.write('\t')
out.write(record.name)
out.write('\t')
out.write(record.score)
out.write('\t')
out.write(record.strand1.toString)
out.write('\t')
out.write(record.strand2.toString)
out.write(record.values.mkString("\t"))
out.newLine()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AggregateSvPileupToBedPETest extends UnitSpec {
start2 = 200,
end2 = 201,
name = "112",
score = "2",
score = 2,
strand1 = Strand.POSITIVE,
strand2 = Strand.NEGATIVE,
)
Expand All @@ -58,7 +58,7 @@ class AggregateSvPileupToBedPETest extends UnitSpec {
start2 = 200,
end2 = 201,
name = "112",
score = "2",
score = 2,
strand1 = Strand.POSITIVE,
strand2 = Strand.NEGATIVE,
)
Expand All @@ -71,7 +71,7 @@ class AggregateSvPileupToBedPETest extends UnitSpec {
Integer.toString(record.start2),
Integer.toString(record.end2),
record.name,
record.score,
record.score.toString,
record.strand1.toString,
record.strand2.toString,
).toIndexedSeq
Expand All @@ -97,7 +97,7 @@ class AggregateSvPileupToBedPETest extends UnitSpec {
Integer.toString(test_bed_pe.start2),
Integer.toString(test_bed_pe.end2),
test_bed_pe.name,
test_bed_pe.score,
test_bed_pe.score.toString,
test_bed_pe.strand1.toString,
test_bed_pe.strand2.toString,
).toIndexedSeq
Expand Down

0 comments on commit acc9276

Please sign in to comment.