示例#1
0
 def loadPecan(iFileHandle, renamer=firstWord):
     """
     Load pecan alignment data.
     """
     aln = Alignment()
     for h, s in FastaFile(iFileHandle):
         try:
             aln.add(renamer(h), s)
         except Exception, e:
             print e
示例#2
0
#!/usr/bin/env python
"""
testTextIndex.py

Author: Tony Papenfuss
Date: Thu May 29 11:44:36 EST 2008

"""

import os, sys
from fasta import FastaFile

filename = 'tumour_sample.fa'
f = FastaFile(filename, indexed=True, clobber=True, method='pickle')
示例#3
0
    end = int(tokens[7])
    strand = {'1': '+', '-1': '-'}[tokens[8]]
    
    try:
        for contig in contigData[chrom].find(start-500, end+500):
            annotated.add(contig.value[0])
    except:
        pass


print 'Parse toxprot alignments'
iFilename = '../toxprot/tblastn_toxprot_v_genome.txt'
for b in BlastFile(iFilename):
    chrom = b.subjectId.split(':')[0]
    try:
        for contig in contigData[chrom].find(b.sStart, b.sEnd):
            annotated.add(contig.value[0])
    except:
        pass


print "Write out what's left over"
writer = FastaFile('unannotated_contigs.fa', 'w')
for chrom in contigData:
    for contig in contigData[chrom].intervals:
        if not contig.value[0] in annotated and len(contig.value[4])>60:
            name,chrom,start,end,seq = contig.value
            writer('%s %s:%i-%i' % (name,chrom,start,end), seq)
writer.close()

    
示例#4
0
 def saveFasta(self, oFileHandle, **kw):
     writer = FastaFile(oFileHandle, 'w')
     for name in self.order:
         writer.write(name, self.seqDict[name])
     writer.close()
示例#5
0
Author: Tony Papenfuss
Date: Tue Mar 18 14:27:10 EST 2008

"""

import os, sys


def rule():
    print '-' * 80


from fasta import FastaFile

f = FastaFile('HSP100.fa')
rule()
print 'readOne'
print f.readOne()
print f.readOne()
rule()
print 'readAll'
print f.readAll()
rule()
print 'Mapping'
f.asMapping()
print f

rule()
rule()
示例#6
0
文件: test.py 项目: SiriusShiu/Mungo
Author: Tony Papenfuss
Date: Tue Mar 18 14:27:10 EST 2008

"""

import os, sys


def rule():
    print '-'*80


from fasta import FastaFile

f = FastaFile('HSP100.fa')
rule()
print 'readOne'
print f.readOne()
print f.readOne()
rule()
print 'readAll'
print f.readAll()
rule()
print 'Mapping'
f.asMapping()
print f

rule()
rule()
示例#7
0
#!/usr/bin/env python

"""
testTextIndex.py

Author: Tony Papenfuss
Date: Thu May 29 11:44:36 EST 2008

"""

import os, sys
from fasta import FastaFile


filename = 'tumour_sample.fa'
f = FastaFile(filename, indexed=True, clobber=False, method='db')
x = f[9000:9100]
示例#8
0
 def saveFasta(self, oFileHandle, **kw):
     writer = FastaFile(oFileHandle, 'w')
     for name in self.order:
         writer.write(name, self.seqDict[name])
     writer.close()
示例#9
0
#!/usr/bin/env python
"""
testTextIndex.py

Author: Tony Papenfuss
Date: Thu May 29 11:44:36 EST 2008

"""

import os, sys
from fasta import FastaFile

filename = '/Users/papenfuss/databases/devil/transcriptome/reads/combined.fa'
f = FastaFile(filename, indexed=True, clobber=True, method='text')