5
$\begingroup$

I wrote script for pasting rsids on CADD output. Here is script.

#!/bin/bash
cd tmp
cut -f 1,2 CADD.tsv > fileA
paste fileA <(cut -f 2,125  CADD.tsv) > myNewFile
bedtools intersect -a  myNewFile -b New.vcf -wb |cut -f 1-4,7 > CADD.rsids.tsv

I have tested commands one by one and they work fine. But when I run script of these commands, it gives me this error.

$ sh cadd.rsids.sh
4: cadd.rsids.sh: Syntax error: "(" unexpected

Can anyone please tell me how to resolve this error? Here are few lines of CADD.tsv file.

"##CADD GRCh38-v1.4 (c) University of Washington, Hudson-Alpha Institute for Biotechnology and Berlin Institute of Health 2013-2018. All rights reserved."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
#Chrom  Pos Ref Alt Type    Length  AnnoType    Consequence ConsScore   ConsDetail  GC  CpG motifECount motifEName  motifEHIPos motifEScoreChng oAA nAA GeneID  FeatureID   GeneName    CCDS    Intron  Exon    cDNApos relcDNApos  CDSpos  relCDSpos   protPos relProtPos  Domain  Dst2Splice  Dst2SplType minDistTSS  minDistTSE  SIFTcat SIFTval PolyPhenCat PolyPhenVal priPhCons   mamPhCons   verPhCons   priPhyloP   mamPhyloP   verPhyloP   bStatistic  targetScan  mirSVR-Score    mirSVR-E    mirSVR-Aln  cHmm_E1 cHmm_E2 cHmm_E3 cHmm_E4 cHmm_E5 cHmm_E6 cHmm_E7 cHmm_E8 cHmm_E9 cHmm_E10    cHmm_E11    cHmm_E12    cHmm_E13    cHmm_E14    cHmm_E15    cHmm_E16    cHmm_E17    cHmm_E18    cHmm_E19    cHmm_E20    cHmm_E21    cHmm_E22    cHmm_E23    cHmm_E24    cHmm_E25    GerpRS  GerpRSpval  GerpN   GerpS   tOverlapMotifs  motifDist   EncodeH3K4me1-sum   EncodeH3K4me1-max   EncodeH3K4me2-sum   EncodeH3K4me2-max   EncodeH3K4me3-sum   EncodeH3K4me3-max   EncodeH3K9ac-sum    EncodeH3K9ac-max    EncodeH3K9me3-sum   EncodeH3K9me3-max   EncodeH3K27ac-sum   EncodeH3K27ac-max   EncodeH3K27me3-sum  EncodeH3K27me3-max  EncodeH3K36me3-sum  EncodeH3K36me3-max  EncodeH3K79me2-sum  EncodeH3K79me2-max  EncodeH4K20me1-sum  EncodeH4K20me1-max  EncodeH2AFZ-sum EncodeH2AFZ-max EncodeDNase-sum EncodeDNase-max EncodetotalRNA-sum  EncodetotalRNA-max  Grantham    Dist2Mutation   Freq100bp   Rare100bp   Sngl100bp   Freq1000bp  Rare1000bp  Sngl1000bp  Freq10000bp Rare10000bp Sngl10000bp EnsembleRegulatoryFeature   dbscSNV-ada_score   dbscSNV-rf_score    RemapOverlapTF  RemapOverlapCL  RawScore    PHRED
1   3362704 T   A   SNV 0   Transcript  INTRONIC    2   intron  0.536423841 0.04    NA  NA  NA  NA  NA  NA  ENSG00000142611 ENST00000270722 PRDM16  CCDS41236.2 12:00:00 AM NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  118572  24215   NA  NA  NA  NA  0   0   0   -0.405  -1.689  -1.593  964 NA  NA  NA  NA  0   1   1   5   0   0   1   0   0   0   0   1   0   1   12  0   0   0   0   0   8   11  5   2   0   NA  NA  2.46    -4.93   1   0.02    4.53362 1.5498  3.49082 1.00224 9.30658 3.84201 5.88121 2.95189 9.31556 5.27366 4.01294 1.08327 25.99   5.10373 4.47027 1.51567 1.55624 0.7046  4.95028 1.49632 8.57929 1.45764 1.19689 0.644106    0.01783 0.01476 NA  16  1   0   15  4   10  184 17  101 1741    NA  NA  NA  5   19  -0.173019   0.424
1   7785635 T   C   SNV 0   Intergenic  DOWNSTREAM  1   downstream  0.483443709 0.053333333 NA  NA  NA  NA  NA  NA  ENSG00000049245 ENST00000054666 VAMP3   CCDS88.1    NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  112 2704    NA  NA  NA  NA  0.009   0   0   0.418   -0.242  -0.522  726 NA  NA  NA  NA  0   0   0   3   1   0   14  1   0   0   1   0   0   0   22  0   0   0   0   0   1   1   4   0   0   NA  NA  5.52    -11 NA  NA  20.4013 3.22673 13.621  2.38936 11.7271 2.25561 9.94895 2.15059 16.5529 2.79938 11.0724 2.29032 12.2962 2.07181 32.6588 8.63119 15.114  2.76883 7.39549 2.14311 14.1811 3.08082 0.603948    0.246907    0.55734 0.16905 NA  9   1   1   15  3   5   174 35  68  1667    NA  NA  NA  2   4   0.049024    1.923
1   7785635 T   C   SNV 0   Transcript  INTRONIC    2   intron  0.483443709 0.053333333 NA  NA  NA  NA  NA  NA  ENSG00000049246 ENST00000613533 PER3    CCDS72695.1 12:00:00 AM NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  112 2704    NA  NA  NA  NA  0.009   0   0   0.418   -0.242  -0.522  726 NA  NA  NA  NA  0   0   0   3   1   0   14  1   0   0   1   0   0   0   22  0   0   0   0   0   1   1   4   0   0   NA  NA  5.52    -11 NA  NA  20.4013 3.22673 13.621  2.38936 11.7271 2.25561 9.94895 2.15059 16.5529 2.79938 11.0724 2.29032 12.2962 2.07181 32.6588 8.63119 15.114  2.76883 7.39549 2.14311 14.1811 3.08082 0.603948    0.246907    0.55734 0.16905 NA  9   1   1   15  3   5   174 35  68  1667    NA  NA  NA  2   4   0.049024    1.923
1   7803233 C   T   SNV 0   Transcript  INTRONIC    2   intron  0.331125828 0.013333333 NA  NA  NA  NA  NA  NA  ENSG00000049246 ENST00000613533 PER3    CCDS72695.1 12:00:00 AM NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  182 726 NA  NA  NA  NA  0.014   0   0   -0.553  -1.498  -0.938  673 NA  NA  NA  NA  0   0   0   6   0   0   23  5   0   0   0   0   0   0   14  0   0   0   0   0   0   0   0   0   0   NA  NA  7.49    -15 NA  NA  4.36329 1.02663 4.55863 1.4118  4.72226 1.51608 6.80823 2.09997 7.44497 2.86816 5.71457 2.35876 3.06623 0.62198 18.3251 3.23263 2.1423  0.84413 8.63178 2.70111 6.29127 1.59229 0.198671    0.048037    0.0465  0.01705 NA  6   1   1   15  2   2   134 26  39  1314    NA  NA  NA  NA  NA  -0.395046   0.067
1   7808665 T   C   SNV 0   Intergenic  DOWNSTREAM  1   downstream  0.344370861 0   NA  NA  NA  NA  NA  NA  ENSG00000236266 ENST00000451646 Z98884.1    NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  5614    1683    NA  NA  NA  NA  0.082   0   0   0.463   -0.365  -0.373  659 NA  NA  NA  NA  0   0   0   5   3   1   24  0   0   0   0   0   0   0   15  0   0   0   0   0   0   0   0   0   0   NA  NA  5.23    -10.5   NA  NA  7.16527 1.57568 5.63104 1.29085 5.96112 1.41329 8.31159 2.11434 4.41828 1.14843 5.03919 1.48679 3.91787 1.13788 4.97324 1.34708 5.22225 1.10759 7.38244 1.40721 11.4505 2.73652 0.977252    0.19269 0.09436 0.03409 NA  43  1   0   10  3   2   110 30  49  1288    NA  NA  NA  7   26  0.11875 2.796
1   7808665 T   C   SNV 0   Transcript  INTRONIC    2   intron  0.344370861 0   NA  NA  NA  NA  NA  NA  ENSG00000049246 ENST00000613533 PER3    CCDS72695.1 12:00:00 AM NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  5614    1683    NA  NA  NA  NA  0.082   0   0   0.463   -0.365  -0.373  659 NA  NA  NA  NA  0   0   0   5   3   1   24  0   0   0   0   0   0   0   15  0   0   0   0   0   0   0   0   0   0   NA  NA  5.23    -10.5   NA  NA  7.16527 1.57568 5.63104 1.29085 5.96112 1.41329 8.31159 2.11434 4.41828 1.14843 5.03919 1.48679 3.91787 1.13788 4.97324 1.34708 5.22225 1.10759 7.38244 1.40721 11.4505 2.73652 0.977252    0.19269 0.09436 0.03409 NA  43  1   0   10  3   2   110 30  49  1288    NA  NA  NA  7   26  0.11875 2.796
1   7827519 C   G   SNV 0   CodingTranscript    NON_SYNONYMOUS  7   missense    0.529801325 0.066666667 NA  NA  NA  NA  P   A   ENSG00000049246 ENST00000613533 PER3    CCDS72695.1 NA  18/22   2854    0.45172523  2590    0.712909441 864 0.714049587 lcompl  NA  NA  177 17277   tolerated   0.05    benign  0.127   0.041   0   0   -0.553  -0.852  0.026   525 NA  NA  NA  NA  1   0   0   3   0   2   8   9   1   1   1   0   0   1   2   6   1   2   9   0   0   0   0   1   0   NA  NA  12.1    -24.2   NA  NA  8.89687 3.01407 58.9843 24.0334 58.3619 18.9077 55.4967 17.2149 10.5523 3.06178 87.6613 48.8498 8.66388 2.84705 31.4762 9.05454 11.8069 3.99886 8.7429  2.26128 72.4647 18.4371 1.08886 0.638979    2.10021 1.18017 27  2   2   1   19  4   8   204 31  59  1420    Promoter    NA  NA  86  94  0.346155    6.007
1   7827519 C   G   SNV 0   Intergenic  UPSTREAM    1   upstream    0.529801325 0.066666667 NA  NA  NA  NA  NA  NA  ENSG00000236266 ENST00000451646 Z98884.1    NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  177 17277   NA  NA  NA  NA  0.041   0   0   -0.553  -0.852  0.026   525 NA  NA  NA  NA  1   0   0   3   0   2   8   9   1   1   1   0   0   1   2   6   1   2   9   0   0   0   0   1   0   NA  NA  12.1    -24.2   NA  NA  8.89687 3.01407 58.9843 24.0334 58.3619 18.9077 55.4967 17.2149 10.5523 3.06178 87.6613 48.8498 8.66388 2.84705 31.4762 9.05454 11.8069 3.99886 8.7429  2.26128 72.4647 18.4371 1.08886 0.638979    2.10021 1.18017 NA  2   2   1   19  4   8   204 31  59  1420    Promoter    NA  NA  86  94  0.346155    6.007
1   7827519 C   G   SNV 0   RegulatoryFeature   REGULATORY  4   regulatory  0.529801325 0.066666667 NA  NA  NA  NA  NA  NA  NA  ENSR00000000832 NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  177 17277   NA  NA  NA  NA  0.041   0   0   -0.553  -0.852  0.026   525 NA  NA  NA  NA  1   0   0   3   0   2   8   9   1   1   1   0   0   1   2   6   1   2   9   0   0   0   0   1   0   NA  NA  12.1    -24.2   NA  NA  8.89687 3.01407 58.9843 24.0334 58.3619 18.9077 55.4967 17.2149 10.5523 3.06178 87.6613 48.8498 8.66388 2.84705 31.4762 9.05454 11.8069 3.99886 8.7429  2.26128 72.4647 18.4371 1.08886 0.638979    2.10021 1.18017 NA  2   2   1   19  4   8   204 31  59  1420    Promoter    NA  NA  86  94  0.346155    6.007
1   7828155 A   G   SNV 0   Intergenic  UPSTREAM    1   upstream    0.364238411 0.066666667 NA  NA  NA  NA  NA  NA  ENSG00000236266 ENST00000451646 Z98884.1    NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  813 17022   NA  NA  NA  NA  0.009   0   0   -0.389  -0.735  -0.731  522 NA  NA  NA  NA  0   0   0   4   0   0   20  4   1   0   0   0   0   0   14  1   0   0   3   0   0   0   0   1   0   NA  NA  4.56    4.56    1   0.12    10.0753 2.35506 38.5512 20.107  21.923  10.3608 21.217  11.8934 5.61317 1.38406 9.74608 6.16783 3.76905 1.10216 24.6436 5.18488 14.8421 7.93141 4.56698 1.13989 18.7058 4.31099 0.500167    0.211141    0.16854 0.06818 NA  20  2   0   14  4   4   159 34  57  1421    NA  NA  NA  11  14  0.225659    4.402

Here are lines of New.vcf

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO
1   3362704 rs11807862  T   A   923.01  PASS    "BaseCounts=31,0,0,30;BaseQRankSum=-0.108;DB;Dels=0;FS=3.561;GC=61.35;HaplotypeScore=1.7256;MQ=60;MQ0=0;MQRankSum=-0.368;QD=15.13;ReadPosRankSum=0.498;DP=282;AF=0.5;MLEAC=1;MLEAF=0.5;AN=14;AC=7"
1   7785635 rs228729    T   C   2294.01 PASS    "BaseCounts=0,44,0,0;DB;Dels=0;FS=0;GC=42.39;HaplotypeScore=0;MQ=60;MQ0=0;QD=28.13;BaseQRankSum=2.114;MQRankSum=-1.268;ReadPosRankSum=-0.548;DP=1430;AF=0.5;MLEAC=1;MLEAF=0.5;AN=70;AC=51"
1   7803233 rs228642    C   T   2082.01 PASS    "BaseCounts=0,19,0,19;BaseQRankSum=-0.963;DB;Dels=0;FS=2.884;GC=44.89;HaplotypeScore=0.9999;MQ=60;MQ0=0;MQRankSum=0.058;QD=14.92;ReadPosRankSum=0.409;DP=1468;AF=0.5;MLEAC=1;MLEAF=0.5;AN=62;AC=44"
1   7808665 rs228666    T   C   1925.01 PASS    "BaseCounts=0,36,0,26;BaseQRankSum=0.064;DB;Dels=0;FS=0.979;GC=30.42;HaplotypeScore=1.7333;MQ=60;MQ0=0;MQRankSum=-0.82;QD=18.03;ReadPosRankSum=-1.32;DP=939;AF=0.5;MLEAC=1;MLEAF=0.5;AN=42;AC=25"
1   7827519 rs228697    C   G   786.01  PASS    "BaseCounts=0,14,24,0;BaseQRankSum=0.016;DB;Dels=0;FS=4.925;GC=58.35;HaplotypeScore=0;MQ=60;MQ0=0;MQRankSum=-0.698;QD=18.63;ReadPosRankSum=0.99;DP=355;AF=0.5;MLEAC=1;MLEAF=0.5;AN=18;AC=9"
1   7828155 rs2859388   A   G   2385.01 PASS    "BaseCounts=0,0,56,0;DB;Dels=0;FS=0;GC=35.41;HaplotypeScore=0;MQ=60;MQ0=0;QD=24.91;BaseQRankSum=-0.231;MQRankSum=0.948;ReadPosRankSum=-0.128;DP=1136;AF=0.5;MLEAC=1;MLEAF=0.5;AN=46;AC=31"
1   7830057 rs2640909   T   C   1421.01 PASS    "BaseCounts=0,19,0,19;BaseQRankSum=1.051;DB;Dels=0;FS=5.041;GC=56.11;HaplotypeScore=0.734;MQ=60;MQ0=0;MQRankSum=0.496;QD=16.61;ReadPosRankSum=-0.526;DP=638;AF=0.5;MLEAC=1;MLEAF=0.5;AN=32;AC=19"
1   11107089    rs12139042  G   A   1668.01 PASS    "BaseCounts=43,0,0,0;DB;Dels=0;FS=0;GC=45.64;HaplotypeScore=0.734;MQ=60;MQ0=0;QD=29.7;BaseQRankSum=-1.652;MQRankSum=0.027;ReadPosRankSum=-1.192;DP=354;AF=0.5;MLEAC=1;MLEAF=0.5;AN=18;AC=10"
1   11787392    rs3737967   G   A   719.01  PASS    "BaseCounts=23,0,23,0;BaseQRankSum=-0.475;DB;Dels=0;FS=4.566;GC=61.85;HaplotypeScore=0.734;MQ=60;MQ0=0;MQRankSum=-0.84;QD=15.63;ReadPosRankSum=0.329;DP=378;AF=0.5;MLEAC=1;MLEAF=0.5;AN=20;AC=10"
1   11790870    rs2274976   C   T   777.01  PASS    "BaseCounts=0,18,0,24;BaseQRankSum=-0.042;DB;Dels=0;FS=4.677;GC=56.11;HaplotypeScore=0.6651;MQ=60;MQ0=0;MQRankSum=1.204;QD=15.05;ReadPosRankSum=0.836;DP=355;AF=0.5;MLEAC=1;MLEAF=0.5;AN=20;AC=10"
1   11792243    rs1476413   C   T   1751.01 PASS    "BaseCounts=1,18,0,21;BaseQRankSum=1.028;DB;Dels=0;FS=0;GC=56.11;HaplotypeScore=1.7287;MQ=60;MQ0=0;MQRankSum=-0.408;QD=16.65;ReadPosRankSum=-0.099;DP=954;AF=0.5;MLEAC=1;MLEAF=0.5;AN=50;AC=29"
1   11794400    rs4846051   G   A   2616.01 PASS    "BaseCounts=46,0,0,0;DB;Dels=0;FS=0;GC=59.35;HaplotypeScore=6.2573;MQ=60;MQ0=0;QD=31.75;DP=1654;AF=1;MLEAC=2;MLEAF=1;AN=78;AC=78"
1   11794419    rs1801131   T   G   2028.01 PASS    "BaseCounts=0,1,21,21;BaseQRankSum=-0.117;DB;Dels=0;FS=9.995;GC=59.35;HaplotypeScore=2.4328;MQ=60;MQ0=0;MQRankSum=1.03;QD=14.84;ReadPosRankSum=0.665;DP=1176;AF=0.5;MLEAC=1;MLEAF=0.5;AN=54;AC=33"
$\endgroup$
9
  • $\begingroup$ The error complains about the parenthesis "(" $\endgroup$
    – benn
    Commented Dec 4, 2018 at 10:42
  • $\begingroup$ If I remove "(" parathesis, this gives me error of 4: c.rsids.sh: cannot open cut: No such file $\endgroup$
    – Sarah
    Commented Dec 4, 2018 at 10:51
  • $\begingroup$ Try to write a pipe with cut followed by paste command, see manual for paste command here. $\endgroup$
    – benn
    Commented Dec 4, 2018 at 10:53
  • $\begingroup$ I have used this command cut -f 2,125 CADD.tsv | paste fileA but it gives me only first two columns which are 1 and 2. $\endgroup$
    – Sarah
    Commented Dec 4, 2018 at 10:59
  • 1
    $\begingroup$ My first guess is that the script isn't being run by bash. What operating system are you using? What exact command do you use to launch the script? Also, both of your files have headers which are not the same so should be skipped when pasteing. $\endgroup$
    – terdon
    Commented Dec 4, 2018 at 12:12

1 Answer 1

5
$\begingroup$

Your problem is that you have written a script in bash but are then running it using sh. Bash, the Bourne-again shell, is not the same as the Bourne shell (sh). What is more, on Ubuntu, sh is actually not even the Bourne shell but another minimal shell called dash. The /bin/sh on Ubuntu is a symlink to dash:

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar  1  2018 /bin/sh -> dash

Dash is a POSIX compliant shell which means it has the features defined by the POSIX specification for the sh shell. In your case, the problem is caused by the fact that the <() input redirection construct is supported by bash but not by dash. So, in order to run your script, you can do one of two things:

  1. Make the script executable (chmod a+x cadd.rsids.sh), and then run it directly:

    /path/to/cadd.rsids.sh
    

    This is the simplest approach since you already have the shebang line (#!/bin/bash) which will cause the script to be run by bash and not sh.

  2. Run the script with bash instead of sh:

    bash /path/to/cadd.rsids.sh
    

    Instead of

    sh /path/to/cadd.rsids.sh
    
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.