Skip to content

Commit

Permalink
Added mapping class, get read orientation does not work for merged SA…
Browse files Browse the repository at this point in the history
…M files
  • Loading branch information
Boris Jurič committed Jun 16, 2023
1 parent 2a4b122 commit d975f8a
Show file tree
Hide file tree
Showing 4 changed files with 431 additions and 339 deletions.
20 changes: 8 additions & 12 deletions htsinfer/get_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
SeqIdFormats,
Config,
)
from htsinfer.get_read_orientation import (
GetOrientation,
)
from htsinfer.mapping import Mapping

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,15 +60,15 @@ class GetLibType:
def __init__(
self,
config: Config,
mapping: Mapping,
):
"""Class constructor."""
self.path_1: Path = config.args.path_1_processed
self.path_2: Optional[Path] = config.args.path_2_processed
self.library_source = config.results.library_source
self.results: ResultsType = ResultsType()
self.tmp_dir = config.args.tmp_dir
self.get_read_orientation: \
GetOrientation = GetOrientation(config=config)
self.mapping = mapping
self.max_distance = config.args.lib_type_max_distance
self.cutoff = config.args.lib_type_mates_cutoff

Expand Down Expand Up @@ -127,19 +125,17 @@ def _evaluate_mate_relationship(
StatesTypeRelationship.split_mates
)
else:
self.get_read_orientation.library_type.relationship \
self.mapping.library_type.relationship \
= StatesTypeRelationship.not_available
self.get_read_orientation.library_source = self.library_source
_ = self.get_read_orientation.evaluate()
self.mapping.library_source = self.library_source
_ = self.mapping.evaluate()
self._align_mates()

def _align_mates(self):
"""Decide mate relationship by alignment."""

alignment_1 = Path(self.tmp_dir) \
/ "alignments" / "file_1" / "Aligned.out.sam"
alignment_2 = Path(self.tmp_dir) \
/ "alignments" / "file_2" / "Aligned.out.sam"
alignment_1 = self.mapping.star_dirs[0] / 'Aligned.out.sam'
alignment_2 = self.mapping.star_dirs[1] / 'Aligned.out.sam'

samfile1 = pysam.AlignmentFile(alignment_1, 'r')
samfile2 = pysam.AlignmentFile(alignment_2, 'r')
Expand Down
Loading

0 comments on commit d975f8a

Please sign in to comment.