Skip to content

Commit

Permalink
throw an error when having stranded/unstranded data
Browse files Browse the repository at this point in the history
  • Loading branch information
AtaJadidAhari committed Apr 23, 2024
1 parent a690ff1 commit bb202b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drop/config/SampleAnnotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def parse(self, sep='\t'):
optional_columns = {"GENE_COUNTS_FILE", "SPLICE_COUNTS_DIR", "GENE_ANNOTATION", "GENOME"}

annotationTable = pd.read_csv(self.file, sep=sep, index_col=False)

# FRASER cannot handle a mixture of stranded and unstranded samples, raise error in such cases
if (annotationTable['STRAND'] == 'no').any() & ((annotationTable['STRAND'] == 'reverse').any() | (annotationTable['STRAND'] == 'yes').any()):
raise ValueError("Data contains a mix of stranded and unstranded samples. Please consider analyzing them separately.\n")

missing_cols = [x for x in self.SAMPLE_ANNOTATION_COLUMNS if x not in annotationTable.columns.values]
if len(missing_cols) > 0:
if "GENE_ANNOTATION" in missing_cols and "ANNOTATION" in annotationTable.columns.values:
Expand Down

0 comments on commit bb202b1

Please sign in to comment.