singlecellmultiomics.utils package¶
Submodules¶
singlecellmultiomics.utils.binning module¶
-
singlecellmultiomics.utils.binning.coordinate_to_bins(point, bin_size, sliding_increment)[source]¶ Convert a single value to a list of overlapping bins
Parameters: - point (int) – coordinate to look up
- bin_size (int) – bin size
- sliding_increment (int) – sliding window offset, this is the increment between bins
Returns: list
Return type: [(bin_start,bin_end), . ]
-
singlecellmultiomics.utils.binning.coordinate_to_sliding_bin_locations(dp, bin_size, sliding_increment)[source]¶ Convert a single value to a list of overlapping bins
Parameters: - point (int) – coordinate to look up
- bin_size (int) – bin size
- sliding_increment (int) – sliding window offset, this is the increment between bins
Returns: - start (int) – the start coordinate of the first overlapping bin
- end (int) – the end of the last overlapping bin
- start_id (int) – the index of the first overlapping bin
- end_id (int) – the index of the last overlapping bin
singlecellmultiomics.utils.blockzip module¶
-
class
singlecellmultiomics.utils.blockzip.BlockZip(path, mode='r')[source]¶ Bases:
object-
__getitem__(contig_position_strand)[source]¶ Obtain data at the supplied contig position and strand :param contig_position_strand: tuple of (
contig(str) postion(int) strand(bool))Returns: data stored for the genomic location, returns None when no data is available Return type: result (str)
-
write(contig, position, strand, data)[source]¶ Write information for location contig/postion/strand !! Write the contig data per contig, random mixing of contigs will result in a corrupted file :param contig: :type contig: str :param postion: :type postion: int :param strand: :type strand: bool :param data: :type data: str
-
singlecellmultiomics.utils.html module¶
-
singlecellmultiomics.utils.html.style_str(s, color='black', weight=300)[source]¶ Style the supplied string with HTML tags
Parameters: - s (str) – string to format
- color (str) – color to show the string in
- weight (int) – how thick the string will be displayed
Returns: html representation of the string
Return type: html(string)
singlecellmultiomics.utils.iteration module¶
singlecellmultiomics.utils.sequtils module¶
-
singlecellmultiomics.utils.sequtils.complement(seq)[source]¶ Obtain complement of seq
Returns: complement (str)
-
singlecellmultiomics.utils.sequtils.create_MD_tag(reference_seq, query_seq)[source]¶ Create MD tag :param reference_seq: reference sequence of alignment :type reference_seq: str :param query_seq: query bases of alignment :type query_seq: str
Returns: md description of the alignment Return type: md_tag(str)
-
singlecellmultiomics.utils.sequtils.get_contig_list_from_fasta(fasta_path)[source]¶ - Obtain list of contigs froma fasta file,
- all alternative contigs are pooled into the string MISC_ALT_CONTIGS_SCMO
Returns: List of contigs + [‘MISC_ALT_CONTIGS_SCMO’] if any alt contig is present in the fasta file Return type: contig_list (list)
-
singlecellmultiomics.utils.sequtils.is_main_chromosome(chrom)[source]¶ Returns True when the chromsome is a main chromsome, not an alternative or other
Parameters: chrom (str) – chromosome name Returns: True when the chromsome is a main chromsome Return type: is_main(bool)
-
singlecellmultiomics.utils.sequtils.phred_to_prob(phred)[source]¶ Convert a phred score (ASCII) or integer to a numeric probability :param phred: score to convert :type phred: str/int
Returns: probability(float)