Skip to content

Commit

Permalink
Initial basic slicing function
Browse files Browse the repository at this point in the history
  • Loading branch information
AssafSternberg committed Jan 29, 2024
1 parent bcc7713 commit 64f540c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modo/cram.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ def slice(cram_path: AlignmentFile, coords: str) -> AlignmentFile:
>>> slice("data/ex1/demo1.cram", "chr1:100-200")
"""
# https://htsget.readthedocs.io/en/stable/index.html
...

# split up coordinate string "chr:start-end" into its three elements
coords = coords.replace("-", ":")
loc, start, stop = coords.split(":")
start = int(start)
stop = int(stop)

cramfile = AlignmentFile(cram_path,"rc")
iter = cramfile.fetch(loc, start, stop)
for x in iter:
print(str(x))




def extract_metadata(AlignmentHeader) -> Graph:
Expand Down

0 comments on commit 64f540c

Please sign in to comment.