Entering edit mode
7.4 years ago
shahbazmunir11
▴
10
Hi, I am using htsjdk library and want to print the header of bam file. I tried but the following code just prints the first header line again and again. I want all header lines. Any suggestions?? Thanks for your time and consideration.
File bamFile =new File("SampleFile.bam");
SamReader sr =
SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(bamFile);
SAMRecordIterator r = sr.iterator();
while(r.hasNext()) {
SAMRecord rec=r.next();
System.out.println(rec.getHeader());
}
r.close();
sr.close();
Thanks... it worked