示例#1
0
    def __iter__(self):
        for i in self.saminfo:
            yield i, self.references[i.tid]


if __name__ == "__main__":
    optlist, args = getopt.getopt(sys.argv[1:], '')

    optlist = dict(optlist)

    if not args:
        logging.error("Insufficient parameters: {0} <ms.fa.msdesc>".format(
            sys.argv[0]))
        sys.exit(-1)

    bg = BaitDesc(open(sys.argv[1]))
    samfile = pysam.Samfile("-", "r")

    deal = Dealer(samfile)
    dbconn = GMOD.getDBConn()

    sampledone = set()

    counter = 0

    for i, ref in deal:

        qname = i.qname.split("@")
        sample = qname[0]
        if sample not in sampledone:
            sampledone.add(sample)
示例#2
0
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)

if __name__=="__main__":

	USAGE=''' Reads a .msdesc file (MS description file) and generates a FastA file containing
all the baits according to the specified parameters'''

	parser = argparse.ArgumentParser(usage=USAGE)
	parser.add_argument("-i", dest="input",help="Input MS description file. [.msdesc]",required=True)
	parser.add_argument("-b", dest="bottomlimit",help="Bottom limit (in bp) for the microsatellite length. [10]",default=10,type=int)
	parser.add_argument("-t", dest="toplimit",help="Top limit (in bp) for the microsatellite length. [35]",default=35,type=int)
	parser.add_argument("-o", dest="output",help="File output (FastaA file). If not specified [out-baits.fa] will be used",default="out-baits.fa")
	args = parser.parse_args()

	if args.bottomlimit>=args.toplimit: parser.error("Bottom limit cannot be higher than top limit.")

	fin=open(args.input)
	fout=open(args.output,"w")

	try:
		bd=BaitDesc(fin)
	except KeyboardInterrupt as e:
		print "Cancelling..."
		sys.exit(-1)

	bd.generatelist(args.bottomlimit,args.toplimit,fout)

	fin.close()
	fout.close()
	logging.info( " *** [ {0} ] *** WRITTEN!".format(args.output))
示例#3
0
        "-t",
        dest="toplimit",
        help="Top limit (in bp) for the microsatellite length. [35]",
        default=35,
        type=int)
    parser.add_argument(
        "-o",
        dest="output",
        help=
        "File output (FastaA file). If not specified [out-baits.fa] will be used",
        default="out-baits.fa")
    args = parser.parse_args()

    if args.bottomlimit >= args.toplimit:
        parser.error("Bottom limit cannot be higher than top limit.")

    fin = open(args.input)
    fout = open(args.output, "w")

    try:
        bd = BaitDesc(fin)
    except KeyboardInterrupt as e:
        print "Cancelling..."
        sys.exit(-1)

    bd.generatelist(args.bottomlimit, args.toplimit, fout)

    fin.close()
    fout.close()
    logging.info(" *** [ {0} ] *** WRITTEN!".format(args.output))
示例#4
0
		self.references=saminfo.references

	def __iter__(self):
		for i in self.saminfo:
			yield i,self.references[i.tid]

if __name__=="__main__":
	optlist, args = getopt.getopt(sys.argv[1:],'')

	optlist=dict(optlist)

	if not args:
		logging.error("Insufficient parameters: {0} <ms.fa.msdesc>".format(sys.argv[0]))
		sys.exit(-1)

	bg=BaitDesc(open(sys.argv[1]))
	samfile = pysam.Samfile("-", "r" )
	
	deal=Dealer(samfile)
	dbconn=GMOD.getDBConn()

	sampledone=set()

	counter=0
	
	for i,ref in deal:

		qname=i.qname.split("@")
		sample=qname[0]
		if sample not in sampledone:
			sampledone.add(sample)