Ejemplo n.º 1
0
def Read_sequencing( path ):
	seq_files=[]
	if os.path.isdir(path):
		seq_files = glob(path+'*.zip')
	else: seq_files.append( path )

	DNAseq_objs={}
	for File in seq_files:
		try:
			fixBadZipfile( File )
			zf = zipfile.ZipFile(File, 'r')
			for f in zf.namelist():
				if '.seq' not in f: continue
				name,seq = read_assembly(zf.open(f,'r').readlines())
				name = name.split('.')[0]
				if 'Term' in f: seq = libDNA.reverse_complement(seq.lower())
				DNAseq_objs[name]= seq.lower().replace(' ','')					
		except: 
			print "Can not open "+File
			continue

	return DNAseq_objs
Ejemplo n.º 2
0
	return (name,seq.lower())

fixBadZipfile(opt.file_path)
zf = zipfile.ZipFile(opt.file_path, 'r')
files= zf.namelist()

out_name=opt.file_path.split("/")[-1].split('.')[0]

dna=open("./"+out_name+'_dna.fasta','w')
out=open("./"+out_name+'_aa.fasta','w')

print "./"+out_name+'_aa.fasta'
for f in files:
	if ".seq" not in f: continue
	name,seq=read_assembly(zf.open(f,'r').readlines())
	if 'Term' in f: seq= libDNA.reverse_complement(seq)
		
	if len(seq) < 20: continue	

	DnaSeqObj = libDNA.DNASeq(seq)
	rf, found = DnaSeqObj.auto_phase(opt.sub)

	if found:
		aaobj = libAA.AASeq( DnaSeqObj.translate().replace(' ','') )
		out.write(">"+name+ aaobj.seq +"\n\n")
	else:
		out.write(">"+name+ DnaSeqObj.translate().replace(' ','') +"\n\n")	
	dna.write(">"+name+DnaSeqObj.seq+"\n\n") 
		
	continue
	
Ejemplo n.º 3
0
	i,count = 0,0
	while i < len(nativeS):
		if nativeS[i] != s1[i]: count+=1
		i+=1
	return count
	


dna=libDNA.DNASeq( opt.seq, int(opt.phase) )

start_pos = dna.fetch_position( int(opt.cutsite) - 3 )
end_pos = dna.fetch_position( int(opt.cutsite) + 3 )

sub=dna.seq[start_pos:end_pos+3]
h=libDNA.DNASeq(sub)
nativeAA=libDNA.translate( h.trips )
print nativeAA 

slots=[]

for a in nativeAA.replace(' ',''): slots.append([])


for enzyme in ref.restriction.keys():
	cut_seq = ref.restriction[ enzyme ][0]	
	for ph in range(0,3):
		tmp=libDNA.DNASeq(dna.seq, int(opt.phase) ) 
		tmp.insert_restrict( enzyme, int(opt.cutsite), int(ph) )
		
		sub=tmp.seq[start_pos:end_pos+3]
		h=libDNA.DNASeq(sub)