dynast.preprocessing.consensus

Module Contents

Functions

call_consensus_from_reads(reads, header, quality=27, tags=None)

Call a single consensus alignment given a list of aligned reads.

call_consensus_from_reads_process(reads, header, tags, strand=None, quality=27)

consensus_worker(args_q, results_q, *args, **kwargs)

call_consensus(bam_path, out_path, gene_infos, strand='forward', umi_tag=None, barcode_tag=None, gene_tag='GX', barcodes=None, quality=27, add_RS_RI=False, temp_dir=None, n_threads=8)

Attributes

BASES

BASE_IDX

dynast.preprocessing.consensus.BASES = ['A', 'C', 'G', 'T']
dynast.preprocessing.consensus.BASE_IDX
dynast.preprocessing.consensus.call_consensus_from_reads(reads, header, quality=27, tags=None)

Call a single consensus alignment given a list of aligned reads.

Reads must map to the same contig. Results are undefined otherwise. Additionally, consensus bases are called only for positions that match to the reference (i.e. no insertions allowed).

This function only sets the minimal amount of attributes such that the alignment is valid. These include: * read name – SHA256 hash of the provided read names * read sequence and qualities * reference name and ID * reference start * mapping quality (MAPQ) * cigarstring * MD tag * NM tag * Not unmapped, paired, duplicate, qc fail, secondary, nor supplementary

The caller is expected to further populate the alignment with additional tags, flags, and name.

Parameters
  • reads (list) – List of reads to call a consensus sequence from

  • header (pysam.AlignmentHeader) – header to use when creating the new pysam alignment

  • quality (int, optional) – quality threshold, defaults to 27

  • tags (dict, optional) – additional tags to set, defaults to None

Returns

(New pysam alignment of the consensus sequence)

Return type

pysam.AlignedSegment

dynast.preprocessing.consensus.call_consensus_from_reads_process(reads, header, tags, strand=None, quality=27)
dynast.preprocessing.consensus.consensus_worker(args_q, results_q, *args, **kwargs)
dynast.preprocessing.consensus.call_consensus(bam_path, out_path, gene_infos, strand='forward', umi_tag=None, barcode_tag=None, gene_tag='GX', barcodes=None, quality=27, add_RS_RI=False, temp_dir=None, n_threads=8)