Skip to content

Commit

Permalink
GenomicRDD.scala - removed commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdna committed Mar 9, 2018
1 parent a6f2f68 commit aee7c32
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions adam-core/src/main/scala/org/bdgenomics/adam/rdd/GenomicRDD.scala
Expand Up @@ -2212,39 +2212,21 @@ trait DatasetBoundGenomicDataset[T, U <: Product, V <: GenomicDataset[T, U, V]]

private def referenceRegionsToDatasetQueryString(regions: Iterable[ReferenceRegion]): String = {

val old = if (Try(dataset("positionBin")).isSuccess) {
regions.map(r => "(contigName=" + "\'" + r.referenceName +
"\' and positionBin >= \'" + ((scala.math.floor(r.start / optPartitionBinSize.get).toInt).toInt - optLookbackPartitions.get) +
"\' and positionBin < \'" + (scala.math.floor(r.end / optPartitionBinSize.get).toInt + 1) +
"\' and (end > " + r.start + " and start < " + r.end + "))")
.mkString(" or ")
} else { // if no positionBin field is found then construct query without bin optimization
regions.map(r => "(contigName=" + "\'" + r.referenceName +
"\' and (end > " + r.start + " and start < " + r.end + "))")
.mkString(" or ")
}
println("this was the old queyr stirng: " + old)

//test if this dataset is bound to Partitioned Parquet having field positionBin
val x = if (Try(dataset("positionBin")).isSuccess) {
if (Try(dataset("positionBin")).isSuccess) {
regions.map(r =>
s"(contigName=\'${r.referenceName}\' and positionBin >= " +
s"(contigName=\'${r.referenceName}\' and positionBin >= " +
s"\'${(scala.math.floor(r.start / optPartitionBinSize.get).toInt) - optLookbackPartitions.get}\'" +
s" and positionBin < \'${(scala.math.floor(r.end / optPartitionBinSize.get).toInt + 1)}\'" +
s" and (end > ${r.start} and start < ${r.end}))"
).mkString(" or ")
} else { // if no positionBin field is found then construct query without bin optimization
regions.map(r =>
s"(contigName=\'${r.referenceName} \' " +
s"(contigName=\'${r.referenceName} \' " +
s"and (end > ${r.start} and end < ${r.end}))")
.mkString(" or ")
}

println("This is the query String: " + x)
x

}

override def filterByOverlappingRegions(querys: Iterable[ReferenceRegion]): V = {
if (isPartitioned) {
transformDataset((d: Dataset[U]) =>
Expand Down

0 comments on commit aee7c32

Please sign in to comment.