Skip to content

Commit

Permalink
missing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabadi committed Jul 6, 2018
1 parent feabc6d commit 90ae59b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/sctools/bam.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def key_generator(self) -> Callable[[pysam.AlignedSegment], Any]:


class QueryNameSortOrder(AlignmentSortOrder):
"""Alignment record sort order by query name."""
@staticmethod
def get_sort_key(alignment: pysam.AlignedSegment) -> str:
return alignment.query_name
Expand All @@ -461,6 +462,7 @@ def __repr__(self) -> str:


class CellMoleculeGeneQueryNameSortOrder(AlignmentSortOrder):
"""Hierarchical alignment record sort order (cell barcode >= molecule barcode >= gene name >= query name)."""
def __init__(
self,
cell_barcode_tag_key: str = consts.CELL_BARCODE_TAG_KEY,
Expand All @@ -473,15 +475,15 @@ def __init__(
self.molecule_barcode_tag_key = molecule_barcode_tag_key
self.gene_name_tag_key = gene_name_tag_key

def get_sort_key(self, alignment: pysam.AlignedSegment) -> Tuple[str, str, str, str]:
def _get_sort_key(self, alignment: pysam.AlignedSegment) -> Tuple[str, str, str, str]:
return (get_tag_or_default(alignment, self.cell_barcode_tag_key),
get_tag_or_default(alignment, self.molecule_barcode_tag_key),
get_tag_or_default(alignment, self.gene_name_tag_key),
alignment.query_name)

@property
def key_generator(self) -> Callable[[pysam.AlignedSegment], Tuple[str, str, str, str]]:
return self.get_sort_key
return self._get_sort_key

def __repr__(self) -> str:
return 'hierarchical__cell_molecule_gene_query_name'

0 comments on commit 90ae59b

Please sign in to comment.