Skip to content

Instantly share code, notes, and snippets.

@nickloman
Created July 29, 2016 17:21
Show Gist options
  • Save nickloman/4f7df552e01a861fdcb8351890bfbe0e to your computer and use it in GitHub Desktop.
Save nickloman/4f7df552e01a861fdcb8351890bfbe0e to your computer and use it in GitHub Desktop.
in bwa/bwamem.c reduce chunk_size to a smaller value otherwise it will not return for ages:
o->chunk_size = 10000;
import subprocess
import select
p = subprocess.Popen(['bin/bwa/bwa', 'mem', 'ref/NC_018143.fna', '/dev/stdin'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for n in xrange(1, 1000):
p.stdin.write("""@D00200:279:C9JU8ANXX:1:1104:18072:2078 1:N:0:1
ATGCGATGCGCCCCTATCGACTCGAAATGGGCACGCGCTGGGCACCGCGCCGCAAGAGCCTGTACGAATATTGGG
+
BBBBAFFBGCFCEGGGGGGEGGGGGFFFGDFGGGGGGGBDBBGGGGGG>GGGG>B9FFGGGB9BDGBD=GEECGG
@D00200:279:C9JU8ANXX:1:1104:18161:2080 1:N:0:1
CCGCAAGGCGATGAGCCAGATCACCGGCGCACTCGTCGGCGTGGCGCTCGTGCTGTCGGCGGTGTTCGTGCCGGT
+
CCCCCEGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGDGGGGGGGGGGG>
""")
output = ''
while (select.select([p.stdout],[],[],0)[0]!=[]):
output += p.stdout.read(1)
if output:
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment