Example #1
0
#!/usr/bin/python

import argparse
parser=argparse.ArgumentParser(description='Convert a sequence-based fasta file into a .cmap physical map format by locating (restriction endonuclease) sequence motifs')
parser.add_argument('fasta_file', help='The sequence .fasta file to be converted')
parser.add_argument('motif', help='The sequence motif to locate, e.g. ATCGGCTA. Case does not matter.')
parser.add_argument('cmap_file', help='Name for output .cmap file')
args=parser.parse_args()

from Operations.BioNano.FileConverter import FileConverter
from Operations.BioNano.FileConverter import FastaFile
from Operations.BioNano.FileConverter import Digestor
from Operations.BioNano.files import CmapFile
from Bio import SeqIO

conv=FileConverter(FastaFile(args.fasta_file))
conv.digestor=Digestor(args.motif)
with open(args.cmap_file, 'w'):
	pass
conv.output_file=(CmapFile(args.cmap_file))
conv.convert()
Example #2
0
work_dir="/path/to/work/dir" ### SET ME
input_file="input.bnx" ### SET ME
workspace=Workspace(work_dir, input_file)

ref_file="reference.cmap" ### SET ME

false_positive=0.5 ### SET ME
false_negative=0.15 ### SET ME
genome_size_mb=900 ### SET ME
p_val=1e-05/genome_size_mb
min_len=100 ### SET ME
min_sites=6 ### SET ME

vital_parameters=VitalParameters(false_positive, false_negative, p_val, min_len, min_sites)
merge=Merge(workspace, vital_parameters)

alignment=ReferenceAlignment(workspace, merge, ref_file)

with CD(work_dir):
	len_file_path=alignment.anchor.getStepDir()+"/"+alignment.output_prefix+".len"
	with open(len_file_path,'w'):
	len_file_converter=FileConverter(CmapFile(alignment.anchor.getOutputFile()), LenFile(len_file_path))
	len_file_converter.convert()

        bed_file_path=alignment.getStepDir()+"/"+alignment.output_prefix+".bed"
	with open(bed_file_path,'w'):
		pass
	bed_file_converter=FileConverter(XmapFile(alignment.getOutputFile()), BedFile(bed_file_path))
	bed_file_converter.convert()
Example #3
0
#!/usr/bin/python

import argparse
parser=argparse.ArgumentParser(description='Convert a .xmap alignment file into a .sam (Sequence Alignment/Map Format) file.')
parser.add_argument('xmap_file', help='.xmap file to be converted')
args=parser.parse_args()

from Operations.BioNano.FileConverter import FileConverter
from Operations.BioNano.FileConverter import SamFile
from Operations.BioNano.files import XmapFile

xmap_path=args.xmap_file
xmap=XmapFile(xmap_path)
sam_path=xmap_path.replace('.xmap', '.sam')
with open(sam_path, 'w'):
	sam=SamFile(sam_path)

fc=FileConverter(xmap, sam)
fc.convert()