i am tiring to perform PDF file encryption using pdftk and installed the dependency modules of PDF::Tk [Perl integration for the pdf toolkit (pdftk)] , but getting error as mentioned below. Can any one please help me in resolving the below issue.
Source code: test.pl
use PDF::Tk;
system(pdftk input.pdf output outPDF.pdf owner_pw foopass) or die "Error!!!!!!!!!!\n";
output:
Can't locate object method "pdftk" via package "input" (perhaps you forgot to load "input"?) at test.pl line 2.
use PDF::Tk module functions instead the system. PDF::Tk is a wrapper over the pdftk utility, so using system is the topic it avoids:
use PDF::Tk;
my $doc=PDF::Tk->new();
$doc->call_pdftk('input.pdf', 'outPDF.pdf', 'owner_pw', 'foopass');
Note: The PDF::Tk constructor could be used to set the pdftk binary. It defaults value is "/usr/bin/pdftk"
my $doc=PDF::Tk->new({pdftk=>'/other/path/to/bin/pdftk'});
Related
I am very new to coding so I'm not really sure how to approach this. I wanted to look at some data that we got and sequence them using Bismark. I already used Trim Galore to pare the reads, now I wanted to get the data into Bismark. However, I'm not exactly sure how to approach this. In the documentation it said that it required Perl to run so I downloaded Perl along with the Bismark zip file from github. I also downloaded the bowtie2 zip file and extracted both the zip files into the same directory. I then opened up the Perl command prompt and set the directory to one with my extracted folders.
I put this line in:
> \bismark\bismark_genome_preparation --path_to_bowtie ^
C:\Users\sevro\Documents\Lab_Code\bowtie2-master --verbose ^
C:\Users\sevro\Documents\Lab_Code\genome
The system cannot find the path specified.
I also tried this after changing the directory to the Bismark folder:
> perl bismark
Failed to execute Bowtie 2 porperly (return code of 'bowtie2 --version' was 256).
Please install Bowtie 2 or HISAT2 first and make sure it is in the PATH,
or specify the path to the Bowtie 2 with --path_to_bowtie2 /path/to/bowtie2,
or --path_to_hisat2 /path/to/hisat2
I tried a few other things but all in all I am a bit confused on how exactly to approach this. Things I have downloaded right now:
Bismark zip file- https://github.com/FelixKrueger/Bismark
Bowtie2 zip file- https://github.com/BenLangmead/bowtie2
A genome assembly in .fa format
The data that I want to analyze in fasta format
Any insight would be helpful.
I think Bismark and bowtie2 only supports Linux and macOS natively. If you want to use bismark on Windows you can try install it via a *nix emulation systems like Cygwin, MSYS2, or simply use WSL. I tested this on Windows 11 with WSL with Ubuntu 20.04:
Downloaded bowtie2-2.4.4-linux-x86_64.zip and extracted to ~/bowtie2/bowtie2-2.4.4-linux-x86_64 folder.
Downloaded Bismark-0.23.1.zip and extracted to ~/bismark/Bismark-0.23.1/
Tested installation:
$ perl --version
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi (with 50 registered patches, see perl -V for more detail)
$ perl bismark --path_to_bowtie2 ../../bowtie2/bowtie2-2.4.4-linux-x86_64/Bowtie 2 seems to be working fine (tested command '../../bowtie2/bowtie2-2.4.4-linux-x86_64/bowtie2 --version' [2.4.4])
Output format is BAM (default)
Did not find Samtools on the system. Alignments will be compressed with GZIP instead (.sam.gz)
Genome folder was not specified!
DESCRIPTION
The following is a brief description of command line options and arguments to control the Bismark
bisulfite mapper and methylation caller. Bismark takes in FastA or FastQ files and aligns the
reads to a specified bisulfite genome. Sequence reads are transformed into a bisulfite converted forward strand
version (C->T conversion) or into a bisulfite treated reverse strand (G->A conversion of the forward strand).
Each of these reads are then aligned to bisulfite treated forward strand index of a reference genome
(C->T converted) and a bisulfite treated reverse strand index of the genome (G->A conversion of the
forward strand, by doing this alignments will produce the same positions). These 4 instances of Bowtie 2 or HISAT2
are run in parallel. The sequence file(s) are then read in again sequence by sequence to pull out the original
sequence from the genome and determine if there were any protected C's present or not.
The final output of Bismark is in BAM/SAM format by default, described in more detail below.
USAGE: bismark [options] <genome_folder> {-1 <mates1> -2 <mates2> | <singles>}
[...]
I have a customized perl module(Modulehere) that take xls sheet and parsing it.
I tried to run that from commandline itself like:
perl -I /home/suser/modules -e "use Modulehere;Modulehere::load_it('/tmp/test.xls')"
But it gives the error like:
Can't open perl script "–e": No such file or directory
Please help!
It works on my machines (OS X and Linux) but looking at the documentation (man perlrun)
-Idirectory
Directories specified by -I are prepended to the search path for modules (#INC).
There is no space between -I and the directory. Maybe your Perl version is being to strict and considering everything after the space as a script file.
When I try to execute the following lcov command through Plink (I give Plink a text file as an argument containing the following command)
lcov --capture --directory . --output-file coverage.info
it results with
GNU gcov version 1.5 Capturing coverage data from .
Scanning . for .da files ... gcov [-b] [-v] [-n] [-l] [-f] [-o OBJDIR] file geninfo: Use of uninitialized value in pattern match
(m//) at /home/myUser/lcov/lcov/usr/bin/geninfo line 1874. gcov [-b]
[-v] [-n] [-l] [-f] [-o OBJDIR] file geninfo: Use of uninitialized
value in pattern match (m//) at /home/myUser/lcov/lcov/usr/bin/geninfo
line 3622. geninfo: Use of uninitialized value in pattern match (m//)
at /home/myUser/lcov/lcov/usr/bin/geninfo line 3622.
geninfo: ERROR: no .da files found in .!
It seems that the geninfo expects for .da files instead of .gcda files.
when I execute the same command without Plink (in the same CWD), the lcov runs fine and generates a valid .info file. It also runs fine when I execute it manually thorugh PuTTY.
what might be the reason for this?
The problem was more general. Plink uses different environment variables. The solution was to set manually the correct environment variables. In my case I run perl script so I added in the head of the file:
use Env;
$ENV{PATH} = "correct PATH variable";
a missing environment variable caused the code to get wrong gcov version and therefore .da files were serached instead of .gcda files that belong to newer lcov versions
Upgrading lcov version to latest solved the issue. Older version of lcov searches .da instead of .gcda. Updating to latest version 1.13 solves the issue
Setup:
Windows 7 Enterprise.
Matlab 7.10.0 (R2010a).
mcc compiler: Microsoft Visual C++ 2008 Express.
What's happening:
My project runs fine when running it through Matlab, but when trying to run the .exe through the command prompt after using mcc to compile, the command prompt generates an error.
The mcc command I issue is:
mcc -m -v STARTUP1.m -o EXE_REDUC
The error I receive in the command prompt is:
??? Error using ==> textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
I have a file called LoadXLS.m that loads and reads a .csv file using:
fid = fopen(file,'r');
temp_data = textscan(fid,...args...);
And then I process temp_data.
The csv file I'm trying to load is called spec.csv. It is located two directories down from where I have STARTUP1.m stored. The location of STARTUP1.m is also the place that the mcc generated files are stored to. I have used the pathtool to "Add with subfolders" this location, but am aware that those locations are not transferred to mbuild when compiling.
What I've Tried:
I have gone in and added print statements to print the value of fid to make sure it is valid. When I run it in Matlab, it has a valid value, however when I run in the command prompt it always returns an invalid value of -1.
I have removed all addpath() calls, I have tried adding the STARTUP1.m directory to the mcc ctf archive using:
mcc -m -v -a 'C:\Users\...path...\STARTUP1.m_location' STARTUP1.m -o EXE_REDUC;
However when I do this, I get a different error when running in the command prompt:
Cannot open CTF archive file
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296'
or
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296.zip'
??? Undefined function or variable 'matlabrc'.
To fix this, I've tried adding the pragma
%#function matlabrc
to the top of STARTUP1.m to try and enforce its inclusion, but had no success.
I also copied the spec.csv file to a new directory in the ctfroot and changed
fid = fopen(...)
to:
[tempFile, message] = fopen(fullfile(ctfroot, 'Added Config Files', ad.spec_file));
The message is:
message is: No such file or directory
Objective:
Rearranging file locations is a sufficient workaround while the exectuable only runs on my computer, however the idea is to take this standalone and distribute it to multiple people on many different computers. I would like to be able to have a top folder with a startup file and within this folder, have as many subfolders as the package requires. The startup file should be able to access all subfolders and files within them as necessary.
I read something about the exectuable actually running from a "secret location" on the machine here: http://matlab.wikia.com/wiki/FAQ
I would just like to be able to group one entire folder tree with all its files into a package containing the executable and be able to run it anywhere.
More info:
When I put the spec.csv file in the same directory as STARUTP1.m, it finds it fine using mcc without the -a 'path' option and using the following in the LoadXLS.m file:
[tempFile, message] = fopen(ad.spec_file,'r');
This project contains GUIs, generates PDFs, generates plots, and also creates a zip directory.
Thank you in advance.
I am converting XML to PDF using Apache. I am executing the FOP command line as batch file( since the input file will be vary) from Perl as like below:
Creating Batch file:
open (OUT2, '>', 'c:\test\fop-1.0\run.bat');
print OUT2 "cd\\\ncd c:\\test\\fop-1\.0\\\n C:\\test\\fop-1\.0\\fop\.bat -c C:\\test\\fop-1\.0\\conf\\fop-config\.xml -xsl C:\\test\\fop-1\.0\\test.xsl -xml c:\test\document2.xml -pdf c:\test\document2.pdf";
close (OUT2);
Executing batch file using system command:
$cmd2 ="c:\\test\\fop-1.0\\test.bat";
system("$cmd2");
I am embedding the svg files in the fop. I am getting the output when I run batch file manually, but by executing from perl I am getting the following error:
org.apache.fop.image.loader.batik.PreloaderSVG$Loader ge...
Can anyone help me to resolve this problem?
Try something like
system "cmd","/c","c:\\test\\fop-1.0\\test.bat";