Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/assess_panel/assess_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import click


sys.path.append("../../bin")
sys.path.append("../../bin/")

from utils_context import triplet_context_iterator

Expand Down
4 changes: 2 additions & 2 deletions bin/add_subgenicregions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def main(panel_file, autoexons, autodomains, custom, subgenic_regions_complement

# If you reach ths point, ind_start is defined and valid
# Search for END position starting from ind_start
search_end = chr_data.iloc[ind_start:,:]
search_end = chr_data.iloc[ind_start:]
end_matches = np.where(search_end["POS"] == row["END"])[0]

end_found = len(end_matches) > 0
Expand Down Expand Up @@ -117,7 +117,7 @@ def main(panel_file, autoexons, autodomains, custom, subgenic_regions_complement
upd_end = ind_end

# Extract subgenic data and modify gene names
subgenic_data = chr_data.iloc[upd_start: upd_end + 1, :].copy()
subgenic_data = chr_data.iloc[upd_start: upd_end + 1].copy()
subgenic_data["GENE"] = region_name

new_data = pd.concat((new_data, subgenic_data))
Expand Down
4 changes: 2 additions & 2 deletions bin/annotate_omega_failing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



def load_flagged_tables(paths: List[Path]) -> Tuple[pd.DataFrame, pd.DataFrame]:
def load_flagged_tables(paths: List[Path]) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:
"""Read flagged files and return a normalized DataFrame with possible columns:
SAMPLE, GENE, reason_exclusion
"""
Expand All @@ -30,7 +30,7 @@ def load_flagged_tables(paths: List[Path]) -> Tuple[pd.DataFrame, pd.DataFrame]:
df = pd.read_csv(p, sep="\t", header=0, dtype=str)
pieces.append(df)
if not pieces:
return pd.DataFrame(columns=["sample", "gene", "reason_exclusion"]), pd.DataFrame(columns=["sample", "gene", "reason_exclusion"])
return pd.DataFrame(columns=["sample", "gene", "reason_exclusion"]), pd.DataFrame(columns=["sample", "gene", "reason_exclusion"]), pd.DataFrame(columns=["sample", "gene", "reason_exclusion"]), pd.DataFrame(columns=["sample", "gene", "reason_exclusion"])

all_df = pd.concat(pieces, ignore_index=True, sort=False)

Expand Down
5 changes: 3 additions & 2 deletions bin/check_samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def check_samplesheet(file_in, file_out, bam_required=False):
with file_in.open(newline="") as in_handle:
reader = csv.DictReader(in_handle, dialect=sniff_format(in_handle))
# Validate the existence of the expected header columns.
if not required_columns.issubset(reader.fieldnames):
fieldnames = reader.fieldnames or []
if not required_columns.issubset(fieldnames):
req_cols = ", ".join(required_columns)
logger.critical(f"The sample sheet **must** contain these column headers: {req_cols}.")
sys.exit(1)
Expand All @@ -224,7 +225,7 @@ def check_samplesheet(file_in, file_out, bam_required=False):
logger.critical(f"{str(error)} On line {i + 2}.")
sys.exit(1)
checker.validate_unique_samples()
header = list(reader.fieldnames)
header = list(fieldnames)
# See https://docs.python.org/3.9/library/csv.html#id3 to read up on `newline=""`.
with file_out.open(mode="w", newline="") as out_handle:
writer = csv.DictWriter(out_handle, header, delimiter=",")
Expand Down
2 changes: 1 addition & 1 deletion bin/create_mask_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def add_bed_positions(bed_df: pd.DataFrame,
entries_added = 0

for row in bed_df.itertuples():
for pos in range(row.START, row.END + 1):
for pos in range(int(row.START), int(row.END) + 1):
key = (row.CHROM, pos, sample_name)
if key not in masked_positions:
mask_data.append({
Expand Down
652 changes: 652 additions & 0 deletions bin/explore_saturation.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/filterbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def main(sample_maf_file, bedfile, filtername, positive):
positions_df = remove_non_canonical_chromosomes(positions_df)

# adjust the CHROM field to adapt to the way it is being represented in the mutations list
if sample_maf.iloc[0,0].startswith("chr") and not positions_df.iloc[0,0].startswith("chr"):
if str(sample_maf.iloc[0,0]).startswith("chr") and not str(positions_df.iloc[0,0]).startswith("chr"):
positions_df["CHROM"] = "chr" + positions_df["CHROM"]
elif not sample_maf.iloc[0,0].startswith("chr") and positions_df.iloc[0,0].startswith("chr"):
elif not str(sample_maf.iloc[0,0]).startswith("chr") and str(positions_df.iloc[0,0]).startswith("chr"):
positions_df["CHROM"] = positions_df["CHROM"].str.replace("chr", "")

filtered_maf = filter_panel(sample_maf, positions_df, filtername, positive = positive)
Expand Down
Loading