Skip to content

Commit 1c96deb

Browse files
Merge pull request #19 from pinellolab/thread_limit_removal
Thread limit removal
2 parents 14d25e3 + 2ea2e9a commit 1c96deb

8 files changed

Lines changed: 27 additions & 21 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ guides/
1515
*.pkl
1616
*.txt
1717
*.zip
18+
PostProcess/dnaShape.pkl

PostProcess/annotate_final_results.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
with open(inAnnotationFile, 'r') as annotations:
2222
for line in annotations:
2323
x = line.split('\t')
24+
if 'vuoto.txt' in inAnnotationFile:
25+
break
2426
annotations_list = str(x[3]).strip()
2527
if str(x[0]) in annotationDict.keys():
2628
annotationDict[str(x[0])][int(x[1]):int(x[2])] = str(x[0])+'\t'+annotations_list

PostProcess/dnaShape.pkl

9 Bytes
Binary file not shown.

PostProcess/pool_post_analisi_indel.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
dict_folder = sys.argv[10]
1818
final_res = sys.argv[11]
1919
final_res_alt = sys.argv[12]
20-
# ncpus=int(sys.argv[13])
21-
ncpus = 4
20+
ncpus=int(sys.argv[13])
21+
# ncpus = 4
2222

2323

2424
def start_analysis(f):
@@ -35,8 +35,8 @@ def start_analysis(f):
3535
if 'vcf.gz' in f:
3636
chrs.append(f)
3737

38-
t = 6
39-
if ncpus < 6:
40-
t = ncpus
41-
with Pool(processes=t) as pool:
38+
# t = 6
39+
# if ncpus < 6:
40+
# t = ncpus
41+
with Pool(processes=ncpus) as pool:
4242
pool.map(start_analysis, chrs)

PostProcess/pool_post_analisi_snp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def start_analysis(f):
3535
if '.fa' in f and '.fai' not in f:
3636
chrs.append(f)
3737

38-
t = 6
39-
if ncpus < 6:
40-
t = ncpus
41-
with Pool(processes=t) as pool:
38+
# t = 6
39+
# if ncpus < 6:
40+
# t = ncpus
41+
with Pool(processes=ncpus) as pool:
4242
pool.map(start_analysis, chrs)

PostProcess/pool_search_indels.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
output_folder = sys.argv[10]
2121
true_pam = sys.argv[11]
2222
current_working_directory = sys.argv[12]
23+
threads = int(sys.argv[13])
2324

2425

2526
def search_indels(f):
26-
global use_thread
27+
# global use_thread
2728
splitted = f.split('.')
2829
for elem in splitted:
2930
if "chr" in elem:
@@ -42,18 +43,18 @@ def search_indels(f):
4243
if 'vcf.gz' == f[-6:]:
4344
chrs.append(f)
4445

45-
cpus = len(os.sched_getaffinity(0))
46-
if cpus - 3 < 10:
47-
if cpus - 3 < 0:
48-
t = 1
49-
else:
50-
t = cpus - 3
51-
else:
52-
t = 10
46+
# cpus = len(os.sched_getaffinity(0))
47+
# if cpus - 3 < 10:
48+
# if cpus - 3 < 0:
49+
# t = 1
50+
# else:
51+
# t = cpus - 3
52+
# else:
53+
# t = 10
5354

5455
os.chdir(output_folder)
5556
# with Pool(processes=t) as pool:
56-
with Pool(processes=t) as pool:
57+
with Pool(processes=threads) as pool:
5758
pool.map(search_indels, chrs)
5859

5960

PostProcess/radar_chart_dict_generator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ def fillDict(guide, guideDict, motifDict):
332332

333333
# read all the annotations
334334
for line in inAnnotationsFile:
335+
if 'vuoto.txt' in sys.argv[4]: #se vuoto.txt usato come annotazione, skippa lettura
336+
break
335337
annotations_list = line.strip().split('\t')[3].split(',')
336338
for annotation in annotations_list:
337339
if '_personal' not in annotation:

PostProcess/submit_job_automated_new_multiple_vcfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ while read vcf_f; do
329329
cd $starting_dir
330330
#commented to avoid indels search
331331
#TODO REMOVE POOL SCRIPT FROM PROCESSING
332-
./pool_search_indels.py "$ref_folder" "$vcf_folder" "$vcf_name" "$guide_file" "$pam_file" $bMax $mm $bDNA $bRNA "$output_folder" $true_pam "$current_working_directory/"
332+
./pool_search_indels.py "$ref_folder" "$vcf_folder" "$vcf_name" "$guide_file" "$pam_file" $bMax $mm $bDNA $bRNA "$output_folder" $true_pam "$current_working_directory/" "$ncpus"
333333
# mv "$output_folder/indels_${ref_name}+${vcf_name}_${pam_name}_${guide_name}_${mm}_${bDNA}_${bRNA}.targets.txt" "$output_folder/crispritz_targets"
334334
awk '($3 !~ "n") {print $0}' "$output_folder/indels_${ref_name}+${vcf_name}_${pam_name}_${guide_name}_${mm}_${bDNA}_${bRNA}.targets.txt" >"$output_folder/indels_${ref_name}+${vcf_name}_${pam_name}_${guide_name}_${mm}_${bDNA}_${bRNA}.targets.txt.tmp"
335335
mv "$output_folder/indels_${ref_name}+${vcf_name}_${pam_name}_${guide_name}_${mm}_${bDNA}_${bRNA}.targets.txt.tmp" "$output_folder/indels_${ref_name}+${vcf_name}_${pam_name}_${guide_name}_${mm}_${bDNA}_${bRNA}.targets.txt"

0 commit comments

Comments
 (0)