SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with sorting sam files in python! mavadhani General 6 12-08-2016 10:14 AM
Python API for VCF files mspivakov Bioinformatics 7 04-08-2014 03:51 AM
What linux spreadsheet program can you open .sam files in? KnowNothing2 Bioinformatics 11 12-11-2013 02:13 AM
Blastn cannot open .nin files PlutonicFriend Bioinformatics 1 07-24-2012 12:37 PM
open *.sh files. dror Bioinformatics 1 11-14-2010 03:45 AM

Reply
 
Thread Tools
Old 03-14-2019, 05:35 AM   #1
deKoch13
Member
 
Location: HD

Join Date: Mar 2019
Posts: 12
Default Open and read files in 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
deKoch13 is offline   Reply With Quote
Old 03-25-2019, 08:20 AM   #2
luminasapientiae
Junior Member
 
Location: Brazil

Join Date: Sep 2017
Posts: 5
Default

Why you are using Python?
You can look for Biopython module. There is a function to import your seq and alignment.

The same can be made (with more options) in linux terminal w/ STAR algorithm.
luminasapientiae is offline   Reply With Quote
Reply

Tags
file handling, python

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 12:31 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO