forked from bigdatagenomics/adam
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* For using with CRAM, artificial.fa relies on having it's FASTA index at a known location. This is hard to do with the `copyResource` function, so I just added a symlink. * Moved `org.bdgenomics.adam.rdd.FileMergerSuite` to it's correct location in the source tree.
- Loading branch information
Showing
9 changed files
with
112 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../adam-core/src/test/resources/artificial.fa |
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 @@ | ||
../../../../adam-core/src/test/resources/artificial.fa.fai |
79 changes: 79 additions & 0 deletions
79
adam-cli/src/test/scala/org/bdgenomics/adam/cli/MergeShardsSuite.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,79 @@ | ||
/** | ||
* Licensed to Big Data Genomics (BDG) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The BDG licenses this file | ||
* to you 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.cli | ||
|
||
import org.seqdoop.hadoop_bam.CRAMInputFormat | ||
import org.bdgenomics.adam.rdd.ADAMContext._ | ||
import org.bdgenomics.adam.util.ADAMFunSuite | ||
|
||
class MergeShardsSuite extends ADAMFunSuite { | ||
sparkTest("merge shards from unordered sam to unordered sam") { | ||
val inputPath = copyResource("unordered.sam") | ||
val actualPath = tmpFile("unordered.sam") | ||
val expectedPath = inputPath | ||
Transform(Array("-single", "-defer_merging", inputPath, actualPath)).run(sc) | ||
MergeShards(Array(actualPath + "_tail", actualPath, | ||
"-header_path", actualPath + "_head")).run(sc) | ||
checkFiles(expectedPath, actualPath) | ||
} | ||
|
||
sparkTest("unordered sam to ordered sam") { | ||
val inputPath = copyResource("unordered.sam") | ||
val actualPath = tmpFile("ordered.sam") | ||
val expectedPath = copyResource("ordered.sam") | ||
Transform(Array("-single", | ||
"-sort_reads", | ||
"-sort_lexicographically", | ||
"-defer_merging", | ||
inputPath, actualPath)).run(sc) | ||
MergeShards(Array(actualPath + "_tail", actualPath, | ||
"-header_path", actualPath + "_head")).run(sc) | ||
checkFiles(expectedPath, actualPath) | ||
} | ||
|
||
sparkTest("merge sharded bam") { | ||
val inputPath = copyResource("unordered.sam") | ||
val actualPath = tmpFile("unordered.bam") | ||
Transform(Array("-single", | ||
"-defer_merging", | ||
inputPath, actualPath)).run(sc) | ||
MergeShards(Array(actualPath + "_tail", actualPath, | ||
"-header_path", actualPath + "_head", | ||
"-write_empty_GZIP_at_eof")).run(sc) | ||
assert(sc.loadAlignments(actualPath).rdd.count === 8L) | ||
} | ||
|
||
sparkTest("merge sharded cram") { | ||
val inputPath = copyResource("artificial.cram") | ||
val referencePath = resourceUrl("artificial.fa").toString | ||
sc.hadoopConfiguration.set(CRAMInputFormat.REFERENCE_SOURCE_PATH_PROPERTY, | ||
referencePath) | ||
println(referencePath) | ||
|
||
val actualPath = tmpFile("artificial.cram") | ||
Transform(Array("-single", | ||
"-sort_reads", | ||
"-sort_lexicographically", | ||
"-defer_merging", | ||
inputPath, actualPath)).run(sc) | ||
MergeShards(Array(actualPath + "_tail", actualPath, | ||
"-header_path", actualPath + "_head", | ||
"-write_cram_eof")).run(sc) | ||
assert(sc.loadAlignments(actualPath).rdd.count === 10L) | ||
} | ||
} |
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
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