Qscript to Downsample and analyze an exome BAM
this script downsamples an exome BAM several times and makes a coverage distribution analysis (of bases that pass filters) as well as haplotype caller calls with a NA12878 Knowledge Base assessment with comparison against multi-sample calling with the UG. This script was used for the "downsampling the exome" presentation
This commit is contained in:
parent
9d932e8c60
commit
efbfdb64fe
|
|
@ -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