Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up fields and doc in fragment. #2054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private[adam] class FastqRecordConverter extends Serializable with Logging {

// build and return record
Fragment.newBuilder
.setReadName(firstReadName)
.setName(firstReadName)
.setAlignments(alignments)
.build
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ private[adam] case class SingleReadBucket(

// start building fragment
val builder = Fragment.newBuilder()
.setReadName(unionReads.head.getReadName)
.setName(unionReads.head.getReadName)
.setAlignments(seqAsJavaList(allReads.toSeq))

// is an insert size defined for this fragment?
primaryMapped.headOption
.foreach(r => {
Option(r.getInferredInsertSize).foreach(is => {
builder.setFragmentSize(is.toInt)
builder.setInsertSize(is.toInt)
})
})

// set record group name, if known
Option(unionReads.head.getRecordGroupName)
.foreach(n => builder.setRunId(n))
.foreach(n => builder.setRecordGroupName(n))

builder.build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class AlignmentRecordConverterSuite extends FunSuite {
.build())

val fragment = Fragment.newBuilder()
.setReadName("testRead")
.setName("testRead")
.setAlignments(seqAsJavaList(alignments))
.build()

Expand Down Expand Up @@ -307,7 +307,7 @@ class AlignmentRecordConverterSuite extends FunSuite {
.setQual("?????*****")
.build())
val fragment = Fragment.newBuilder()
.setReadName("testRead")
.setName("testRead")
.setAlignments(seqAsJavaList(alignments))
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class FastqRecordConverterSuite extends FunSuite with PrivateMethodTester {
test("testing FastqRecordConverter.convertFragment with valid input") {
val input = (null, new Text("@read\nATCGA\n+\nabcde\n@read\nTCGAT\n+\n12345"))
val fragment = converter.convertFragment(input)
assert(fragment.getReadName == "read")
assert(fragment.getName == "read")

// more detailed testing
val align1 = fragment.getAlignments.get(0)
Expand All @@ -151,7 +151,7 @@ class FastqRecordConverterSuite extends FunSuite with PrivateMethodTester {
test("testing FastqRecordConverter.convertFragment with another valid input having /1, /2 suffixes") {
val input = (null, new Text("@read/1\nATCGA\n+\nabcde\n@read/2\nTCGAT\n+\n12345"))
val fragment = converter.convertFragment(input)
assert(fragment.getReadName == "read")
assert(fragment.getName == "read")

// more detailed testing
val align1 = fragment.getAlignments.get(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ object NucleotideContigFragmentRDDSuite extends Serializable {

def fragFn(ncf: NucleotideContigFragment): Fragment = {
Fragment.newBuilder
.setReadName(ncf.getContigName)
.setName(ncf.getContigName)
.build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object CoverageRDDSuite extends Serializable {

def fragFn(cov: Coverage): Fragment = {
Fragment.newBuilder
.setReadName(cov.contigName)
.setName(cov.contigName)
.build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object FeatureRDDSuite extends Serializable {

def fragFn(f: Feature): Fragment = {
Fragment.newBuilder
.setReadName(f.getContigName)
.setName(f.getContigName)
.build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ object AlignmentRecordRDDSuite extends Serializable {

def fragFn(r: AlignmentRecord): Fragment = {
Fragment.newBuilder
.setReadName(r.getReadName)
.setName(r.getReadName)
.build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ class BinQualitiesSuite extends ADAMFunSuite {
testQuals(newRead.getQual)

val fragment = Fragment.newBuilder
.setReadName("testFragment")
.setName("testFragment")
.setAlignments(List(read))
.build

val newFragment = BinQualities.binFragment(fragment, bins)

assert(newFragment.getAlignments.size === 1)
assert(newFragment.getReadName === "testFragment")
assert(newFragment.getName === "testFragment")

testQuals(newFragment.getAlignments.head.getQual)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SingleReadBucketSuite extends FunSuite {
val srb = SingleReadBucket(unmapped = reads)
val fragment = srb.toFragment
assert(fragment.getAlignments.size === 2)
assert(fragment.getReadName === "myRead")
assert(fragment.getName === "myRead")
}

test("convert proper pair to fragment") {
Expand Down Expand Up @@ -74,8 +74,8 @@ class SingleReadBucketSuite extends FunSuite {
.build())
val srb = SingleReadBucket(primaryMapped = reads)
val fragment = srb.toFragment
assert(fragment.getFragmentSize === 8)
assert(fragment.getReadName === "myRead")
assert(fragment.getInsertSize === 8)
assert(fragment.getName === "myRead")
assert(fragment.getAlignments.size === 2)
}

Expand Down Expand Up @@ -125,8 +125,8 @@ class SingleReadBucketSuite extends FunSuite {
.build())
val srb = SingleReadBucket(primaryMapped = reads, secondaryMapped = chimera)
val fragment = srb.toFragment
assert(fragment.getFragmentSize === null)
assert(fragment.getReadName === "myRead")
assert(fragment.getInsertSize === null)
assert(fragment.getName === "myRead")
assert(fragment.getAlignments.size === 3)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object GenotypeRDDSuite extends Serializable {

def fragFn(g: Genotype): Fragment = {
Fragment.newBuilder
.setReadName(g.getContigName)
.setName(g.getContigName)
.build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object VariantRDDSuite extends Serializable {

def fragFn(v: Variant): Fragment = {
Fragment.newBuilder
.setReadName(v.getContigName)
.setName(v.getContigName)
.build
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<hadoop.version>2.7.5</hadoop.version>
<hadoop-bam.version>7.9.2</hadoop-bam.version>
<slf4j.version>1.7.25</slf4j.version>
<bdg-formats.version>0.11.3</bdg-formats.version>
<bdg-formats.version>0.11.4</bdg-formats.version>
<bdg-utils.version>0.2.13</bdg-utils.version>
<htsjdk.version>2.16.1</htsjdk.version>
<scoverage.plugin.version>1.1.1</scoverage.plugin.version>
Expand Down