Skip to content

Commit

Permalink
#45 write cooocurring_mutations.csv in the beginning of main
Browse files Browse the repository at this point in the history
  • Loading branch information
LaraFuhrmann committed Feb 27, 2025
1 parent 5a98d13 commit 9733154
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions viloca/shorah_snv.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,23 +525,6 @@ def get_cooccuring_muts_haplo_df(haplo_filename, ref_filename, beg, end, chrom):

return df

def write_cooccuring_muts_file():

tmp_df =[]

# iterate over haplotype files
with open("coverage.txt") as cov_file:
for line in cov_file:
# winFile, chrom, beg, end, cov
_, chrom, beg, end, _ = line.rstrip().split("\t")

file_stem = "w-%s-%s-%s" % (chrom, beg, end)
haplo_filename = os.path.join(working_dir, "haplotypes", file_stem + ".reads-support.fas")
ref_name = os.path.join(working_dir, "haplotypes", file_stem + ".ref.fas")
tmp_df.append(get_cooccuring_muts_df(fname_haplo, fname_ref, beg,end,chrom))

pd.concat(tmp_df).to_csv("cooccurring_mutations.csv")

def main(args):
"""main code"""

Expand All @@ -563,6 +546,20 @@ def main(args):

logging.info(str(inspect.getfullargspec(main)))

# write: "cooccurring_mutations.csv"
tmp_df =[]
# iterate over haplotype files
with open("coverage.txt") as cov_file:
for line in cov_file:
# winFile, chrom, beg, end, cov
_, chrom, beg, end, _ = line.rstrip().split("\t")

file_stem = "w-%s-%s-%s" % (chrom, beg, end)
haplo_filename = os.path.join(working_dir, "haplotypes", file_stem + ".reads-support.fas")
ref_name = os.path.join(working_dir, "haplotypes", file_stem + ".ref.fas")
tmp_df.append(get_cooccuring_muts_df(fname_haplo, fname_ref, beg,end,chrom))
pd.concat(tmp_df).to_csv("cooccurring_mutations.csv")

# snpD_m is the file with the 'consensus' SNVs (from different windows)
logging.debug("now parsing SNVs")
all_SNVs = getSNV(extended_window_mode, exclude_non_var_pos_threshold,
Expand Down

0 comments on commit 9733154

Please sign in to comment.