use of com.milaboratory.util.NSequenceWithQualityPrintHelper in project mixcr by milaboratory.
the class ActionExportAlignmentsPretty method outputVerbose.
public void outputVerbose(PrintStream output, final VDJCAlignments alignments) {
output.println(">>> Read ids: " + Arrays.toString(alignments.getReadIds()).replace("[", "").replace("]", ""));
output.println();
output.println(">>> Target sequences (input sequences):");
output.println();
for (int i = 0; i < alignments.numberOfTargets(); i++) {
output.println("Sequence" + i + ":");
final VDJCPartitionedSequence partitionedTarget = alignments.getPartitionedTarget(i);
printGeneFeatures(new Filter<GeneFeature>() {
@Override
public boolean accept(GeneFeature object) {
return partitionedTarget.getPartitioning().isAvailable(object);
}
}, output, "Contains features: ");
output.println();
output.print(new NSequenceWithQualityPrintHelper(alignments.getTarget(i), LINE_OFFSET, LINE_LENGTH));
}
if (alignments.numberOfTargets() > 1) {
// Printing a set of available gene features for a full read
output.println(">>> Gene features that can be extracted from this paired-read: ");
printGeneFeatures(new Filter<GeneFeature>() {
@Override
public boolean accept(GeneFeature object) {
return alignments.getFeature(object) != null;
}
}, output, "");
}
output.println();
for (GeneType geneType : GeneType.values()) {
output.println(">>> Alignments with " + geneType.getLetter() + " gene:");
output.println();
boolean exists = false;
VDJCHit[] hits = alignments.getHits(geneType);
if (hits.length > 0) {
hits = actionParameters.isOnlyTop() ? new VDJCHit[] { hits[0] } : hits;
for (VDJCHit hit : hits) {
exists = true;
output.println(hit.getGene().getName() + " (total score = " + hit.getScore() + ")");
for (int i = 0; i < alignments.numberOfTargets(); i++) {
Alignment<NucleotideSequence> alignment = hit.getAlignment(i);
if (alignment == null)
continue;
output.println("Alignment of Sequence" + i + " (score = " + (alignment == null ? "NaN" : alignment.getScore()) + "):");
if (alignment != null) {
for (AlignmentHelper subHelper : alignment.getAlignmentHelper().split(LINE_LENGTH, LINE_OFFSET)) {
output.println(subHelper.toStringWithSeq2Quality(alignments.getTarget(i).getQuality()));
output.println();
}
if (actionParameters.printGeneSequence()) {
output.println("Gene sequence:");
output.println(alignment.getSequence1());
output.println();
}
}
}
}
}
if (!exists) {
output.println("No hits.");
output.println();
}
}
char[] ll = new char[94];
Arrays.fill(ll, '=');
output.println(ll);
output.println();
}
Aggregations