calling perl script in bash to execute -
below how call perl
script in bash
function: getting: c:\cygwin\home\cmccabe\bashparse.sh: line 156: c:\users\cmccabe\desktop\annovar\ matrix.pl: command not found
so must calling incorrectly.
i provide full path .pl , input , output
perl -e 'c:\users\cmccabe\desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt > "l:\ngs\3_business\matrix\torrent\matrix_"${id}".txt"
the overall goal use ${id}.txt.hg19_multianno.txt
input file , after perl
script run on file (which adds columns , text , new file saved path l:\ngs\3_business\matrix\torrent\matrix_${id}.txt
. path static path , never change, there better way not expert enough know. thank :).
here perl
script
#!/bin/perl # format matrix import use warnings; use strict; ($debug); $debug = 0; $debug = 1; while (<>) { chomp; if ( $. == 1 ) { s/$/ index/; if ( $. == 2 ) { s/$/ chromosome position/; if ( $. == 3 ) { s/$/ gene/; if ( $. == 4 ) { s/$/ inheritance/; if ( $. == 5 ) { s/$/ rna accession/; if ( $. == 6 ) { s/$/ chr/; if ( $. == 7 ) { s/$/ coverage/; if ( $. == 8 ) { s/$/ score/; if ( $. == 9 ) { s/$/ a(#f#r)/; if ( $. == 10 ) { s/$/ c(#f#r)/; if ( $. == 11 ) { s/$/ g(#f#r)/; if ( $. == 12 ) { s/$/ t(#f#r)/; if ( $. == 13 ) { s/$/ ins(#f#r)/; if ( $. == 14 ) { s/$/ del(#f#r)/; if ( $. == 15 ) { s/$/ snp db_xref/; if ( $. == 16 ) { s/$/ mutation call/; if ( $. == 17 ) { s/$/ mutation allele frequency/; if ( $. == 18 ) { s/$/ amino acid change/; if ( $. == 43 ) { s/$/ hp/; if ( $. == 44 ) { s/$/ splice/; if ( $. == 45 ) { s/$/ pseudogene/; if ( $. == 46 ) { s/$/ classification/; if ( $. == 47 ) { s/$/ hgmd/; if ( $. == 48 ) { s/$/ disease/; if ( $. == 49 ) { s/$/ sanger/; if ( $. == 50 ) { s/$/ references/; } print "$_\n"; } print stderr " ( lines read: $. )\n"; exit(0);
the -e
command-line option takes literal perl code argument. not take file name. example:
perl -e 'print("hello, world!\n");';
if want run script, omit -e
:
perl myscript.pl;
thus, command work if run follows:
perl 'c:\users\cmccabe\desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt > "l:\ngs\3_business\matrix\torrent\matrix_"${id}".txt"
Comments
Post a Comment