Search in sources :

Example 1 with GeneFeatureCoverageCollector

use of com.milaboratory.mixcr.info.GeneFeatureCoverageCollector in project mixcr by milaboratory.

the class ActionAlignmentsStat method go.

@Override
public void go(ActionHelper helper) throws Exception {
    long[] geneFeatureCounters = new long[targetFeatures.length];
    AlignmentInfoCollector[] collectors = new AlignmentInfoCollector[targetFeatures.length + targetReferencePoints.length];
    int i = 0;
    for (GeneFeature targetFeature : targetFeatures) collectors[i++] = new GeneFeatureCoverageCollector(targetFeature);
    for (ReferencePoint targetReferencePoint : targetReferencePoints) collectors[i++] = new ReferencePointCoverageCollector(targetReferencePoint, 40, 40);
    final Collector collector = new Collector(collectors);
    try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(actionParameters.getInputFileName());
        PrintStream output = actionParameters.getOutputFileName().equals("-") ? System.out : new PrintStream(new BufferedOutputStream(new FileOutputStream(actionParameters.getOutputFileName()), 32768))) {
        SmartProgressReporter.startProgressReport("Analysis", reader);
        CUtils.processAllInParallel(reader, collector, Math.min(4, Runtime.getRuntime().availableProcessors()));
        collector.end();
        if (output == System.out)
            output.println();
        collector.write(output);
    }
}
Also used : GeneFeature(io.repseq.core.GeneFeature) PrintStream(java.io.PrintStream) ReferencePointCoverageCollector(com.milaboratory.mixcr.info.ReferencePointCoverageCollector) AlignmentInfoCollector(com.milaboratory.mixcr.info.AlignmentInfoCollector) VDJCAlignmentsReader(com.milaboratory.mixcr.basictypes.VDJCAlignmentsReader) ReferencePoint(io.repseq.core.ReferencePoint) GeneFeatureCoverageCollector(com.milaboratory.mixcr.info.GeneFeatureCoverageCollector) ReferencePoint(io.repseq.core.ReferencePoint) FileOutputStream(java.io.FileOutputStream) AlignmentInfoCollector(com.milaboratory.mixcr.info.AlignmentInfoCollector) ReferencePointCoverageCollector(com.milaboratory.mixcr.info.ReferencePointCoverageCollector) GeneFeatureCoverageCollector(com.milaboratory.mixcr.info.GeneFeatureCoverageCollector) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

VDJCAlignmentsReader (com.milaboratory.mixcr.basictypes.VDJCAlignmentsReader)1 AlignmentInfoCollector (com.milaboratory.mixcr.info.AlignmentInfoCollector)1 GeneFeatureCoverageCollector (com.milaboratory.mixcr.info.GeneFeatureCoverageCollector)1 ReferencePointCoverageCollector (com.milaboratory.mixcr.info.ReferencePointCoverageCollector)1 GeneFeature (io.repseq.core.GeneFeature)1 ReferencePoint (io.repseq.core.ReferencePoint)1 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 PrintStream (java.io.PrintStream)1