Merge pull request #407 from broadinstitute/mc_dwn_exome
Qscript to Downsample and analyze an exome BAM
This commit is contained in:
commit
93d525b56c
|
|
@ -79,8 +79,23 @@ object QScriptUtils {
|
|||
if (sample.isEmpty)
|
||||
sample = r.getSample
|
||||
else if (sample != r.getSample)
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all distinct samples in the BAM file
|
||||
*
|
||||
* @param bam the bam file
|
||||
* @return a set with all distinct samples (in no particular order)
|
||||
*/
|
||||
def getSamplesFromBAM(bam: File) : Set[String] = {
|
||||
val reader = new SAMFileReader(bam)
|
||||
var samples: Set[String] = Set()
|
||||
for (rg <- reader.getFileHeader.getReadGroups) {
|
||||
samples += rg.getSample
|
||||
}
|
||||
samples
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue