This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to control BWA output?

Hi dears, i have a code like this in python:

strCommand = "./bwa index random_DNA_1000.fa"
os.system(strCommand)
strCommand = "./bwa mem random_DNA_1000.fa random_DNA_1000_8001.fq random_DNA_1000_8002.fq"
os.system(strCommand)

output of BWA MEM command contain some columns that i want filter output by "AS" column. Due to the large amount of data I can't work on the file and need to work with the stdout to speed up. Can anyone help me answer these questions? 1. How can I use BWA parameters so that the output contains only records whose field "AS" is less than one value? 2. How do I move the output of BWA to a list? (No file usage) Thanks in advance

bwa stdout python assembly alignment

Thanks for your attention. But due to the large amount of data I can't work on the file and need to work with the output of BWA directly from stdout. can i do?

thanks, I found a solution:

list = os.popen('./bwa mem ......').readlines()

That solved my problem, but now I just want to put a filter on the records. This means that from the record with the field "AS" less than 135, only the field that shows the "read" will be listed !

Due to the large amount of data I can't work on the file and need to work with the stdout to speed up.

Sooo you cannot save the file to disk but you can keep it entirely in memory without problems? That's cool.

Maybe I misunderstood. Since I want to work on BWA output, Working with disk will slow down. So i put the output to list.

Why would you do this in Python? As much as I love the language, you are not making your task easier here.

1 answer

this is useful:

list = os.popen('./bwa mem ......').readlines()

but now I just want to put a filter on the records. This means that from the record with the field "AS" less than 135, only the field that shows the "read" will be listed ! Can anyone help me?

Log in to answer this question.