Commit 86341e86 by Eric Coissac

Adds the logger to the scaffold call

parent 219a4b08
...@@ -6,12 +6,14 @@ Created on 28 sept. 2014 ...@@ -6,12 +6,14 @@ Created on 28 sept. 2014
import sys import sys
from orgasm import getOutput,getIndex, getSeeds from orgasm import getOutput,getIndex, getSeeds
from orgasm.tango import restoreGraph, estimateFragmentLength, genesincontig,\ from orgasm.tango import restoreGraph, estimateFragmentLength, genesincontig,\
pathConstraints, scaffold, selectGoodComponent, unfoldAssembling, path2fasta pathConstraints, scaffold, selectGoodComponent, unfoldAssembling, path2fasta,\
path2sam
__title__="Universal assembling graph unfolder" __title__="Universal assembling graph unfolder"
default_config = { 'circular' : False, default_config = { 'circular' : False,
'force' : False 'force' : False,
'format' : "fasta"
} }
def addOptions(parser): def addOptions(parser):
...@@ -29,6 +31,18 @@ def addOptions(parser): ...@@ -29,6 +31,18 @@ def addOptions(parser):
default=None, default=None,
help='Wish a circular unfolding') help='Wish a circular unfolding')
parser.add_argument('--sam', dest='unfold:format',
action='store_const',
const="sam",
default=None,
help='Produce a SAM file of the assembly')
parser.add_argument('--fasta', dest='unfold:format',
action='store_const',
const="fasta",
default=None,
help='Produce a FASTA file of the assembly [default format]')
parser.add_argument('--force', dest='unfold:force', parser.add_argument('--force', dest='unfold:force',
action='store_true', action='store_true',
default=None, default=None,
...@@ -90,7 +104,8 @@ def run(config): ...@@ -90,7 +104,8 @@ def run(config):
minlink=config['orgasm']['minlink'] minlink=config['orgasm']['minlink']
constraints = pathConstraints(asm,cg,back=int(back),minlink=minlink) constraints = pathConstraints(asm,cg,back=int(back),minlink=minlink)
scaffold(asm,cg,minlink=minlink, scaffold(asm,cg,minlink=minlink,
back=int(back),addConnectedLink=False) back=int(back),addConnectedLink=False,
logger=logger)
#fastaout = open(output+".fasta","w") #fastaout = open(output+".fasta","w")
...@@ -101,7 +116,7 @@ def run(config): ...@@ -101,7 +116,7 @@ def run(config):
logger.info("Select the good connected components") logger.info("Select the good connected components")
gcc = selectGoodComponent(cg) gcc = selectGoodComponent(cg)
logger.info("Print the result as a fasta file") logger.info("Print the result as a %s file" % config['unfold']['format'])
if config['unfold']['circular']: if config['unfold']['circular']:
if config['unfold']['force']: if config['unfold']['force']:
...@@ -120,13 +135,22 @@ def run(config): ...@@ -120,13 +135,22 @@ def run(config):
force=config['unfold']['force']) force=config['unfold']['force'])
path = path[-1][0] path = path[-1][0]
fa = path2fasta(asm,cg,path, if config['unfold']['format']=="fasta":
identifier="%s_%d" % (seqid,c), fa = path2fasta(asm,cg,path,
back=back, identifier="%s_%d" % (seqid,c),
minlink=config['orgasm']['minlink'], back=back,
logger=logger, minlink=config['orgasm']['minlink'],
tags=config['fasta']['tags']) logger=logger,
tags=config['fasta']['tags'])
if config['unfold']['format']=="sam":
fa = path2sam(asm,cg,path,
identifier="%s_%d" % (seqid,c),
back=back,
minlink=config['orgasm']['minlink'],
logger=logger,
tags=config['fasta']['tags'])
print(fa,file=fastaout) print(fa,file=fastaout)
print(" ".join([str(x) for x in path]),file=pathout) print(" ".join([str(x) for x in path]),file=pathout)
......
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