ResearchIT / IGV-ScanFold

IGV + RNA folding tools
4 stars 2 forks source link

Reverse strand Zavg track not populating #11

Closed rjandr closed 3 years ago

rjandr commented 3 years ago

The final partners zscore wig file is not being written/loaded correctly when scanning the reverse strand.

Might just need to pass strand data to the function that writes the file (line 419 of ScanFold-Scan_IGV.py):

def write_wig_dict(nucleotide_dictionary, outputfilename, name):

    w = open(outputfilename, 'w')
    #write wig file header
    w.write("%s %s %s %s %s\n" % ("fixedStep", "chrom="+name, "start="+str(start_coordinate), "step=1", "span=1"))

    #write values of zscores
    if strand == "reverse":
        for k, v, in sorted(nucleotide_dictionary, reverse=True):
            w.write("%f\n" % (v.zscore))
    else:
        for k, v in nucleotide_dictionary.items():
            w.write("%f\n" % (v.zscore))
rjandr commented 3 years ago

write_wig_dict function was handling the dictionary incorrectly for reverse strand - had to fix with "nucleotide_dictionary.items()"