Help with shell script - not finding files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with shell script - not finding files
# 1  
Old 11-11-2013
Help with shell script - not finding files

Hello,

I have a shell script like the one below but cannot get it working:
Code:
#!/bin/bash
#$ -cwd

CHR=$2
 
# directories
ROOT_DIR=./
RESULTS_DIR=${ROOT_DIR}results/
 
# executable
SHAPEIT_EXEC=${ROOT_DIR}shapeit.v2.r727.linux.x64/shapeit.v2.r727.linux.x64
 
# parameters
THREAT=5
EFFECTIVESIZE=11418
 
# reference data files
GENMAP_FILE=/home/whme1016/Imputation/genetic_map_b37/genetic_map_chr${CHR}_combined_b37.txt
 
# GWAS data files in PLINK BED format
GWASDATA_BED=${ROOT_DIR}chr${CHR}.unphased.bed
GWASDATA_BIM=${ROOT_DIR}chr${CHR}.unphased.bim
GWASDATA_FAM=${ROOT_DIR}chr${CHR}.unphased.fam

# problem SNP file
EXCLUDE_SNP=${ROOT_DIR}chr${CHR}.alignments.snp.strand.exclude
 
# main output file
OUTPUT_HAPS=${RESULTS_DIR}chr${CHR}.phased.haps
OUTPUT_SAMPLE=${RESULTS_DIR}chr${CHR}.phased.sample
OUTPUT_LOG=${RESULTS_DIR}chr${CHR}.phased.log
 
## phase GWAS genotypes
$SHAPEIT_EXEC \
--input-bed $GWASDATA_BED $GWASDATA_BIM $GWASDATA_FAM \
--input-map $GENMAP_FILE \
--exclude-snp $EXCLUDE_SNP \
--thread $THREAT \
--effective-size $EFFECTIVESIZE \
--output-max $OUTPUT_HAPS $OUTPUT_SAMPLE \
--output-log $OUTPUT_LOG

done

I am trying to run a program called SHAPEIT. When I run the shell script, I get the following error:
Code:
Segmented HAPlotype Estimation & Imputation Tool
  * Authors : Joe BLOGGS
  * Contact : someone@somewhere.com
  * Webpage : http:://www.example.fr
  * Version : v2.r727
ERROR: [./chr.alignments.snp.strand.exclude] is impossible to open, check file existence or reading permissions

I have the following files in my root directory for chromosome 2 with full permissions:
Code:
chr2.alignments.log                 
chr2.alignments.snp.strand        
chr2.alignments.snp.strand.exclude 
chr2.unphased.bed                   
chr2.unphased.bim                   
chr2.unphased.fam                   
chr2.unphased.log

My shell script is clearly reading the chr2.unphased.fam/bed/bim files, but not my chr2.alignments.snp.strand.exclude. Any ideas why this is? Thanks for any help.

Last edited by Scott; 11-11-2013 at 03:58 PM.. Reason: Add code tags; obfuscate data
# 2  
Old 11-11-2013
CHR=$2 represent the 2nd argument given at the command line.
Are you invoking the command as:
Code:
command <arg1> <arg2> ?

It looks like you expect a directory to be called chr2. For your script to work it has to be invoked as:

Code:
script_name <arg1> 2

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding file extension on C Shell script

I very new to C Shell. I am trying to do is read from Command line. Find the if the file is zip, .txt, symbloic link,pipe, unknow (if file is not zip, txt, sy....) here is what I what got so far. I am very stuck atm Please help me out : If the file is symblooc link what file is link to ... (12 Replies)
Discussion started by: madbull41
12 Replies

2. Shell Programming and Scripting

Need help in finding and copying list of files using bash shell script

Dear All, I have a situation where I want to copy some files of type .txt. These files are o/p from one program. Some of the files are named as fileName .txt instead of fileName.txt after fileName by mistake I have specified "space". Now I want to move these files as follows. mv fileName*... (13 Replies)
Discussion started by: linuxUser_
13 Replies

3. Answers to Frequently Asked Questions

Finding the nth Particular Week in a Month – shell script

I see lot of request posted in internet to find out the day of nth week in a Month. example: what is the date of 3rd Sunday in October What is the date of 2nd Friday in June 2012 what is the date of 4th Saturday in January 2011..etc.. The below shell script is used to find out the... (1 Reply)
Discussion started by: itkamaraj
1 Replies

4. UNIX for Dummies Questions & Answers

Shell script - Finding Autosys job status

Hi, There are 2000 jobs in the list and i need to draw their status. I put all the jobs in the list and trying to read one by one from the list and to find out the status. Help me out in correcting the script. #!/bin/csh for a in $(cat Jobs_List.txt); do source <<path>> autorep -j $a... (1 Reply)
Discussion started by: venkatesht
1 Replies

5. Shell Programming and Scripting

shell script for finding average runtime of other script

so I've made a shell script that downloads 6 files in succession from a given url, then deletes them. Now I want to time the script, and the average time it uses by running it ~100 times. My problem is tho, how do I store the time it takes for each run through of the script? I know time writes to... (3 Replies)
Discussion started by: navlelo
3 Replies

6. Red Hat

Need help with a shell script for finding a certain pattern from log file

Hell Guys, Being a newbie, I need some help in finding a certain string from a log file of thousands of lines (around 30K lines) and have the output in a separate file. Below is the file output - 10.155.65.5 - - "POST... (15 Replies)
Discussion started by: rockf1bull
15 Replies

7. Shell Programming and Scripting

Finding all script files

Hello All, After a HDD crash, I would like to selectively back up all my script files. What is the most efficient way to do this? The pseudo code I was thinking of was something like this: for a in `find ./ -name "*"` do if (file $a) == Bourne|Tcsh|... then echo $a >>... (7 Replies)
Discussion started by: pru
7 Replies

8. Shell Programming and Scripting

need help in finding a string and to send an email using shell script

Hi All i am writing a shell script which will search for a string "expires". once the search string is found it has to give the email address as the output and send an email to the person This is basically to find the encrypetd keys which are loaded in the unix server Below are sample... (10 Replies)
Discussion started by: ranga27
10 Replies

9. UNIX for Dummies Questions & Answers

Unix shell script for finding top ten files of maximum size

I need to write a Unix shell script which will list top 10 files in a directory tree on basis of size. i.e. first file should be the biggest in the whole directory and all its sub directories. Please suggest any ideas (10 Replies)
Discussion started by: abhilashnair
10 Replies
Login or Register to Ask a Question