简体   繁体   中英

Why do my Bash scripts stop?

Bellow is a Bash script that I create and execute through java. It utilises several different scripts to produce statistics for RNA-Seq data. My problem is that when the script is executed it reaches the second stage of the script before the processes stops (the program does not error out, the required programs just stop processing). I have tried running the created script separately from the command line and it completes with no errors. An suggestions would be appreciated.

 String Trans_ref = 
"#!/bin/bash \n" +
"mkdir -p "+Output+"/"+Sample+"_RSEM \n" +
"cd "+Output+"/"+Sample+"_RSEM \n" +
"PATH=$PATH:"+RSEMprep+" \n" +
"export PATH=$PATH \n" + 
""+RSEMprep+"/rsem-prepare-reference --no-polyA --bowtie "+Output+"/Trans_CDHIT.fast Trans_CDHIT.RSEM \n" +    
""+RSEMprep+"/rsem-calculate-expression --paired-end -p "+CPU+" "+Output+"/SRR617145_1.fastq "+Output+"/SRR617145_2.fastq Trans_CDHIT.RSEM Trans_CDHIT.genes.results  \n"+
""+Trinprep+"/util/misc/count_features_given_MIN_FPKM_threshold.pl "+Output+"/"+Sample+"_RSEM/RSEM.genes.results > "+Output+"/"+Sample+"_RSEM/cumul_counts.txt \n"+
""+Trinprep+"/util/filter_fasta_by_rsem_values.pl --rsem_output= "+Output+"/"+Sample+"_RSEM/RSEM.isoforms.results --fasta="+Output+"/Trans_CDHIT.fasta -t 100 --output="+Output+"/"+Sample+"_RSEM/Trans_RSEMfilters.fasta \n" +
""+Trinprep+"/util/bowtie_PE_separate_then_join.pl --seqType fq --left "+Output+"/"+Sample+"_1.fasta --right "+Output+"/"+Sample+"_2.fasta --target "+Output+"/Trans_CDHIT.fasta --aligner bowtie --SS_lib_type FR -- -p 4 --all --best --strata -m 300 \n";  


    System.out.println(Trans_ref);

    FileUtils.writeStringToFile(new File(Output+"/TranRSEM"), Trans_ref);
    StringBuffer Trim = new StringBuffer();

    String cmd = (Output+"/TranRSEM");


Process p;

try{
    p = Runtime.getRuntime().exec(new String[]{"/bin/sh","-c", cmd});

    p.waitFor();

    BufferedReader reader1 = 
                    new BufferedReader(new InputStreamReader(p.getInputStream()));

        System.out.println("Merg Finished");

    } catch (Exception e) {
    e.printStackTrace();


    }

To All

Thankyou very much for your comments

I managed to solve the problem. I discovered it was a java memory limitation. I solved this by using the Xmx20000m command in the project properties in my IDE (netbeans).

this appears to have solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM