鱼C论坛

 找回密码
 立即注册
查看: 4089|回复: 5

[已解决]Error: Could not find or load main class jgi.RenameReads

[复制链接]
发表于 2021-9-24 21:22:36 | 显示全部楼层 |阅读模式
60鱼币
本帖最后由 wtfitis 于 2021-9-24 22:10 编辑

这是calcmem.sh
  1. #!/bin/bash

  2. #usage(){
  3. #        echo "CalcMem v1.15"
  4. #        echo "Written by Brian Bushnell, Doug Jacobsen, Alex Copeland, Bryce Foster"
  5. #        echo "Calculates available memory in megabytes"
  6. #        echo "Last modified December 17, 2019"
  7. #}

  8. #Also parses other Java flags
  9. function parseXmx () {
  10.        
  11.         local setxmx=0
  12.         local setxms=0
  13.        
  14.         for arg in "$@"
  15.         do
  16.                 if [[ "$arg" == "Xmx="* ]] || [[ "$arg" == "xmx="* ]]; then
  17.                         z="-Xmx"${arg:4}
  18.                         setxmx=1
  19.                 elif [[ "$arg" == "-Xmx="* ]] || [[ "$arg" == "-xmx="* ]]; then
  20.                         z="-Xmx"${arg:5}
  21.                         setxmx=1
  22.                 elif [[ "$arg" == -Xmx* ]] || [[ "$arg" == -xmx* ]]; then
  23.                         #z="$arg"
  24.                         z="-X"${arg:2}
  25.                         setxmx=1
  26.                 elif [[ "$arg" == Xmx* ]] || [[ "$arg" == xmx* ]]; then
  27.                         #z="-$arg"
  28.                         z="-X"${arg:1}
  29.                         setxmx=1
  30.                 elif [[ "$arg" == -Xms* ]]; then
  31.                         z2="$arg"
  32.                         setxms=1
  33.                 elif [[ "$arg" == Xms* ]]; then
  34.                         z2="-$arg"
  35.                         setxms=1
  36.                 elif [[ "$arg" == -da ]] || [[ "$arg" == -ea ]]; then
  37.                         EA="$arg"
  38.                 elif [[ "$arg" == da ]] || [[ "$arg" == ea ]]; then
  39.                         EA="-$arg"
  40.                 elif [[ "$arg" == ExitOnOutOfMemoryError ]] || [[ "$arg" == exitonoutofmemoryerror ]] || [[ "$arg" == eoom ]]; then
  41.                         EOOM="-XX:+ExitOnOutOfMemoryError"
  42.                 elif [[ "$arg" == -ExitOnOutOfMemoryError ]] || [[ "$arg" == -exitonoutofmemoryerror ]] || [[ "$arg" == -eoom ]]; then
  43.                         EOOM="-XX:+ExitOnOutOfMemoryError"
  44.                 elif [[ "$arg" == json ]] || [[ "$arg" == "json=t" ]] || [[ "$arg" == "json=true" ]] || [[ "$arg" == "format=json" ]]; then
  45.                         json=1
  46.                 elif [[ "$arg" == silent ]] || [[ "$arg" == "silent=t" ]] || [[ "$arg" == "silent=true" ]]; then
  47.                         silent=1
  48.                 fi
  49.         done
  50.        
  51.         if [[ $setxmx == 1 ]] && [[ $setxms == 0 ]]; then
  52.                 local substring=`echo $z| cut -d'x' -f 2`
  53.                 z2="-Xms$substring"
  54.                 setxms=1
  55.         elif [[ $setxmx == 0 ]] && [[ $setxms == 1 ]]; then
  56.                 local substring=`echo $z2| cut -d's' -f 2`
  57.                 z="-Xmx$substring"
  58.                 setxmx=1
  59.         fi
  60.        
  61.         set=$setxmx
  62.        
  63. }

  64. function setEnvironment(){

  65.         EA="-ea"
  66.         EOOM=""

  67.         if [[ $SHIFTER_RUNTIME == 1 ]]; then
  68.                 #Ignore NERSC_HOST
  69.                 shifter=1
  70.         elif [ -v "$EC2_HOME" ]; then
  71.                 #Let's assume this is the AWS taxonomy server...
  72.                 PATH=/test1/binaries/bgzip:$PATH
  73.                 PATH=/test1/binaries/lbzip2/bin:$PATH
  74.                 PATH=/test1/binaries/sambamba:$PATH
  75.                 #PATH=/test1/binaries/java/jdk-11.0.2/bin:$PATH
  76.                 PATH=/test1/binaries/pigz2/pigz-2.4:$PATH
  77.         elif [ -z "$NERSC_HOST" ]; then
  78.                 #Not NERSC; do nothing
  79.                 :
  80.         else
  81.                 PATH=/global/projectb/sandbox/gaag/bbtools/bgzip:$PATH
  82.                 PATH=/global/projectb/sandbox/gaag/bbtools/lbzip2/bin:$PATH
  83.                 PATH=/global/projectb/sandbox/gaag/bbtools/sambamba:$PATH
  84.                 PATH=/global/projectb/sandbox/gaag/bbtools/java/jdk-11.0.2/bin:$PATH
  85.                 PATH=/global/projectb/sandbox/gaag/bbtools/pigz2/pigz-2.4:$PATH
  86.                
  87.                 if [[ $NERSC_HOST == cori ]]; then

  88.                         #module unload PrgEnv-intel
  89.                         #module load PrgEnv-gnu/7.1
  90.                         PATH=/global/projectb/sandbox/gaag/bbtools/samtools_cori/bin:$PATH
  91.                         :
  92.                 fi
  93.         fi
  94. }

  95. function freeRam(){
  96.         RAM=0;

  97.         #Memory is in kilobytes.
  98.         local defaultMem=3200000
  99.         if [ $# -gt 0 ]; then
  100.                 defaultMem=$1;
  101.                 case $defaultMem in
  102.                         *g)
  103.                         defaultMem=`echo $defaultMem| cut -d'g' -f 1`
  104.                         defaultMem=$(( $defaultMem * $(( 1024 * 1024 )) ))
  105.                         ;;
  106.                         *m)
  107.                         defaultMem=`echo $defaultMem| cut -d'm' -f 1`
  108.                         defaultMem=$(( $defaultMem * 1024 ))
  109.                         ;;
  110.                         *k)
  111.                         defaultMem=`echo $defaultMem| cut -d'k' -f 1`
  112.                         ;;
  113.                 esac
  114.         fi

  115.         local mult=84
  116.         if [ $# -gt 1 ]; then
  117.                 mult=$2;
  118.         fi
  119.        
  120.         #echo "mult =    $mult" # percent of memory to allocate
  121.         #echo "default = $defaultMem"
  122.        
  123.         local ulimit=$(ulimit -v)
  124.         ulimit="${ulimit:-0}"
  125.         if [ "$ulimit" = "unlimited" ]; then ulimit=0; fi
  126.         local x=$ulimit
  127.         #echo "x = ${x}" # normally ulimit -v
  128.        
  129.         #local HOSTNAME=`hostname`
  130.         local sge_x=0
  131.         local slurm_x=$(( SLURM_MEM_PER_NODE * 1024 ))

  132.         if [[ $RQCMEM -gt 0 ]]; then
  133.                 #echo "branch for manual memory"
  134.                 x=$(( RQCMEM * 1024 ));
  135.         elif [ -e /proc/meminfo ]; then
  136.                 local vfree=$(cat /proc/meminfo | awk -F: 'BEGIN{total=-1;used=-1} /^CommitLimit:/ { total=$2 }; /^Committed_AS:/ { used=$2 } END{ print (total-used) }')
  137.                 local pfree=$(cat /proc/meminfo | awk -F: 'BEGIN{free=-1;cached=-1;buffers=-1} /^MemFree:/ { free=$2 }; /^Cached:/ { cached=$2}; /^Buffers:/ { buffers=$2} END{ print (free+cached+buffers) }')
  138.                
  139.                 #echo "vfree =   $vfree"
  140.                 #echo "pfree =   $pfree"
  141.                 #echo "ulimit =  $ulimit"

  142.                 local x2=0;

  143.                
  144.                 if [ $vfree -gt 0 ] && [ $pfree -gt 0 ]; then
  145.                         if [ $vfree -gt $pfree ]; then x2=$pfree;
  146.                         else x2=$vfree; fi
  147.                 elif [ $vfree -gt 0 ]; then x2=$vfree;
  148.                 elif [ $pfree -gt 0 ]; then x2=$pfree;
  149.                 fi

  150.                 #echo $sge_x
  151.                 #echo $slurm_x
  152.                 #echo $x
  153.                 #echo $x2

  154.                 # set to SGE_HGR_RAMC or SLURM_MEM_PER_NODE value
  155.                 if [ $sge_x -gt 0 ]; then
  156.                         if [ $x2 -gt $sge_x ] || [ $x2 -eq 0 ]; then
  157.                                 x=$sge_x;
  158.                                 x2=$x;
  159.                         fi
  160.                 elif [ $slurm_x -gt 0 ]; then
  161.                         if [ $x2 -gt $slurm_x ] || [ $x2 -eq 0 ]; then
  162.                                 x=$slurm_x;
  163.                                 x2=$x;
  164.                         fi
  165.                 fi
  166.                
  167.                 #echo "x = ${x}"
  168.                 #echo "x2 = ${x2}"
  169.                 #echo $vfree
  170.                 #echo $pfree
  171.                
  172.                 if [ "$x" = "unlimited" ] || (("$x" > $x2)); then x=$x2; fi
  173.                 if [ $x -lt 1 ]; then x=$x2; fi
  174.         fi

  175.         if [ $x -lt 1 ] || [[ $HOSTNAME == genepool* ]]; then
  176.                 #echo "branch for unknown memory"
  177.                 #echo $x
  178.                 #echo "ram is unlimited"
  179.                 RAM=$((defaultMem/1024))
  180.                 echo "Max memory cannot be determined.  Attempting to use $RAM MB." 1>&2
  181.                 echo "If this fails, please add the -Xmx flag (e.g. -Xmx24g) to your command, " 1>&2
  182.                 echo "or run this program qsubbed or from a qlogin session on Genepool, or set ulimit to an appropriate value." 1>&2
  183.         else
  184.                 #echo "branch for known memory"
  185.                 #echo "x = ${x}"
  186.                 #echo "m = ${mult}"
  187.                
  188.                 # available (ram - 500k) * 85% / 1024kb = megs of ram to use
  189.                 # not sure where this formula came from
  190.                 RAM=$(( ((x-500000)*mult/100)/1024 ))
  191.                 #echo $RAM
  192.         fi
  193.         #local z="-Xmx${RAM}m"
  194.         #echo $RAM
  195.         return 0
  196. }

  197. #freeRam "$@"
