don't do this...关于vector(2008-04-29 17:12)

本文讨论了C++中vector容器的安全使用方法,特别是避免在使用引用和指针访问vector元素时出现的问题。当对vector进行扩展操作如push_back、reserve或resize时,可能导致原有引用和指针失效。
 

不要做这种事:

vector<Type> vSomething;
//do something
Type* pObj = &vSomething[0];
Type& rObj = vSomething[0];
//do something

只要后面往vSomething里面push_back或执行reserve,resize这些函数, 使vector重新分配空间, 引用和指针指向的都不是vector里面的东西了.

就这问题折腾了一天...FT...

重新注意这些参数,“(Hic) [scb3201@ln137%bscc-a6 ~]$ juicer Usage: juicer <command> <arguments> Version: 1.2.2 Command: pre generate files compatible with Juicebox toolset post generate assembly files after Juicebox curation (Hic) [scb3201@ln137%bscc-a6 ~]$ juicer pre [E::main_pre] missing input: three positional options required Usage: juicer pre [options] <hic.bed>|<hic.bam>|<hic.pa5>|<hic.bin> <scaffolds.agp> <contigs.fa.fai> Options: -a preprocess for assembly mode -q INT minimum mapping quality [10] -o STR output file prefix (required for '-a' mode) [stdout] --file-type STR input file type BED|BAM|PA5|BIN, file name extension is ignored if set --version show version number (Hic) [scb3201@ln137%bscc-a6 ~]$ juicebox_assembly_converter.py usage: juicebox_assembly_converter.py [-h] -a ASSEMBLY -f FASTA [-p PREFIX] [-c] [-s] [-v] juicebox_assembly_converter.py: error: the following arguments are required: -a/--assembly, -f/--fasta (Hic) [scb3201@ln137%bscc-a6 Hic]$ juicer post [E::main_post] missing input: three positional options required Usage: juicer post [options] <review.assembly> <liftover.agp> <contigs.fa[.fai]> Options: -o STR output file prefix (required for scaffolds FASTA output) [stdout] --seq-ctype STR AGP output sequence component type [W] --gap-ctype STR AGP output gap component type [U] --gap-link STR AGP output gap linkage evidence [proximity_ligation] --gap-size INT AGP output gap size between sequence component [100] --version show version number (Hic) [scb3201@ln137%bscc-a6 Hic]$ /public1/home/scb3201/anaconda3/envs/Hic/share/juicer-1.6-0/juicer_tools -h WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. WARN [2025-12-08T16:37:25,594] [Globals.java:138] [main] Development mode is enabled Juicer Tools Version 1.22.01 Usage: dump <observed/oe> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize> [outfile] dump <norm/expected> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] dump <loops/domains> <hicFile URL> [outfile] pre [options] <infile> <outfile> <genomeID> addNorm <input_HiC_file> [input_vector_file] pearsons [-p] <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] eigenvector -p <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] apa <hicFile(s)> <PeaksFile> <SaveFolder> arrowhead <hicFile(s)> <output_file> hiccups <hicFile> <outputDirectory> hiccupsdiff <firstHicFile> <secondHicFile> <firstLoopList> <secondLoopList> <outputDirectory> validate <hicFile> -h, --help print help -v, --verbose verbose mode -V, --version print version Type juicer_tools <commandName> for more detailed usage instructions (Hic) [scb3201@ln137%bscc-a6 Hic]$ /public1/home/scb3201/anaconda3/envs/Hic/share/juicertools/juicer_tools -h WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. WARN [2025-12-08T16:37:45,685] [Globals.java:138] [main] Development mode is enabled Juicer Tools Version 2.20.00 Usage: dump <observed/oe> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr1>[:x1:x2] <chr2>[:y1:y2] <BP/FRAG> <binsize> [outfile] dump <norm/expected> <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] dump <loops/domains> <hicFile URL> [outfile] pre [options] <infile> <outfile> <genomeID> addNorm <input_HiC_file> [input_vector_file] pearsons [-p] <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] eigenvector -p <NONE/VC/VC_SQRT/KR> <hicFile(s)> <chr> <BP/FRAG> <binsize> [outfile] apa <hicFile(s)> <PeaksFile> <SaveFolder> arrowhead <hicFile(s)> <output_file> hiccups <hicFile> <outputDirectory> hiccupsdiff <firstHicFile> <secondHicFile> <firstLoopList> <secondLoopList> <outputDirectory> validate <hicFile> -h, --help print help -v, --verbose verbose mode -V, --version print version Type juicer_tools <commandName> for more detailed usage instructions (Hic) [scb3201@ln137%bscc-a6 Hic]$ /public1/home/scb3201/anaconda3/envs/Hic/share/juicer-1.6-0/juicer_tools pre WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. WARN [2025-12-08T16:40:00,498] [Globals.java:138] [main] Development mode is enabled Usage: juicer_tools pre [options] <infile> <outfile> <genomeID> : -d only calculate intra chromosome (diagonal) [false] : -f <restriction site file> calculate fragment map : -m <int> only write cells with count above threshold m [0] : -q <int> filter by MAPQ score greater than or equal to q [not set] : -c <chromosome ID> only calculate map on specific chromosome [not set] : -r <comma-separated list of resolutions> Only calculate specific resolutions [not set] : -t <tmpDir> Set a temporary directory for writing : -s <statistics file> Add the text statistics file to the Hi-C file header : -g <graphs file> Add the text graphs file to the Hi-C file header : -n Don't normalize the matrices : -z <double> scale factor for hic file : -a <1, 2, 3, 4, 5> filter based on inner, outer, left-left, right-right, tandem pairs respectively : --randomize_position randomize positions between fragment sites : --random_seed <long> for seeding random number generator : --frag_site_maps <fragment site files> for randomization : -k normalizations to include : -j number of CPU threads to use : --threads <int> number of threads : --mndindex <filepath> to mnd chr block indices (Hic) [scb3201@ln137%bscc-a6 Hic]$ /public1/home/scb3201/anaconda3/envs/Hic/share/juicertools/juicer_tools pre WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. WARN [2025-12-08T16:40:28,943] [Globals.java:138] [main] Development mode is enabled Usage: juicer_tools pre [options] <infile> <outfile> <genomeID> : -d only calculate intra chromosome (diagonal) [false] : -f <restriction site file> calculate fragment map : -m <int> only write cells with count above threshold m [0] : -q <int> filter by MAPQ score greater than or equal to q [not set] : -c <chromosome ID> only calculate map on specific chromosome [not set] : -r <comma-separated list of resolutions> Only calculate specific resolutions [not set] : -t <tmpDir> Set a temporary directory for writing : -s <statistics file> Add the text statistics file to the Hi-C file header : -g <graphs file> Add the text graphs file to the Hi-C file header : -n Don't normalize the matrices : -z <double> scale factor for hic file : -a <1, 2, 3, 4, 5> filter based on inner, outer, left-left, right-right, tandem pairs respectively : --randomize_position randomize positions between fragment sites : --random_seed <long> for seeding random number generator : --frag_site_maps <fragment site files> for randomization : -k normalizations to include : -j number of CPU threads to use : --threads <int> number of threads : --mndindex <filepath> to mnd chr block indices : --conserve-ram will minimize RAM usage : --check-ram-usage will check ram requirements prior to running : --shell how to execute shell (sh, bash, zsh, etc); default: sh”并根据这些参数重新核对脚本
12-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值