Error message when using samtools view
2
0
Entering edit mode
16 months ago
Shin Taguchi ▴ 40

Hi, every one.

I ran the following command.

samtools view input.bam scaffold_list > subset_reads.sam

I then received the following error message.

[main_samview] region "scaffold_list" specifies an invalid region or unknown reference. Continue anyway.

The contents of "scaffold_list" are as follows.

scaffold_71345
scaffold_71293
scaffold_71300
scaffold_71309
scaffold_71272
scaffold_71267
scaffold_71292
scaffold_71262
scaffold_71282

I ran the following command to check the scaffold name and found no mistakes.

samtools view -H input.bam

I would like to know how to resolve this error.

Thank you.

samtools • 885 views
ADD COMMENT
0
Entering edit mode
16 months ago

You cannot give a file as an coordinate argument. It must ne a coordinate like "chr1:22344-678344"

Otherwise you can use the options -L and -M. See the manual.

ADD COMMENT
0
Entering edit mode

Thank you for always replying to my questions! I will refer to your advice.

ADD REPLY
0
Entering edit mode
16 months ago
ATpoint 85k
cat scaffold_list | xargs samtools view -o out.bam in.bam

Output only contains alignments on those scaffolds.

ADD COMMENT
0
Entering edit mode

Thank you for your reply. It is very helpful.

ADD REPLY

Login before adding your answer.

Traffic: 2338 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6