复制代码

这是bbrename.sh
  1. #!/bin/bash

  2. usage(){
  3. echo "
  4. Written by Brian Bushnell
  5. Last modified April 1, 2020
  6. Description:  Renames reads to <prefix>_<number> where you specify the prefix
  7. and the numbers are ordered.  There are other renaming modes too.
  8. If reads are paired, pairs should be processed together; if reads are
  9. interleaved, the interleaved flag should be set.  This ensures that if a
  10. read number (such as 1: or 2:) is added, it will be added correctly.
  11. Usage:  rename.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2> prefix=<>
  12. in2 and out2 are for paired reads and are optional.
  13. If input is paired and there is only one output file, it will be written interleaved.
  14. Parameters:
  15. prefix=             The string to prepend to existing read names.
  16. ow=f                (overwrite) Overwrites files that already exist.
  17. zl=4                (ziplevel) Set compression level, 1 (low) to 9 (max).
  18. int=f               (interleaved) Determines whether INPUT file is considered interleaved.
  19. fastawrap=70        Length of lines in fasta output.
  20. minscaf=1           Ignore fasta reads shorter than this.
  21. qin=auto            ASCII offset for input quality.  May be 33 (Sanger), 64 (Illumina), or auto.
  22. qout=auto           ASCII offset for output quality.  May be 33 (Sanger), 64 (Illumina), or auto (same as input).
  23. ignorebadquality=f  (ibq) Fix out-of-range quality values instead of crashing with a warning.
  24. Renaming modes (if not default):
  25. renamebyinsert=f    Rename the read to indicate its correct insert size.
  26. renamebymapping=f   Rename the read to indicate its correct mapping coordinates.
  27. renamebytrim=f      Rename the read to indicate its correct post-trimming length.
  28. addprefix=f         Rename the read by prepending the prefix to the existing name.
  29. prefixonly=f        Only use the prefix; don't add _<number>
  30. addunderscore=t     Add an underscore after the prefix (if there is a prefix).
  31. addpairnum=t        Add a pairnum (e.g. ' 1:') to paired reads in some modes.
  32. fixsra=f            Fixes headers of SRA reads renamed from Illumina.
  33.                     Specifically, it converts something like this:
  34.                     SRR17611.11 HWI-ST79:17:D091UACXX:4:1101:210:824 length=75
  35.                     ...into this:
  36.                     HWI-ST79:17:D091UACXX:4:1101:210:824 1:
  37. Sampling parameters:
  38. reads=-1            Set to a positive number to only process this many INPUT reads (or pairs), then quit.
  39. Java Parameters:
  40. -Xmx                This will set Java's memory usage, overriding autodetection.
  41.                     -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs.
  42.                     The max is typically 85% of physical memory.
  43. -eoom               This flag will cause the process to exit if an
  44.                     out-of-memory exception occurs.  Requires Java 8u92+.
  45. -da                 Disable assertions.
  46. Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
  47. "
  48. }

  49. #This block allows symlinked shellscripts to correctly set classpath.
  50. pushd . > /dev/null
  51. DIR="${BASH_SOURCE[0]}"
  52. while [ -h "$DIR" ]; do
  53.   cd "$(dirname "$DIR")"
  54.   DIR="$(readlink "$(basename "$DIR")")"
  55. done
  56. cd "$(dirname "$DIR")"
  57. DIR="$(pwd)/"
  58. popd > /dev/null

  59. #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
  60. CP="$DIR""current/"

  61. z="-Xmx1g"
  62. set=0

  63. if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
  64.         usage
  65.         exit
  66. fi

  67. calcXmx () {
  68.         source "$DIR""/calcmem.sh"
  69.         setEnvironment
  70.         parseXmx "$@"
  71. }
  72. calcXmx "$@"

  73. function rename() {
  74.         local CMD="java $EA $EOOM $z $CP -cp jgi.RenameReads $@"
  75.         echo $CMD >&2
  76.         eval $CMD
  77. }

  78. rename "$@"
