Error: cannot open file 2 for reading From Cufflinks Version 2.2.1 When Attempting To Use CuffDiff
1
0
Entering edit mode
12 months ago
Y • 0

I am trying to use CuffDiff (from Cufflinks version 2.2.1) on 3 controls and 3 experimental samples. The variables used and the main section of code in a bash script is below:

The variables that are predefined:

  • bam_directory is the path to the 3 controls and 3 experimental .bam containing folder
  • output_directory is the path to the output folder
  • reference_genome path to the Danio_rerio GRCz11soft masked primary assembly fasta file (from Ensembl)
  • annotation_gtf is the path to the Danio_rerio GRCz11.110 gtf file (from Ensembl)
  • num_threads is set to an arbitrary number, I set it to 10 but it can be any other number

The main section of code that is giving the error:

control_bams=($(find "${bam_directory}" -type f -name "Control*.bam"))
experimental_bams=($(find "${bam_directory}" -type f -name "Experimental*.bam"))

cuffdiff -u "${annotation_gtf}" \
    -o "${output_directory}" \
    -b "${reference_genome}" \
    -p "${num_threads}" \
    --FDR 0.05 \
    --verbose 2 \
    -no-update-check \
    --library-type fr-firststrand \
    "${control_bams[*]}" \
    "${experimental_bams[*]}"

Yet I keep getting the error:

open: No such file or directory Error: cannot open file 2 for reading. Unrecognized file type

The files are .bam files. The .gtf has been used before without any issues.The fasta has been used before without any issues why is it giving this error. The paths have be quadruple checked and I think they are correct.

CuffDiff Bash Cufflinks • 1.0k views
ADD COMMENT
0
Entering edit mode
12 months ago

how about simply trying:

cuffdiff -u "${annotation_gtf}" \

-o "${output_directory}" \
-b "${reference_genome}" \
-p "${num_threads}" \
--FDR 0.05 \
--verbose 2 \
-no-update-check \
--library-type fr-firststrand \
`find "${bam_directory}" -type f -name "Control*.bam" | paste -s -d,` \
`find "${bam_directory}" -type f -name "Experimental*.bam"| paste -s -d,`
ADD COMMENT
0
Entering edit mode

I did not use the space between the -u flag and the -o flag (the blank line) but I did do what you recommended:

# Run CuffDiff with FDR control and verbosity
cuffdiff -u "${annotation_gtf}" \
    -o "${output_directory}" \
    -b "${reference_genome}" \
    -p "${num_threads}" \
    --FDR 0.05 \
    --verbose 2 \
    -no-update-check \
    --library-type fr-firststrand \
    `find "${bam_directory}" -type f -name "Control*.bam" | paste -s -d,` \
    `find "${bam_directory}" -type f -name "Experimental*.bam"| paste -s -d,`

This gives me the same error:

open: No such file or directory
Error: cannot open file 2 for reading. Unrecognized file type.

It is still the same issue.

ADD REPLY
1
Entering edit mode

then test each files.

    find "${bam_directory}" -type f -name "*.bam" | xargs samtools quickcheck

   file "${reference_genome}"
ADD REPLY
0
Entering edit mode

I tried the commands you recommended in the bash/command line. When I tried find "${bam_directory}" -type f -name "*.bam" | xargs samtools quickcheck and nothing printed to this screen so I tried a modified version (just as a check) shown below after cd into the bam directory:

for bam_file in *.bam; do
    echo "Checking $bam_file"
    samtools quickcheck "$bam_file"
done

It checked each file and then no error was printed to the screen.

I tried the other command you recommended:

reference_genome="/path/not/given/due/to/HPC/rules/Danio_rerio.GRCz11_soft_masked_primary_assembly_from_Ensembl.fa
file "${reference_genome}"

And this gave an output that was /path/not/given/due/to/HPC/rules/Danio_rerio.GRCz11_soft_masked_primary_assembly_from_Ensembl.fa: ASCII text

I think the error is associated with the .gtf file but I have used the .gtf before and not had any issue.

So I tried (after giving it the path to the annotation_gtf in command line :

file "${annotation_gtf}"

And it give me the output:

/path/to/annotation/gtf/not/given/due/to/HPC/rules/Danio_rerio.GRCz11.110_from_Ensembl_.chr.gtf: ASCII text, with very long lines

but that doesn't help me with why my error is occurring.

ADD REPLY
0
Entering edit mode

I figured out how to make it work. The bams have to be comma separated not just by space:

cd "${input_directory_with_associated_bam_files}"

cuffdiff -o ${output_directory_path} \
    ${annotation_gtf_path} \
    --library-type fr-firststrand \
    Control1.bam,Control2.bam,Control3.bam \
    Experiment1.bam,Experiment2.bam,Experiment3.bam

It seems that --library-type and the path to the gtf are the only paths that need to be defined other than the .bam in the input directory containing the bams. While this does not have all the options I had before it does work once:

  1. , instead of space is used between the specified .bam files
  2. I removed -u and just specified the gtf path
  3. Placed the -o plus the output directory path right at the top next to the cuffdiff command

    There will be ways to make this more elegant or easier to use but I did get this as a work around and I wanted to put it up for anyone else who can benefit from it.

ADD REPLY

Login before adding your answer.

Traffic: 1305 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