Commit dfb33d60 by Eric Coissac

Path print of sequences on stdout

parent d57de302
......@@ -120,6 +120,13 @@ cdef bint is_junction(AsmbGraph graph,int node): # @Duplicated
or len(parents(graph,node)) != 1
)
cdef bint is_begining(AsmbGraph graph,int node): # @DuplicatedSignature
'''
Predicate testing if a node is a fork or the beginning of the assembly
'''
return len(parents(graph,node)) == 0
cdef tuple normalizePath(list path, bint *direction):
cdef int c = path[0]
cdef int r = -path[-1]
......@@ -217,6 +224,11 @@ cpdef dict buildstem(Assembler assembler,
'stemid' : 0,
'label' : None
}
if is_begining(assembler._graph,first):
s["head"]=assembler._index.getRead(first,
0,
assembler._index.getReadSize())
if circle:
getConfiguration()['orgasm']['logger'].info(" Circle : %6d bp coverage : %6dx" %
......
......@@ -7,6 +7,8 @@ from orgasm import getOutput,getIndex, getSeeds
from orgasm.tango import restoreGraph, genesincontig
import os
import sys
__title__="Build a fasta file from the assembling graph"
......@@ -40,7 +42,9 @@ def fastaFormat(edge, title=None, nchar=60):
seq = edge['sequence']
lseq = len(edge['sequence'])
if "head" in edge:
seq=edge['head'].lower() + seq
lseq = len(seq)
i=0
while i < lseq:
l.append(seq[i:i+60].decode('ascii'))
......@@ -68,9 +72,13 @@ def run(config):
logger.info("Print the result as a fasta file")
edges = [cg.getEdgeAttr(*i) for i in cg.edgeIterator(edgePredicate = lambda e : cg.getEdgeAttr(*e)['stemid']>0)]
head, tail = os.path.split(output)
head, tail = os.path.split(config['orgasm']['outputfilename'])
c=1
for e in edges:
print(fastaFormat(e, tail),file=fastaout)
print(fastaFormat(e, "%s_%d" % (tail,c)),
file=fastaout)
c+=1
......@@ -3,6 +3,9 @@ Created on 28 sept. 2014
@author: coissac
'''
import sys
from orgasm import getOutput,getIndex, getSeeds
from orgasm.tango import restoreGraph, estimateFragmentLength, genesincontig,\
scaffold, path2fasta
......@@ -74,19 +77,20 @@ def run(config):
scaffold(asm,cg,minlink=config['orgasm']['minlink'],
back=int(back),addConnectedLink=False)
fastaout = open(output+".fasta","w")
# fastaout = open(output+".fasta","w")
fastaout = sys.stdout
pathout = open(output+".path","w")
logger.info("Print the result as a fasta file")
c=1
seqid = config['orgasm']['outputfilename'].split('/')[-1]
path = config['path']['path']
logger.info('Built path : %s' % str(path))
fa = path2fasta(asm,cg,path,
identifier="Seq_%d" % c,
identifier="%s_%d" % (seqid,c),
back=back,
minlink=config['orgasm']['minlink'],
logger=logger)
......
......@@ -3,6 +3,7 @@ Created on 28 sept. 2014
@author: coissac
'''
import sys
from orgasm import getOutput,getIndex, getSeeds
from orgasm.tango import restoreGraph, estimateFragmentLength, genesincontig,\
pathConstraints, scaffold, selectGoodComponent, unfoldAssembling, path2fasta
......@@ -101,6 +102,8 @@ def run(config):
logger.info("Unfolding in circular mode")
c=1
seqid = config['orgasm']['outputfilename'].split('/')[-1]
for seeds in gcc:
path = unfoldAssembling(asm,cg,
seeds=seeds,
......@@ -111,7 +114,7 @@ def run(config):
path = path[-1][0]
fa = path2fasta(asm,cg,path,
identifier="Seq_%d" % c,
identifier="%s_%d" % (seqid,c),
back=back,
minlink=config['orgasm']['minlink'],
logger=logger)
......
......@@ -3,6 +3,8 @@ Created on 28 sept. 2014
@author: coissac
'''
import sys
from orgasm import getOutput,getIndex, getSeeds
from orgasm.tango import restoreGraph, estimateFragmentLength, genesincontig,\
scaffold, path2fasta, unfoldmarker
......@@ -97,11 +99,13 @@ def run(config):
logger.info("Print the result as a fasta file")
c=1
seqid = config['orgasm']['outputfilename'].split('/')[-1]
for seeds in gcc:
path = unfoldmarker(cg,seeds=seeds)
fa = path2fasta(asm,cg,path,
identifier="Seq_%d" % c,
identifier="%s_%d" % (seqid,c),
back=back,
minlink=config['orgasm']['minlink'],
logger=logger)
......
major = 0
minor = '2'
serial= '0'
serial= '01'
version = "%d.%s.%s" % (major,minor,serial)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment