Skip to content

Commit

Permalink
fixup! Format Python code with psf/black pull_request
Browse files Browse the repository at this point in the history
  • Loading branch information
PMBio authored and PMBio committed Feb 20, 2024
1 parent a4b98c5 commit 152d9cd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion deeprvat/annotations/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2436,4 +2436,4 @@ def select_rename_fill_annotations(


if __name__ == "__main__":
cli()
cli()
10 changes: 5 additions & 5 deletions pipelines/resources/absplice_dna.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from absplice import SplicingOutlierResult

splicing_result = SplicingOutlierResult(
df_mmsplice=snakemake.input['mmsplice_splicemap'],
df_spliceai=snakemake.input['spliceai'],
)
splicing_result.predict_absplice_dna(extra_info=snakemake.params['extra_info'])
splicing_result._absplice_dna.to_csv(snakemake.output['absplice_dna'])
df_mmsplice=snakemake.input["mmsplice_splicemap"],
df_spliceai=snakemake.input["spliceai"],
)
splicing_result.predict_absplice_dna(extra_info=snakemake.params["extra_info"])
splicing_result._absplice_dna.to_csv(snakemake.output["absplice_dna"])
24 changes: 15 additions & 9 deletions pipelines/resources/coding_genes.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import pandas as pd
import pyranges as pr

gr = pr.read_gtf(snakemake.input['gtf_file'])
gr = gr[(gr.Feature == 'gene') & (gr.gene_type == 'protein_coding')]
gr = pr.read_gtf(snakemake.input["gtf_file"])
gr = gr[(gr.Feature == "gene") & (gr.gene_type == "protein_coding")]
df_genes = gr.df

df_genes['gene_id_orig'] = df_genes['gene_id']
df_genes['PAR_Y'] = df_genes['gene_id'].apply(lambda x: 'PAR_Y' in x)
df_genes = df_genes[df_genes['PAR_Y'] == False]
df_genes['gene_id'] = df_genes['gene_id'].apply(lambda x: x.split('.')[0])
df_genes["gene_id_orig"] = df_genes["gene_id"]
df_genes["PAR_Y"] = df_genes["gene_id"].apply(lambda x: "PAR_Y" in x)
df_genes = df_genes[df_genes["PAR_Y"] == False]
df_genes["gene_id"] = df_genes["gene_id"].apply(lambda x: x.split(".")[0])

columns = [
'Chromosome', 'Start', 'End', 'Strand',
'gene_id', 'gene_id_orig', 'gene_name', 'gene_type'
"Chromosome",
"Start",
"End",
"Strand",
"gene_id",
"gene_id_orig",
"gene_name",
"gene_type",
]
df_genes[columns].to_csv(snakemake.output['coding_genes'], index=False)
df_genes[columns].to_csv(snakemake.output["coding_genes"], index=False)
9 changes: 5 additions & 4 deletions pipelines/resources/mmsplice_splicemap.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from absplice import SpliceOutlier, SpliceOutlierDataloader

dl = SpliceOutlierDataloader(
snakemake.input['fasta'], snakemake.input['vcf'],
splicemap5=list(snakemake.input['splicemap_5']),
splicemap3=list(snakemake.input['splicemap_3'])
snakemake.input["fasta"],
snakemake.input["vcf"],
splicemap5=list(snakemake.input["splicemap_5"]),
splicemap3=list(snakemake.input["splicemap_3"]),
)

model = SpliceOutlier()
model.predict_save(dl, snakemake.output['result'])
model.predict_save(dl, snakemake.output["result"])
15 changes: 8 additions & 7 deletions pipelines/resources/spliceai.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from spliceai_rocksdb.spliceAI import SpliceAI


if snakemake.params['lookup_only']:
model = SpliceAI(db_path=snakemake.params['db_path'])
if snakemake.params["lookup_only"]:
model = SpliceAI(db_path=snakemake.params["db_path"])
else:
model = SpliceAI(snakemake.input['fasta'],
annotation=snakemake.params['genome'],
db_path=snakemake.params['db_path'])
model = SpliceAI(
snakemake.input["fasta"],
annotation=snakemake.params["genome"],
db_path=snakemake.params["db_path"],
)


model.predict_save(snakemake.input['vcf'],
snakemake.output['result'])
model.predict_save(snakemake.input["vcf"], snakemake.output["result"])

0 comments on commit 152d9cd

Please sign in to comment.