0

Below is how I call the perl script in a bash function: but I am getting: c:\cygwin\home\cmccabe\bashparse.sh: line 156: C:\Users\cmccabe\Desktop\annovar\ matrix.pl: command not found

So I must be calling it incorrectly.

I provide the full path to the .pl , the input and the 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 is use ${id}.txt.hg19_multianno.txt as the input file and after the perl script is run on that file (which adds the columns and text and the new file is saved to the path L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_${id}.txt. That path is a static path and will never change, there is probably a better way but I am not expert enough to know. Thank you :).

Here is the perl script

#!/bin/perl

# format for matrix import

use warnings;
use strict;

my ($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);

1 Answer 1

2

The -e command-line option takes literal Perl code as an argument. It does not take a file name. For example:

perl -e 'print("Hello, World!\n");';

If you want to run a script, just omit the -e:

perl myscript.pl;

Thus, your command will work if you run it as follows:

perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt >     "L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_"${id}".txt"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.