示例#1
0
def printSequences(novelteseqs,outfasta):
	fw=FastaWriter(outfasta,100)
	idset=set([])
	for n,s in novelteseqs.items():
		if n in idset:
			raise ValueError("Already present"+n)
		fw.write(n,s)
	fw.close()
示例#2
0
def printSequences(novelrefseqs, oldteseqs, novelteseqs, outfasta):
    fw = FastaWriter(outfasta, 60)
    idset = set([])
    for n, s in novelrefseqs.items():
        if n in idset:
            raise ValueError("Alreade present" + n)
        fw.write(n, s)

    for n, s in oldteseqs.items():
        if n in idset:
            raise ValueError("Alreade present" + n)
        fw.write(n, s)

    for n, s in novelteseqs.items():
        if n in idset:
            raise ValueError("Alreade present" + n)
        fw.write(n, s)
    fw.close()
示例#3
0
def printSequences(seq,outfasta):
	fw=FastaWriter(outfasta,60)
	for n,s in seq.items():
		fw.write(n,s)
	fw.close()
示例#4
0
def printSequences(seq, outfasta):
    fw = FastaWriter(outfasta, 60)
    for n, s in seq.items():
        fw.write(n, s)
    fw.close()
     crap,chasis=SequenceUtility.load_chasis(args.ref_fasta)
else:
     print "No chasis file found; Will use chasis from the population definition file"
     chasis=pgdr.get_chasis()
if chasis=="":
     raise Exception("No chasis was provided, neither in a fastq file nor in the population genome definition file")
print "Will proceed with chasis having a size of {0} nt".format(len(chasis))







counter=1
fw=FastaWriter(args.output,60)
print "Start writing population genome"
for tmp in tedeftuples:
     # translate into sequences
     seqtup=[(t[0],sc.getTESequence(t[1])) for t in tmp]
     seq_with_te=SeqInserter.insertSequences(chasis,seqtup)
     # TODO seqinserter must check if position is smaller than sequence length

     fw.write("hg"+str(counter),seq_with_te)
     counter+=1
print "Done; Wrote {0} genomes to file {1}".format(counter-1,args.output)
fw.close()