コード例 #1
0
from __future__ import division
from __future__ import print_function
from builtins import range
from past.utils import old_div
from hirise_assembly import HiriseAssembly

if __name__=="__main__":
     import sys
     import argparse

     parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     parser.add_argument('-d','--debug',default=False  ,action="store_true",help="Turn on debugging ouput")
     parser.add_argument('-L','--layout',default=False ,help="A file containing a layout of contigs.")
     parser.add_argument('-i','--infile',default=False ,help="Filename for serialised assembly input file.")
     parser.add_argument('-o','--outfile',default=False,help="Filename for writing a list of segments on the raw contigs to mask for being promiscuous in linking.")

     args = parser.parse_args()

     if args.infile:
          asf = HiriseAssembly()
          asf.load_assembly(args.infile)
     
     if args.outfile:
          f=open(args.outfile,"wt")
          for contig in asf.contigs_iter():
               f.write("{}\t{}\n".format(contig,asf.contig_length(contig)))



コード例 #2
0
     if args.infile:
          asf = HiriseAssembly()
          asf.load_assembly(args.infile)
     
     for segments_file in args.mask:
         asf.add_mask_regions(filename=segments_file)
         asf.merge_masked_regions()

     
     if args.contig:
          contig_iter=iter([args.contig])
     else:
          contig_iter = asf.ocontigs_iter()

     if args.outfile:
          of=open(args.outfile,"wt")
     else:
          of=sys.stdout
     for ocontig in contig_iter:
          chunk = struct.unpack("<L", hashlib.md5(ocontig.encode("utf-8")).digest()[:4])[0]%args.nchunks
          if (not args.contig) and (not chunk == args.chunk): continue
          links={}
          asf.get_links([ocontig],skipI=True,mapq=args.mapq,links=links,contigs=False,raw=False,debug=args.debug)
          for c1,c2 in links.keys():
               l1,l2=asf.contig_length(c1),asf.contig_length(c2)
               l=links[c1,c2]
               n=len(l)
               of.write("\t".join(map(str,[c1,c2,l1,l2,n,l]))+"\n")
     of.close()