How Do I Read A Maf File From File Into Pygr
2
1
Entering edit mode
12.0 years ago
KCC ★ 4.1k

I have looked through the manual and it seems to concentrate a lot on using data from an online database, but I could find anything about reading MAF files locally. I suspect it might involve the NLMSA class, but I'm not sure.

• 3.5k views
ADD COMMENT
1
Entering edit mode
12.0 years ago

I use bx-python for that: https://bitbucket.org/james_taylor/bx-python/wiki/Home

import bx.align.maf
for alignment in bx.align.maf.Reader(open("alignment.maf")):
    print alignment.split()

alignment.split() now is a neat list in the "line starting with s"-format (http://genome.ucsc.edu/FAQ/FAQformat.html#format5) where you can parse out all relevant info you might need.

ADD COMMENT
1
Entering edit mode

This turned out to be a good option. I will approve it.

ADD REPLY
0
Entering edit mode
12.0 years ago
Niek De Klein ★ 2.6k

There is a MAF parser in the pygr package: http://biodb.bioinformatics.ucla.edu/pygr_docs/0.8.1/html/epydoc/pygr.apps.maf2VSgraph.MafParser-class.html have you looked at that already?

ADD COMMENT
0
Entering edit mode

Yes. As far as I can tell, that's a helper function and not intended to be used directly.

ADD REPLY

Login before adding your answer.

Traffic: 1773 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6