Я пытаюсь выполнить внешнюю программу из кода perl, а именно cutadapt (https://cutadapt.readthedocs.io/en/stable/guide.html).
Но я получаю сообщение об ошибке от cutadapt, как только добавляю; требуется, что я хочу иметь.
Все напечатанные команды работают нормально в терминале.
Мой код perl выглядит следующим образом:
#string without ;
my $cutadapt_cmd1 = '/home/USER/miniconda3/bin/cutadapt -a "GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA" --discard-untrimmed -q 20 -m 200 -o SAMPLE_NAME_401.IonXpress_0401.trim.fq IonXpress_0401_rawlib.basecaller.fq';
#string with ;
my $cutadapt_cmd2 = '/home/USER/miniconda3/bin/cutadapt -a "GAGGAAGTAAAAGTCRTAACAAGGT;required...ATCGATGAAGAACGCAGCGAA" --discard-untrimmed -q 20 -m 200 -o SAMPLE_NAME_401.IonXpress_0401.trim.fq IonXpress_0401_rawlib.basecaller.fq';
#array without ;
my @cutadapt_cmd3 = ('/home/USER/miniconda3/bin/cutadapt', '-a', 'GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA', '--discard-untrimmed' ,'-q' ,'20', '-m', '200', '-o' ,'SAMPLE_NAME_401.IonXpress_0401.trim.fq', 'IonXpress_0401_rawlib.basecaller.fq');
#array with ;
my @cutadapt_cmd4 = ('/home/USER/miniconda3/bin/cutadapt', '-a', 'GAGGAAGTAAAAGTCRTAACAAGGT;required...ATCGATGAAGAACGCAGCGAA', '--discard-untrimmed' ,'-q' ,'20', '-m', '200', '-o' ,'SAMPLE_NAME_401.IonXpress_0401.trim.fq', 'IonXpress_0401_rawlib.basecaller.fq');
#array with ; and with integers
my @cutadapt_cmd5 = ('/home/USER/miniconda3/bin/cutadapt', '-a', 'GAGGAAGTAAAAGTCRTAACAAGGT;required...ATCGATGAAGAACGCAGCGAA', '--discard-untrimmed' ,'-q' ,20, '-m', 200, '-o' ,'SAMPLE_NAME_401.IonXpress_0401.trim.fq', 'IonXpress_0401_rawlib.basecaller.fq');
#Works
print("\n\ncmd1\n\n");
system $cutadapt_cmd1;
#Fails
print("\n\ncmd2\n\n");
system $cutadapt_cmd2;
#Works
print("\n\ncmd3\n\n");
system @cutadapt_cmd3;
#Fails
print("\n\ncmd4\n\n");
system @cutadapt_cmd4;
#Fails
print("\n\ncmd5\n\n");
system @cutadapt_cmd5;
И вывод выглядит так:
cmd1
This is cutadapt 1.18 with Python 3.7.1
Command line parameters: -a GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA --discard-untrimmed -q 20 -m 200 -o SAMPLE_NAME_401.IonXpress_0401.trim.fq IonXpress_0401_rawlib.basecaller.fq
Processing reads on 1 core in single-end mode ...
Finished in 0.47 s (11 us/read; 5.67 M reads/minute).
=== Summary ===
Total reads processed: 44,086
Reads with adapters: 0 (0.0%)
Reads that were too short: 7,268 (16.5%)
Reads written (passing filters): 0 (0.0%)
Total basepairs processed: 11,458,046 bp
Quality-trimmed: 371,723 bp (3.2%)
Total written (filtered): 0 bp (0.0%)
=== Adapter 2 ===
Sequence: GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA; Type: linked; Length: 25+21; 5' trimmed: 0 times; 3' trimmed: 0 times
cmd2
Traceback (most recent call last):
File "/home/USER/miniconda3/bin/cutadapt", line 12, in <module>
sys.exit(main())
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 741, in main
pipeline = pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 614, in pipeline_from_parsed_args
adapters = adapter_parser.parse_multi(options.adapters, options.anywhere, options.front)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 335, in parse_multi
adapters.extend(self.parse(spec, cmdline_type))
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 322, in parse
yield self._parse(spec, cmdline_type, name=None)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 237, in _parse
name1, front1, sequence1, back1, parameters1 = self._parse_not_linked(spec1, 'front')
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 170, in _parse_not_linked
parameters = AdapterParser._parse_parameters(parameters_spec)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 132, in _parse_parameters
raise KeyError('Unknown parameter {}'.format(key))
KeyError: 'Unknown parameter required'
cmd3
This is cutadapt 1.18 with Python 3.7.1
Command line parameters: -a GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA --discard-untrimmed -q 20 -m 200 -o SAMPLE_NAME_401.IonXpress_0401.trim.fq IonXpress_0401_rawlib.basecaller.fq
Processing reads on 1 core in single-end mode ...
Finished in 0.50 s (11 us/read; 5.27 M reads/minute).
=== Summary ===
Total reads processed: 44,086
Reads with adapters: 0 (0.0%)
Reads that were too short: 7,268 (16.5%)
Reads written (passing filters): 0 (0.0%)
Total basepairs processed: 11,458,046 bp
Quality-trimmed: 371,723 bp (3.2%)
Total written (filtered): 0 bp (0.0%)
=== Adapter 2 ===
Sequence: GAGGAAGTAAAAGTCRTAACAAGGT...ATCGATGAAGAACGCAGCGAA; Type: linked; Length: 25+21; 5' trimmed: 0 times; 3' trimmed: 0 times
cmd4
Traceback (most recent call last):
File "/home/USER/miniconda3/bin/cutadapt", line 12, in <module>
sys.exit(main())
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 741, in main
pipeline = pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 614, in pipeline_from_parsed_args
adapters = adapter_parser.parse_multi(options.adapters, options.anywhere, options.front)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 335, in parse_multi
adapters.extend(self.parse(spec, cmdline_type))
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 322, in parse
yield self._parse(spec, cmdline_type, name=None)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 237, in _parse
name1, front1, sequence1, back1, parameters1 = self._parse_not_linked(spec1, 'front')
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 170, in _parse_not_linked
parameters = AdapterParser._parse_parameters(parameters_spec)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 132, in _parse_parameters
raise KeyError('Unknown parameter {}'.format(key))
KeyError: 'Unknown parameter required'
cmd5
Traceback (most recent call last):
File "/home/USER/miniconda3/bin/cutadapt", line 12, in <module>
sys.exit(main())
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 741, in main
pipeline = pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/__main__.py", line 614, in pipeline_from_parsed_args
adapters = adapter_parser.parse_multi(options.adapters, options.anywhere, options.front)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 335, in parse_multi
adapters.extend(self.parse(spec, cmdline_type))
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 322, in parse
yield self._parse(spec, cmdline_type, name=None)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 237, in _parse
name1, front1, sequence1, back1, parameters1 = self._parse_not_linked(spec1, 'front')
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 170, in _parse_not_linked
parameters = AdapterParser._parse_parameters(parameters_spec)
File "/home/USER/miniconda3/lib/python3.7/site-packages/cutadapt/adapters.py", line 132, in _parse_parameters
raise KeyError('Unknown parameter {}'.format(key))
KeyError: 'Unknown parameter required'
В зависимости от того, как я хочу обрабатывать свои данные, мне действительно нужно сказать cutadapt, что требуются адаптеры.