Now can read E2 or SQ tag.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2027 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
c3c001e02e
commit
3742a05760
|
|
@ -145,24 +145,43 @@ abstract public class BasicPileup implements Pileup {
|
||||||
|
|
||||||
public static ArrayList<Byte> secondaryBasePileup( List<SAMRecord> reads, List<Integer> offsets ) {
|
public static ArrayList<Byte> secondaryBasePileup( List<SAMRecord> reads, List<Integer> offsets ) {
|
||||||
ArrayList<Byte> bases2 = new ArrayList<Byte>(reads.size());
|
ArrayList<Byte> bases2 = new ArrayList<Byte>(reads.size());
|
||||||
boolean hasAtLeastOneSQField = false;
|
boolean hasAtLeastOneSQorE2Field = false;
|
||||||
|
|
||||||
for ( int i = 0; i < reads.size(); i++ ) {
|
for ( int i = 0; i < reads.size(); i++ ) {
|
||||||
SAMRecord read = reads.get(i);
|
SAMRecord read = reads.get(i);
|
||||||
int offset = offsets.get(i);
|
int offset = offsets.get(i);
|
||||||
|
|
||||||
|
if (read.getAttribute("SQ") != null) {
|
||||||
byte[] compressedQuals = (byte[]) read.getAttribute("SQ");
|
byte[] compressedQuals = (byte[]) read.getAttribute("SQ");
|
||||||
byte base2;
|
byte base2;
|
||||||
|
|
||||||
if (offset != -1 && compressedQuals != null && compressedQuals.length == read.getReadLength()) {
|
if (offset != -1 && compressedQuals != null && compressedQuals.length == read.getReadLength()) {
|
||||||
base2 = (byte) BaseUtils.baseIndexToSimpleBase(QualityUtils.compressedQualityToBaseIndex(compressedQuals[offset]));
|
base2 = (byte) BaseUtils.baseIndexToSimpleBase(QualityUtils.compressedQualityToBaseIndex(compressedQuals[offset]));
|
||||||
hasAtLeastOneSQField = true;
|
hasAtLeastOneSQorE2Field = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
base2 = (byte) '.';
|
base2 = (byte) '.';
|
||||||
}
|
}
|
||||||
|
bases2.add((byte) base2);
|
||||||
|
}
|
||||||
|
else if (read.getAttribute("E2") != null) {
|
||||||
|
String secondaries = (String) read.getAttribute("E2");
|
||||||
|
char base2;
|
||||||
|
if (offset != -1 && secondaries != null && secondaries.length() == read.getReadLength()) {
|
||||||
|
base2 = secondaries.charAt(offset);
|
||||||
|
hasAtLeastOneSQorE2Field = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base2 = '.';
|
||||||
|
}
|
||||||
|
bases2.add((byte) base2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
byte base2 = 'N';
|
||||||
bases2.add(base2);
|
bases2.add(base2);
|
||||||
}
|
}
|
||||||
return (hasAtLeastOneSQField ? bases2 : null);
|
}
|
||||||
|
return (hasAtLeastOneSQorE2Field ? bases2 : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String secondaryBasePileupAsString( List<SAMRecord> reads, List<Integer> offsets ) {
|
public static String secondaryBasePileupAsString( List<SAMRecord> reads, List<Integer> offsets ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue