Exemplo n.º 1
0
	# Main args
	parser.add_argument("file", type=pathlib.Path,
	                    help="A genome file in .sam format")
	parser.add_argument("genome_length", type=int, help="The genome length")

	# Options
    parser.add_argument("--verbose", default=False, dest="verbose", action="store_true", help="Verbose output")

	# Get args
	args = parser.parse_args()

	input_file = args.file
	genome_length = args.genome_length
	verbose = args.verbose

	# Set loggin level
	logging.basicConfig(level=(logging.DEBUG if verbose else None))

	logging.debug(f"input_file = {input_file}")
	logging.debug(f"genome_length = {genome_length}")

	# Read mates
	mates = read_mates(input_file, keep_fields=["pos", "ma"])

	# Get multiple aligment track
	multiple_alignments = get_multiple_alignments(mates, genome_length)

	# Print track to wig file
	to_wig(multiple_alignments)
Exemplo n.º 2
0

if __name__ == "__main__":
    # Set verbose logging
    logging.basicConfig(level=logging.DEBUG)

    # Check args
    if len(sys.argv) != 1 + 2:
        print_usage(sys.argv)

    # Get args
    input_file = sys.argv[1]
    genome_length = int(sys.argv[2])

    logging.debug(f"input_file = {input_file}")
    logging.debug(f"genome_length = {genome_length}")

    # Read mates
    mates = read_mates(input_file,
                       keep_fields=["pos", "pnext", "tlen", "flag"])
    mates = filter_out_invalid_mates(mates)

    # Compute single mates percentage
    relative_orientations = get_relative_orientations(mates, genome_length)
    assert len(
        relative_orientations
    ) == genome_length, f"Track length must be equal to genome lenth, but {len(relative_orientations)} != {genome_length}"

    # Print single_mates_percentage in wig format
    to_wig(relative_orientations)
Exemplo n.º 3
0
	""")

	# Main args
	parser.add_argument("file", type=pathlib.Path, help="A genome file in .sam format")
	parser.add_argument("genome_length", type=int, help="The genome length")
	
	# Options
    parser.add_argument("--verbose", default=False, dest="verbose", action="store_true", help="Verbose output")

	# Get args
	args = parser.parse_args()
	
	input_file = args.file
	genome_length = args.genome_length
	verbose = args.verbose

	# Set loggin level
	logging.basicConfig(level=(logging.DEBUG if verbose else None))
	
	logging.debug(f"input_file = {input_file}")
	logging.debug(f"genome_length = {genome_length}")

	# Read mates
	mates = read_mates(input_file, keep_fields=["pos", "flag", "cigar"])

	# Get multiple aligment track
	hard_soft_clippings = get_hard_soft_clippings(mates, genome_length)

	# Print track to wig file
	to_wig(hard_soft_clippings)