-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from hammerlab/refpos-reconcile
Build up reference information during cigar processing
- Loading branch information
Showing
8 changed files
with
237 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
adam-core/src/main/scala/org/bdgenomics/adam/rich/ReferenceSequenceContext.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2014. Mount Sinai School of Medicine | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.bdgenomics.adam.rich | ||
|
||
import org.bdgenomics.adam.models.ReferencePosition | ||
import net.sf.samtools.CigarElement | ||
|
||
/** | ||
* Represents information on the reference relative to a particular residue | ||
*/ | ||
|
||
private[rich] case class ReferenceSequenceContext(pos: Option[ReferencePosition], referenceBase: Option[Char], cigarElement: CigarElement, cigarElementOffset: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
adam-core/src/test/scala/org/bdgenomics/adam/rich/DecadentReadSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2014. Mount Sinai School of Medicine | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.bdgenomics.adam.rich | ||
|
||
import org.scalatest.FunSuite | ||
import org.bdgenomics.adam.avro.{ ADAMContig, ADAMRecord } | ||
import org.bdgenomics.adam.models.ReferencePosition | ||
|
||
class DecadentReadSuite extends FunSuite { | ||
|
||
test("reference position of decadent read") { | ||
val contig = ADAMContig.newBuilder | ||
.setContigName("chr1") | ||
.build | ||
|
||
val hardClippedRead = RichADAMRecord(ADAMRecord | ||
.newBuilder() | ||
.setReadMapped(true) | ||
.setStart(1000) | ||
.setContig(contig) | ||
.setMismatchingPositions("10") | ||
.setSequence("AACCTTGGC") | ||
.setQual("FFFFFFFFF") | ||
.setCigar("9M1H").build()) | ||
|
||
val record = DecadentRead(hardClippedRead) | ||
assert(record.residues.size === 9) | ||
|
||
val residueSeq = record.residues | ||
assert(residueSeq.head.referencePosition === ReferencePosition("chr1", 1000)) | ||
} | ||
|
||
test("reference position of decadent read with insertions") { | ||
val contig = ADAMContig.newBuilder | ||
.setContigName("chr1") | ||
.build | ||
|
||
val hardClippedRead = RichADAMRecord(ADAMRecord | ||
.newBuilder() | ||
.setReadMapped(true) | ||
.setStart(1000) | ||
.setContig(contig) | ||
.setMismatchingPositions("1TT10") | ||
.setSequence("ATTGGGGGGGGGG") | ||
.setQual("FFFFFFFFFFFFF") | ||
.setCigar("1M2I10M").build()) | ||
|
||
val record = DecadentRead(hardClippedRead) | ||
assert(record.residues.size === 13) | ||
|
||
val residueSeq = record.residues | ||
assert(residueSeq.head.referencePosition === ReferencePosition("chr1", 1000)) | ||
} | ||
|
||
} |
Oops, something went wrong.