Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2024 NMD skipping feature #26

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions cleaner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

rm -r work/
rm -r .nextflow/
rm timeline-*
rm trace-*
rm timeline*
rm trace*
rm .nextflow.log*

find . -maxdepth 4 -type d -name .idea -exec rm -r {} +
Expand Down
37 changes: 8 additions & 29 deletions containers_build/boostdm/features/exon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,30 @@
from boostdm.vepreader import Tabix


def nmd_rule(exon, total_exons):

"""
mutation is in an exon
if first or last exon then return 1
otherwise return 0
"""

if exon == 0:
nmd = 0
elif (exon == 1) or (exon == total_exons):
nmd = 1
else:
nmd = 0
return nmd


def get_exon(chr_, pos, alt,gene, reader):
def get_nmd(chr_, pos, alt, gene, reader):

for data in reader.get(chr_, pos, pos):
alt_vep = (data["ALT"] == alt)
mane_vep = (data["MANE_SELECT"] != '-') # impose mane transcript
correct_gene = (data["SYMBOL"] == gene) # skip cases with antisense overlapping gene
if alt_vep and mane_vep and correct_gene:
exons = data["EXON"]
if '/' in exons:
exon, total_exons = tuple(exons.split('/'))
else:
exon, total_exons = 0, 0
return nmd_rule(exon, total_exons)
if data["NMD_SKIPPING"] == '-':
return 0
elif data["NMD_SKIPPING"] == 'NMD_escaping_variant':
return 1
return 0


def add_feature(df):

df = df.copy()
with Tabix(TABIX_FILE) as reader:
get_from_reader = partial(get_exon, reader=reader)
df['nmd'] = df.apply(lambda row: get_from_reader(str(row['chr']),
int(row['pos']),
row['alt'],
row['gene']), axis=1)
get_from_reader = partial(get_nmd, reader=reader)
df['nmd'] = df.apply(lambda row: get_from_reader(row['chr'], row['pos'], row['alt'], row['gene']), axis=1)
return df



def test():
"""Test function"""
df = pd.DataFrame({
Expand Down
2 changes: 1 addition & 1 deletion containers_build/boostdm/vepreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
HEADER = [
'CHR', 'POS', 'REF', 'ALT', 'GENE','ENST','TYPE','CNSQ','cDNA_POS',
'CDS_POS', 'PROT_POS','AA','CODONS','EXISTING_VARIATION','IMPACT','DISTANCE','STRAND','FLAGS','SYMBOL',
'SYMBOL_SOURCE','HGNC_ID','CANONICAL','MANE_SELECT','MANE_PLUS_CLINICAL','ENSP','EXON','INTRON'
'SYMBOL_SOURCE','HGNC_ID','CANONICAL','MANE_SELECT','MANE_PLUS_CLINICAL','ENSP','EXON','INTRON','NMD_SKIPPING'
]


Expand Down
9 changes: 6 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ params {
env {
GENOME_BUILD = "hg38"
INTOGEN_DATASETS = "/workspace/datasets/intogen/runs/v2024/20240409_ALL/"
BOOSTDM_DATASETS = "/workspace/projects/intogen_plus/intogen-plus-v2024/datasets/boostdm/"

BOOSTDM_DATASETS = "/workspace/projects/intogen_plus/containers/datasets_patch_24_11/boostdm/"
// BOOSTDM_DATASETS = "/workspace/projects/intogen_plus/intogen-plus-v2024/datasets/boostdm/"

VEP_SATURATION = env.INTOGEN_DATASETS + "/steps/boostDM/saturation/"
PIPELINE = "/workspace/datasets/boostdm_runs/boostdm-pipeline-2024/"
OUTPUT = "/workspace/datasets/boostdm_runs/boostdm-cancer-output-2024-noIARC/"
PIPELINE = "/workspace/datasets/boostdm_runs/boostdm-pipeline-patch-2024/"
OUTPUT = "/workspace/datasets/boostdm_runs/boostdm-patch-2024-output/"
MAVE_DATA = "/workspace/projects/boostdm_analyses/mave_data/"
}

Expand Down
4 changes: 4 additions & 0 deletions scan_errors.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# uses conda environment boostdm-new-pipeline

# usage example:

# bash scan_errors.sh trace.txt

cat $1 | grep FAILED | cut -f3 | python _scan_errors.py