Scripts/CNV_vis.py
def write_bedfile(regions, read_data):
    """ The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data.

    :param regions: a list of coordinates specified in the vcf file.
    :param read_data: a 2d list containing the read data of every region.
    """
    text = 'track name=CNV_information description="Region_Summary." db=hg19 gffTags=on\n'

    for index in range(0, len(regions)):
        region = f"{regions[index][0]}\t{regions[index][1]}\t{regions[index][2]}"
        paired_reads = read_data[index][0]
        unmapped_mate = read_data[index][1]
        duplicate_pairs = read_data[index][2]
        high_insize = read_data[index][3]
        facaway = read_data[index][4]
        same_orientation = read_data[index][5]
        proper_pair = read_data[index][6]

        text += f"{region}\tName=Read_information;Paired_reads={paired_reads};Proper_pairs={proper_pair};Unmapped_mate=" \
                f"{unmapped_mate};Duplicate_pair={duplicate_pairs};High_insert_size={high_insize};Facaway={facaway};" \
                f"Same_orientation={same_orientation}\n"

    with open(args.output + '/output.bed', 'w') as bedfile:
        bedfile.write(text)
 The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data.

    :param regions: a list of coordinates specified in the vcf file.
    :param read_data: a 2d list containing the read data of every region.
    
The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data.
The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data .
def write_bedfile(regions, read_data):
    text = 'track name=CNV_information description="Region_Summary." db=hg19 gffTags=on\n'
    for index in range(0, len(regions)):
        region = f"{regions[index][0]}\t{regions[index][1]}\t{regions[index][2]}"
        paired_reads = read_data[index][0]
        unmapped_mate = read_data[index][1]
        duplicate_pairs = read_data[index][2]
        high_insize = read_data[index][3]
        facaway = read_data[index][4]
        same_orientation = read_data[index][5]
        proper_pair = read_data[index][6]
        text += f"{region}\tName=Read_information;Paired_reads={paired_reads};Proper_pairs={proper_pair};Unmapped_mate=" \
                f"{unmapped_mate};Duplicate_pair={duplicate_pairs};High_insert_size={high_insize};Facaway={facaway};" \
                f"Same_orientation={same_orientation}\n"
    with open(args.output + '/output.bed', 'w') as bedfile:
        bedfile.write(text)
def write_bedfile ( regions , read_data ) : text = 'track name=CNV_information description="Region_Summary." db=hg19 gffTags=on\n' for index in range ( 0 , len ( regions ) ) : region = f"{regions[index][0]}\t{regions[index][1]}\t{regions[index][2]}" paired_reads = read_data [ index ] [ 0 ] unmapped_mate = read_data [ index ] [ 1 ] duplicate_pairs = read_data [ index ] [ 2 ] high_insize = read_data [ index ] [ 3 ] facaway = read_data [ index ] [ 4 ] same_orientation = read_data [ index ] [ 5 ] proper_pair = read_data [ index ] [ 6 ] text += f"{region}\tName=Read_information;Paired_reads={paired_reads};Proper_pairs={proper_pair};Unmapped_mate=" f"{unmapped_mate};Duplicate_pair={duplicate_pairs};High_insert_size={high_insize};Facaway={facaway};" f"Same_orientation={same_orientation}\n" with open ( args . output + '/output.bed' , 'w' ) as bedfile : bedfile . write ( text )
The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data.
The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data .
""" The write_bedfile function writes a file in BED format that can be loaded in igv and visualises the read data.

    :param regions: a list of coordinates specified in the vcf file.
    :param read_data: a 2d list containing the read data of every region.
    """
regions
a list of coordinates specified in the vcf file.
a list of coordinates specified in the vcf file .
read_data
a 2d list containing the read data of every region.
a 2d list containing the read data of every region .