-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-settings
96 lines (76 loc) · 3.42 KB
/
generate-settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $HELP = <<HELP;
Generate the initial settings.txt file for a specified genome.
usage: generate-settings genome
* genome = name (hg19, mm10, etc.) or exact dir (contains genome.fa and genes.gtf)
HELP
if (!$ARGV[0]) {
die $HELP;
}
main();
# main subroutine
sub main {
my $genome_arg = $ARGV[0];
#my $account_name= $ARGV[1];
# pipeline directory (the directory that this file is in)
my $pipeline_dir = dirname(__FILE__);
# settings file
my $settings_file = "settings.txt";
# check if the settings file already exists
if ( -e $settings_file ) {
die "\n\n ERROR: FILE $settings_file ALREADY EXISTS (DELETE IT TO GENERATE A NEW ONE) \n\n";
}
# set genome setting
my $genome_dir_setting;
my $settings_fasta;
my $settings_gtf;
if ($genome_arg =~ m/\//) {
# use directory if given
$genome_dir_setting = "GENOME-DIR|${genome_arg}\n";
}
elsif ($genome_arg eq "hg38") {
# use genome name if provided
$genome_dir_setting = "GENOME-DIR|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Genome-fasta/H_sapiens/GRCh38/current/";
$settings_fasta = "REF-FASTA|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Genome-fasta/H_sapiens/GRCh38/current/Homo_sapiens.GRCh38.dna.primary_assembly.fa";
$settings_gtf="REF-GTF|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Annotation/Gencode/Human/GRCh38/current/gencode.v40.primary_assembly.annotation.gtf";
$fastq_screen="REF-FASTQSCREEN|/sc/arion/projects/naiklab/ikjot/reference_files/fastq_screen.conf";
$ref_star="REF-STAR|/sc/arion/projects/naiklab/ikjot/reference_files/STAR";
$strand="EXP-STRAND|unstr";
$flat="REF-REFFLAT|/sc/arion/projects/naiklab/ikjot/reference_files/refFlat.txt.gz";
$interval_list="RRNAINTERVALLIST|/sc/arion/projects/naiklab/ikjot/reference_files/hg38_rRNA.list";
}
elsif ($genome_arg eq "mm10") {
# use genome name if provided
$genome_dir_setting = "GENOME-DIR|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Genome-fasta/M_musculus/GRCm39/current/";
$settings_fasta = "REF-FASTA|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Genome-fasta/M_musculus/GRCm39/current/Mus_musculus.GRCm39.dna.primary_assembly.fa";
$settings_gtf="REF-GTF|/sc/arion/projects/data-ark/Public_Unrestricted/reference_genome/Annotation/Gencode/Mouse/GRCm39/current/gencode.vM29.primary_assembly.annotation.gtf";
}
else {
die "\n\n ERROR: GENOME $genome_arg NOT FOUND \n\n";
}
# save genome setting
open(my $fh, ">", $settings_file);
# print $fh $genome_setting;
print $fh "$genome_dir_setting \n";
print $fh "$settings_fasta \n";
print $fh "$settings_gtf \n";
close $fh;
# get values to make sure they were set properly
#$settings_genome = `bash ${pipeline_dir}/scripts/get-set-setting.sh $settings_file GENOME-DIR`;
#$settings_fasta = `bash ${pipeline_dir}/scripts/get-set-setting.sh $settings_file REF-FASTA`;
#$settings_gtf = `bash ${pipeline_dir}/scripts/get-set-setting.sh $settings_file REF-GTF`;
# print values
print STDERR "\n";
print STDERR " REF DIR : $genome_dir_setting \n";
print STDERR " REF FASTA : $settings_fasta \n";
print STDERR " REF-GTF : $settings_gtf \n";
print STDERR " REF-FASTQSCREEN : $fastq_screen \n";
print STDERR " REF-STAR : $ref_star \n";
print STDERR " EXP-STRAND : $strand \n";
print STDERR " REF-REFFLAT : $flat \n";
print STDERR " RRNAINTERVALLIST : $interval_list \n";
}
# end