File handling python
Hi!
I extracted mapped and unmapped reads of different BAM files using a bash script. Now, I want to compare which reads are in which BAM files in python.
I imagined to use python sets (union, intersection) to do that. Unfortunately, I have only little python experience. I already could write a script that does the job, but without using loops etc for automation.
I tried this:
import glob
path = "/path/to/files/*.txt"
list_of_files=glob.glob(path)
Now, I want to read in all lines of the files using readlines(), and store the output in separate variables to create sets using the .update() function. Do you have an idea how to do that?
Greetings
• 936 views
•
link
0 answers
No answers yet.
Log in to answer this question.
While your desire to learn python is commendable this may be a bit of a heavy lift to tackle as the first python coding challenge.
In this specific instance you may be able to use the solution @Pierre has in this thread: Find common reads between two bam files