Écrire la sortie dans la variable $ TMPDIR / $: le fichier n'existe pas (doit être créé)


0

J'ai le script .sh suivant dans lequel j'essaie de faire toutes les écritures majeures dans $ TMPDIR.

Toutefois, lorsqu'il arrive à la ligne 86, il renvoie l'erreur suivante:

/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2304_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2107_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1209_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1301_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2115_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2210_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2307_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2302_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2303_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1306_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1115_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1110_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_1204_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2214_Header.sam: No such file or directory
/var/spool/uge/bnbhimem2/job_scripts/855849: line 86: /tmp/uge/855849.2.primary.q//tmp/uge/855849.2.primary.q/Alignments_2308_Header.sam: No such file or directory

Je pensais que ce fichier était censé être créé avec la sortie de cat, pourquoi se plaint-il de son absence?

Merci Carmen

  1 #!/bin/sh
  2 
  3 ##Usage: run_Split_by_Tile_AWK.sh [0-7]
  4 
  5 # Run on the current working directory
  6 #$ -cwd
  7 # Give this job a name
  8 #$ -N Split_by_Tile_AWK
  9 # Join standard output and error to a single file
 10 #$ -j y
 11 # Name the file where to redirect standard output and error
 12 ## -o AWK_Split_by_Tile
 13 # Send an email when the job begins and when it ends running
 14 #$ -m be
 15 # Whom to send the email to
 16 #$ -M csandova@cshl.edu
 17 # Local disk space and memory necessary
 18 ## –l tmp_free=900G
 19 #$ -l m_mem_free=400G
 20 # Array job options
 21 #$ -t 1-8
 22 
 23 # Now let's keep track of some information just in case anything goes wrong.
 24 
 25 echo "=========================================================="
 26 echo "Starting on : $(date)"
 27 echo "Running on node : $(hostname)"
 28 echo "Current directory : $(pwd)"
 29 echo "Current job ID : $JOB_ID"
 30 echo "Current job name : $JOB_NAME"
 31 echo "Task index number : $SGE_TASK_ID"
 32 echo "=========================================================="
 33 
 34 # Run some commands
 35 
 36 export PATH=/opt/hpc/bin:$PATH
 37 export PATH=$HOME/bin:$PATH
 38 
 39 parent_tophat=/data/bsr/tforcier/tophat_results
 40 
 41 folder_array=(tophat_WTyoungRep1take2_out tophat_WTyoungRep2_out tophat_WToldRep1_out  tophat_WToldRep2take2_out tophat_Ago2youngRep1take2_out tophat_Ago2youngRep2_out tophat_Ago2oldRep1_out tophat_Ago    2oldRep2_out)
 42 
 43 i=$(($SGE_TASK_ID - 1))
 44 
 45 ##Build input
 46 
 47 input=$parent_tophat/${folder_array[$i]}/accepted_hits.bam
 48 
 49 ##Make output base name
 50 
 51 y=${folder_array[$i]#tophat_}
 52 
 53 outputBase=${y%_out}
 54 
 55 ##outputBase ~=Ago2youngRep1take2 or ~=WTyoungRep2##
 56 
 57 cp $input $TMPDIR/$outputBase.bam
 58 
 59 temporal_input=$TMPDIR/$outputBase.bam
 60 
 61 cp /data/bsr/csandova/mRNA_Seq/TileLists/Tile_Number_List.txt $TMPDIR/Tile_Number_List.txt
 62 
 63 mkdir -v $outputBase\_Split
 64 
 65 newDir=$outputBase\_Split
 66 
 67 ##newDir ~=Ago2youngRep1take2_Split or ~=WTyoungRep2_Split##
 68 
 69 
 70 #Process BAM files
 71 
 72 samtools view $temporal_input | awk -F '[\t:]' -v opath="$TMPDIR" '
 73 
 74 FNR == NR {
 75     num[$1]
 76     next
 77 }
 78 
 79 $5 in num {
 80     f = opath"/Alignments_"$5".sam";
 81     print > f
 82 } ' $TMPDIR/Tile_Number_List.txt -
 83 
 84 for x in $(find $TMPDIR -name '*.sam'); do
 85 
 86 cat SAMHeader.txt $x >$TMPDIR/${x%.sam}_Header.sam;
 87 
 88 rm $x;
 89 
 90 done
 91 
 92 for x in $(find $TMPDIR -name '*_Header.sam');
 93 
 94 do samtools view -bS $x | samtools sort - $newDir/${x%.sam}.bam ;
 95 
 96 done

Réponses:


1

Le message d'erreur

No such file or directory

signifie que le répertoire dans lequel vous essayez de créer le fichier n'existe pas.

Le problème est que

for x in $(find $TMPDIR -name '*.sam'); do

stocke déjà le chemin complet dans la variable x , vous devez donc utiliser

cat SAMHeader.txt $x > ${x%.sam}_Header.sam

au lieu de

cat SAMHeader.txt $x > $TMPDIR/${x%.sam}_Header.sam
En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.