复制代码


我程序运行bbrename.sh就出错了。。Error: Could not find or load main class jgi.RenameReads
这个class在那个文件夹下面是有的,但是为什么就是无法载入。。不太懂java
这是在centos下运行的。。
这个是运行命令
  1. java -ea -Xmx1g -classpath /02.antisense/BBMap-master/sh/current/ jgi.RenameReads
复制代码


02.antisense/BBMap-master/current/jgi/RenameReads.java
这个文件的确存在 没办法载入
最佳答案
2021-9-24 21:22:37
谢谢

最佳答案

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-9-24 21:22:37 | 显示全部楼层    本楼为最佳答案   
谢谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-9-24 22:17:19 | 显示全部楼层
有没有帮帮我的。。头皮发麻了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-10-1 22:55:34 | 显示全部楼层
幸福来得太突然当时以为是回复得鱼币的那种,我现在才接触C语言暂时没办法解决,抱歉,谢谢你的鱼币,我会好好学习的
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-10-7 09:48:04 | 显示全部楼层
AdiosSpike 发表于 2021-10-1 22:55
幸福来得太突然当时以为是回复得鱼币的那种,我现在才接触C语言暂时没办法解决,抱歉,谢谢你的 ...

我已经搞定了 嘿嘿
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-10-7 16:28:38 | 显示全部楼层
wtfitis 发表于 2021-10-7 09:48
我已经搞定了 嘿嘿

哈哈哈 恭喜恭喜 虽然我是初学者 但每次把bug找出来的时候确实很棒
大佬 继续加油哦
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-29 04:26

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表