Skip to content

Instantly share code, notes, and snippets.

@marcelm
Created April 16, 2015 14:58
Show Gist options
  • Save marcelm/8406e8a48995b766051c to your computer and use it in GitHub Desktop.
Save marcelm/8406e8a48995b766051c to your computer and use it in GitHub Desktop.
hack to print out qualities in cutadapt’s info file (will crash when trimming FASTA files)
diff --git i/cutadapt/scripts/cutadapt.py w/cutadapt/scripts/cutadapt.py
index 855721d..2eaf435 100755
--- i/cutadapt/scripts/cutadapt.py
+++ w/cutadapt/scripts/cutadapt.py
@@ -155,6 +155,7 @@ class AdapterCutter(object):
# TODO write only one line, even for multiple matches
for match in matches:
seq = match.read.sequence
+ qualities = match.read.qualities
if match is None:
print(match.read.name, -1, seq, sep='\t', file=self.info_file)
else:
@@ -167,6 +168,9 @@ class AdapterCutter(object):
seq[match.rstart:match.rstop],
seq[match.rstop:],
match.adapter.name,
+ qualities[0:match.rstart],
+ qualities[match.rstart:match.rstop],
+ qualities[match.rstop:],
sep='\t', file=self.info_file
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment