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

Check External gene annot #546

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions drop/config/ExportCounts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from snakemake.io import expand
from drop import utils
from snakemake.logging import logger


class ExportCounts:
Expand Down Expand Up @@ -37,6 +38,8 @@ def __init__(

self.pattern = self.outputRoot / "{dataset}--{genomeAssembly}--{annotation}"

self.checkNonExternalGeneAnnotation()

def setDefaults(self, config_dict, gene_annotations):
utils.setKey(config_dict, None, "geneAnnotations", gene_annotations)
utils.setKey(config_dict, None, "excludeGroups", list())
Expand Down Expand Up @@ -107,3 +110,10 @@ def getExportCountFiles(self, count_type, suffix="tsv.gz", expandPattern=None, *
datasets = self.getExportGroups([self.COUNT_TYPE_MAP[count_type]])
expandPattern = count_type if expandPattern is None else expandPattern
return self.getFiles(f"{expandPattern}.{suffix}", datasets, **kwargs)

def checkNonExternalGeneAnnotation(self):
excluded_groups = self.config_dict['excludeGroups']
non_excluded_samples = self.sampleAnnotation.annotationTable[self.sampleAnnotation.annotationTable['DROP_GROUP'].isin(excluded_groups) == False]
if sum(non_excluded_samples['GENE_ANNOTATION'].isna() == False) > 0:
logger.info("WARNING: Found %d samples that had `GENE_ANNOTATION` provided in sample annotation table but are not external counts. The provided `GENE_ANNOTATIONs` are ignored.\n" % (sum(non_excluded_samples['GENE_ANNOTATION'].isna() == False)))
self.sampleAnnotation.annotationTable.loc[self.sampleAnnotation.annotationTable['DROP_GROUP'].isin(excluded_groups) == False, "GENE_ANNOTATION"] = ""
Loading