Billebaars has asked for the wisdom of the Perl Monks concerning the following question:

I'm running a Perl script from the EMBL (found here https://github.com/EMBL-EBI-GCA/reseqtrack/blob/master/scripts/variation_data/calculate_allele_frq_from_vcf.pl) Under Ubuntu 16.10 I have installed Vcftools and Tabix as is required and both have been tested to work accordingly. I execute the script with the following command:
perl /home/[user]/calculate_allele_frq_from_vcf.pl \ -vcf /home/[user]/share/1000genomesPhase3VCFFiles/ALL.chr1.phase3_shap +eit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz \ -sample_panel /home/[user]/share/1000genomesPhase3VCFFiles/integrated_ +call_samples_v3.20130502.ALL.panel \ -out_dir /home/[user]/Desktop/AlleleFrequency \ -tabix /home/[user]/tabix-0.2.6 \ -vcftools_dir /home/[user]/vcftools_0.1.13 \ -region 1:1-10000 \ -pop CEU,FIN \
This returns the following error
Smartmatch is experimental at /home/[user]/calculate_allele_frq_from_v +cf.pl line 133. Smartmatch is experimental at /home/[user]/calculate_allele_frq_from_v +cf.pl line 144. sh: 1: /home/[user]/tabix-0.2.6: Permission denied Broken VCF header, no column names? at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 172. Vcf::throw(Vcf4_2=HASH(0x55761601d320), "Broken VCF header, no col +umn names?") called at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line +866 VcfReader::_read_column_names(Vcf4_2=HASH(0x55761601d320)) called +at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 601 VcfReader::parse_header(Vcf4_2=HASH(0x55761601d320)) called at /ho +me/[user]/vcftools_0.1.13/perl/vcf-subset line 121 main::vcf_subset(HASH(0x557615b24558)) called at /home/[user]/vcft +ools_0.1.13/perl/vcf-subset line 12 Broken VCF header, no column names? at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 172. Vcf::throw(Vcf4_2=HASH(0x55fa53436f60), "Broken VCF header, no col +umn names?") called at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line +866 VcfReader::_read_column_names(Vcf4_2=HASH(0x55fa53436f60)) called +at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 601 VcfReader::parse_header(Vcf4_2=HASH(0x55fa53436f60)) called at /ho +me/[user]/vcftools_0.1.13/perl/fill-an-ac line 45 main::fill_an_ac(undef) called at /home/[user]/vcftools_0.1.13/per +l/fill-an-ac line 9 sh: 1: /home/[user]/tabix-0.2.6: Permission denied Broken VCF header, no column names? at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 172. Vcf::throw(Vcf4_2=HASH(0x5607d059a190), "Broken VCF header, no col +umn names?") called at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line +866 VcfReader::_read_column_names(Vcf4_2=HASH(0x5607d059a190)) called +at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 601 VcfReader::parse_header(Vcf4_2=HASH(0x5607d059a190)) called at /ho +me/[user]/vcftools_0.1.13/perl/vcf-subset line 121 main::vcf_subset(HASH(0x5607d00a1558)) called at /home/[user]/vcft +ools_0.1.13/perl/vcf-subset line 12 Broken VCF header, no column names? at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 172. Vcf::throw(Vcf4_2=HASH(0x556b8e952110), "Broken VCF header, no col +umn names?") called at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line +866 VcfReader::_read_column_names(Vcf4_2=HASH(0x556b8e952110)) called +at /home/[user]/vcftools_0.1.13/perl/Vcf.pm line 601 VcfReader::parse_header(Vcf4_2=HASH(0x556b8e952110)) called at /ho +me/[user]/vcftools_0.1.13/perl/fill-an-ac line 45 main::fill_an_ac(undef) called at /home/[user]/vcftools_0.1.13/per +l/fill-an-ac line 9 /home/[user]/Desktop/AlleleFrequency/calculated_fra.process3085.1.1-10 +000.CEU_FIN
It appears that the script doesn't have permission to access Tabix for some reason. I've given the folder full read/write permission for the user executing the script (me). Any ideas?

Replies are listed 'Best First'.
Re: Perl script cannot access folder
by choroba (Cardinal) on Feb 21, 2017 at 16:28 UTC
    Crossposted to StackOverflow. It's considered polite to inform about crossposting to avoid duplicate work of people not attending both sites.

    Also, see my answer there.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
      Ah, thanks for letting me know, I was unaware of this. Also, many thanks for your answer. Stupidly, I indeed didn't include the executable in the path. It works now with the correct path: /home/[user]/tabix-0.2.6/tabix
Re: Perl script cannot access folder
by stevieb (Canon) on Feb 21, 2017 at 16:52 UTC

    Is the "tabix" an application that runs under its own user account (that may not have correct permissions)? Reason I ask is it looks like something has been shelled out:

    sh: 1: /home/[user]/tabix-0.2.6

    To see if *you* have correct permissions:

    perl -E 'open my $fh, ">", "/home/[user]/tabix-0.2.6/test.txt" or die +$!'

    If you don't get a permission denied error, the problem is elsewhere. Perhaps also show the perms you do have on the dir.

    The chunk of Perl code that wraps this work may be helpful to us to troubleshoot to help as well.