Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add /1 or /2 information back into read name if missing #1

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions subtract/calc-coverage-diff-2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ def main():

#print('XXX', chr, start, end)

# add /1 or /2 if read is paired and is read 1 or read 2
if read.is_paired:
if read.is_read1:
if '/1' not in read.qname:
read.qname += '/1'
elif read.is_read2:
if '/2' not in read.qname:
read.qname += '/2'
else:
raise ValueError(f"read {read.qname} is paired but not read 1 or read 2")
else:
if '/1' not in read.qname:
read.qname += '/1'

# for each position in query read, get coverage
sum_cov = []
for pos in range(start, end + 1):
Expand Down
14 changes: 14 additions & 0 deletions subtract/calc-coverage-diff-sam-bam.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ def main():
start = read.reference_start
end = read.reference_end

# add /1 or /2 if read is paired and is read 1 or read 2
if read.is_paired:
if read.is_read1:
if '/1' not in read.qname:
read.qname += '/1'
elif read.is_read2:
if '/2' not in read.qname:
read.qname += '/2'
else:
raise ValueError(f"read {read.qname} is paired but not read 1 or read 2")
else:
if '/1' not in read.qname:
read.qname += '/1'

# for each position in query read, get coverage
sum_cov = []
for i in range(start, end + 1):
Expand Down