Commit 4eff4dde authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Merge branch 'sander' into 'master'

Sander

for #54 and #40

See merge request !11
parents 6713b0c3 3513524a
......@@ -37,13 +37,18 @@ object FindRepeatsPacBio extends ToolCommand {
* @param args the command line arguments
*/
def main(args: Array[String]): Unit = {
val argsParser = new OptParser
val commandArgs: Args = argsParser.parse(args, Args()) getOrElse sys.exit(1)
val bamReader = new SAMFileReader(commandArgs.inputBam)
bamReader.setValidationStringency(SAMFileReader.ValidationStringency.SILENT)
val bamHeader = bamReader.getFileHeader
val header = List("chr", "startPos", "stopPos","Repeat_seq", "repeatLength",
"original_Repeat_readLength", "Calculated_repeat_readLength",
"minLength", "maxLength", "inserts", "deletions", "notSpan")
println(header.mkString("\t"))
for (bedLine <- Source.fromFile(commandArgs.inputBed).getLines;
val values = bedLine.split("\t"); if values.size >= 3) {
val interval = new SAMFileReader.QueryInterval(bamHeader.getSequenceIndex(values(0)), values(1).toInt, values(2).toInt)
......@@ -51,6 +56,9 @@ object FindRepeatsPacBio extends ToolCommand {
val results = for (samRecord <-bamIter) yield procesSamrecord(samRecord, interval)
val chr = values(0)
val startPos = values(1)
val stopPos = values(2)
val typeRepeat: String = if (values.size >= 15) values(14) else ""
val repeatLength = typeRepeat.length
val oriRepeatLength = values(2).toInt - values(1).toInt + 1
var calcRepeatLength: List[Int] = Nil
var minLength = -1
......@@ -71,7 +79,7 @@ object FindRepeatsPacBio extends ToolCommand {
if (length < minLength || minLength == -1) minLength = length
}
}
println(List(chr, startPos, oriRepeatLength, calcRepeatLength.mkString(","), minLength,
println(List(chr, startPos, stopPos, typeRepeat, repeatLength, oriRepeatLength, calcRepeatLength.mkString(","), minLength,
maxLength, inserts.mkString("/"), deletions.mkString("/"), notSpan).mkString("\t"))
bamIter.close
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment