Skip to content

Commit 328010d

Browse files
committed
v2.7.6
1 parent e613820 commit 328010d

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

Scripts/CheckCharacters.py

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,17 @@ def RunSanityCheck():
4141
seq = list(LibFile['seq'])
4242
GeneNames0 = []
4343
ID0 = []
44+
45+
# --------------------------------------------------------------------
46+
# Define bad characters (library)
47+
# --------------------------------------------------------------------
4448
BadCharacters = [' ','>','<',';',':',',','|','/','\\','(',')','[',']',\
4549
'$','%','*','?','{','}','=','+','@']
50+
51+
# --------------------------------------------------------------------
52+
# Check library
53+
# --------------------------------------------------------------------
54+
BadLibCharFound = False
4655
for gene in GeneNames:
4756
for bad_char in BadCharacters:
4857
gene = gene.replace(bad_char,'_')
@@ -52,6 +61,7 @@ def RunSanityCheck():
5261
sgRNA = sgRNA.replace(bad_char,'_')
5362
ID0.append(sgRNA)
5463
if GeneNames != GeneNames0 or ID != ID0:
64+
BadLibCharFound = True
5565
LibFile0 = pandas.DataFrame(data = {'gene': [gene for gene in GeneNames0],
5666
'ID': [sgRNA for sgRNA in ID0],
5767
'seq': [s for s in seq]},
@@ -67,42 +77,52 @@ def RunSanityCheck():
6777
Filenames = list(DataSheet['FILENAME'])
6878
TreatmentList = list(DataSheet['TREATMENT'])
6979
F = len(Filenames)
70-
BadCharFound = False
80+
81+
# --------------------------------------------------------------------
82+
# Define bad characters (filenames & samples)
83+
# --------------------------------------------------------------------
84+
BadCharacters = [' ','>','<',';',':',',','|','/','\\','(',')','[',']',\
85+
'$','%','*','?','{','}','=','+','@']
7186

7287
# --------------------------------------------------------------------
73-
# Replace non-printable characters from filenames
88+
# Replace non-printable characters from filenames
7489
# --------------------------------------------------------------------
7590
os.chdir(DataDir)
76-
BadCharacters = [' ','>','<',';',':',',','|','/','\\','(',')','[',']',\
77-
'$','%','*','?','{','}','=','+','@']
91+
BadFileCharFound = False
7892
for j in range(F):
7993
Filename = Filenames[j]
8094
Filename0 = Filename
8195
for bad_char in BadCharacters:
8296
Filename0 = Filename0.replace(bad_char,'_')
8397
if Filename0 != Filename:
84-
BadCharFound = True
98+
BadFileCharFound = True
8599
os.system('mv '+"'"+Filename+"'"+' '+Filename0)
86-
DataSheet['FILENAME'][j] = Filename0
100+
DataSheet['FILENAME'][j] = Filename0
101+
print("WARNING: Special characters in filenames names replaced by '_'")
87102

88103
# --------------------------------------------------------------------
89-
# Replace non-printable characters from filenames
90-
# --------------------------------------------------------------------
104+
# Replace non-printable characters from sample names
105+
# --------------------------------------------------------------------
91106
TreatmentList0 = TreatmentList
107+
BadSampleCharFound = False
92108
for bad_char in BadCharacters:
93109
TreatmentList0 = [str(treatment).replace(bad_char,'_') for treatment in TreatmentList0]
94110
if TreatmentList0 != TreatmentList:
95-
BadCharFound = True
111+
BadSampleCharFound = True
96112
DataSheet['TREATMENT'] = TreatmentList0
113+
print("WARNING: Special characters in sample names replaced by '_'")
97114

98115
# --------------------------------------------------------------------
99116
# Update Data Sheet
100117
# --------------------------------------------------------------------
101-
if BadCharFound:
118+
if BadFileCharFound or BadSampleCharFound:
102119
os.chdir(WorkingDir)
103-
DataSheet.to_excel('DataSheet.xlsx',columns=['FILENAME','TREATMENT'])
104-
print("WARNING: Special characters in sample names replaced by '_'")
105-
else:
120+
DataSheet.to_excel('DataSheet.xlsx',columns=['FILENAME','TREATMENT'])
121+
122+
# --------------------------------------------------------------------
123+
# No special characters found
124+
# --------------------------------------------------------------------
125+
if not BadLibCharFound and not BadFileCharFound and not BadSampleCharFound:
106126
print('No special characters found.')
107127

108128

Scripts/PinAPL.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,7 @@
204204
os.system('cp configuration.yaml '+LogFileDir)
205205
os.system('cp PinAPL-Py.log '+LogFileDir)
206206
os.chdir(WorkingDir)
207-
os.system('cp DataSheet.xlsx '+LogFileDir)
207+
os.system('cp DataSheet.xlsx '+LogFileDir)
208+
209+
# Status message
210+
print('LOADING RESULTS PAGE. PLEASE REFRESH PERIODICALLY...')

configuration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
# ***********************************************************************
77

88
# PROJECT PARAMETERS
9-
ScreenType: 'depletion' # type of screen ['enrichment'/'depletion']
9+
ScreenType: 'enrichment' # type of screen ['enrichment'/'depletion']
1010

1111
# LIBRARY PARAMETERS
12-
LibFilename: 'GeCKOv2_Mouse.csv' # filename of library spreadsheet
12+
LibFilename: 'GeCKOv21_Human.tsv' # filename of library spreadsheet
1313
seq_5_end: 'TCTTGTGGAAAGGACGAAACACCN' # sequence 5' of sgRNA in read
1414
NonTargetPrefix: 'NonTargeting' # prefix for non-targeting sgRNAs in library
1515
NumGuidesPerGene: 6 # number of sgRNAs per gene

0 commit comments

Comments
 (0)