Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
fd7e403b
Commit
fd7e403b
authored
10 years ago
by
bow
Browse files
Options
Downloads
Patches
Plain Diff
Filter on MAPQ instead of read groups
parent
037acc78
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
+7
-14
7 additions, 14 deletions
...scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
with
7 additions
and
14 deletions
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
+
7
−
14
View file @
fd7e403b
...
...
@@ -11,7 +11,6 @@ import scala.collection.JavaConverters._
import
htsjdk.samtools.SAMFileReader
import
htsjdk.samtools.QueryInterval
import
htsjdk.samtools.SAMRecord
import
htsjdk.samtools.fastq.
{
BasicFastqWriter
,
FastqReader
,
FastqRecord
}
import
htsjdk.tribble.Feature
import
htsjdk.tribble.BasicFeature
...
...
@@ -66,14 +65,14 @@ object ExtractAlignedFastq extends ToolCommand {
*
* @param iv iterable yielding features to check
* @param inAln input SAM/BAM file
* @param minMapQ minimum mapping quality of read to include
* @param commonSuffixLength length of suffix common to all read pairs
* @param readGroupIds read group IDs to include (default: all)
* @return
*/
def
makeMembershipFunction
(
iv
:
Itera
ble
[
Feature
],
def
makeMembershipFunction
(
iv
:
Itera
tor
[
Feature
],
inAln
:
File
,
commonSuffixLength
:
Int
=
0
,
readGroupIds
:
Set
[
String
]
=
Set
.
empty
[
String
]
minMapQ
:
Int
=
0
,
commonSuffixLength
:
Int
=
0
)
:
(
FastqPair
=>
Boolean
)
=
{
/** function to make interval queries for BAM files */
...
...
@@ -90,13 +89,7 @@ object ExtractAlignedFastq extends ToolCommand {
throw
new
IllegalStateException
(
"Unexpected feature: "
+
feat
.
toString
)
val
inAlnReader
=
new
SAMFileReader
(
inAln
)
/** filter function for read IDs */
val
rgFilter
=
if
(
readGroupIds
.
size
==
0
)
(
r
:
SAMRecord
)
=>
true
else
(
r
:
SAMRecord
)
=>
readGroupIds
.
contains
(
r
.
getReadGroup
.
getReadGroupId
)
require
(
inAlnReader
.
hasIndex
)
val
queries
:
Array
[
QueryInterval
]
=
iv
.
toList
// sort features
...
...
@@ -111,8 +104,8 @@ object ExtractAlignedFastq extends ToolCommand {
.
queryOverlapping
(
queries
)
// for Scala compatibility
.
asScala
// filter based on
read group IDs
.
filter
(
x
=>
rgFilter
(
x
)
)
// filter based on
mapping quality
.
filter
(
x
=>
x
.
getMappingQuality
>=
minMapQ
)
// iteratively add read name to the selected set
.
foldLeft
(
MSet
.
empty
[
String
])(
(
acc
,
x
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment