How to create a Anatomic Regions in Study Code Sequence - dicom

I'd like to edit a DICOM file with dcmodify to add an 'Anatomic Regions in Study Code Sequence' element (TAG: 0008,0063) but I'm unsure how to do this.
I can add the tag but what do I then add as its children? Is is it a list of (0018,0015) tags?

That should work:
$ dcmodify -i "(0008,0063)[0].(0018,0015)=FOOBAR" test.dcm
If you get something like:
E: modifying tag in file test.dcm: Invalid Path: Non-sequence tag found with rest path following
E: There was 1 error
This indicate that the attribute 0008,0063 is not declared in your dicom.dic file. Eg:
$ grep 0008,0063 /usr/share/dcmtk/dicom.dic
-> returns nothing
In that case simply update your dcmtk package.
ref:
DCMTK: dcmodify: Modify DICOM files

Related

define SAMPLE for different dir name and sample name in snakemake code

I have written a snakemake code to run bwa_map. Fastq files are with different folder name and different sample name (paired end). It shows error as 'SAMPLES' is not defined. Please help.
Error:
$snakemake --snakefile rnaseq.smk mapped_reads/EZ-123-B_IGO_08138_J_2_S101_R2_001.bam -np
*NameError in line 2 of /Users/singhh5/Desktop/tutorial/rnaseq.smk:
name 'SAMPLES' is not defined
File "/Users/singhh5/Desktop/tutorial/rnaseq.smk", line 2, in *
#SAMPLE DIRECTORY
fastq
Sample_EZ-123-B_IGO_08138_J_2
EZ-123-B_IGO_08138_J_2_S101_R1_001.fastq.gz
EZ-123-B_IGO_08138_J_2_S101_R2_001.fastq.gz
Sample_EZ-123-B_IGO_08138_J_4
EZ-124-B_IGO_08138_J_4_S29_R1_001.fastq.gz
EZ-124-B_IGO_08138_J_4_S29_R2_001.fastq.gz
#My Code
expand("~/Desktop/{sample}/{rep}.fastq.gz", sample=SAMPLES)
rule bwa_map:
input:
"data/genome.fa",
"fastq/{sample}/{rep}.fastq"
conda:
"env.yaml"
output:
"mapped_reads/{rep}.bam"
threads: 8
shell:
"bwa mem {input} | samtools view -Sb -> {output}"
The specific error you are seeing is because the variable SAMPLES isn't set to anything before you use it in expand.
Some other issues you may run into:
Output file is missing the {sample} wildcard.
The value of threads isn't passed into bwa or samtools
You should place your expand into the input directive of the first rule in your snakefile, typically called all to properly request the files from bwa_map.
You aren't pairing your reads (R1 and R2) in bwa.
You should look around stackoverflow or some github projects for similar rules to give you inspiration on how to do this mapping.

Is it possible to use alias for keys in yaml with symfony/yaml?

I've been trying to read the following yaml file using symfony/yaml(v4.4.0) with cakephp3.
But, I get the following error.
Reference "aaa" does not exist in "path to yml" at line xx (near "*aaa:").
Symfony\Component\Yaml\Exception\ParseException
I would like to user the 'aaa' as a key later.
It doesn't work with "*aaa:" and works with "1:".
Basically, is it possible to use alias for keys in yaml file?
Here's the yaml file.
aaa: &aaa 1
bbb: &bbb 2
ccc: &ccc 3
*aaa: # <- this doesn't work and works with '1:'
- *bbb
- *ccc
For general spec-conforming YAML parsers
You need to write it with a space before :.
aaa: &aaa 1
bbb: &bbb 2
ccc: &ccc 3
*aaa :
- *bbb
- *ccc
YAML 1.2 allows : to be part of an anchor and therefore, the line will not be parsed as implicit key if : is written adjacent to the alias (since it becomes part of the alias then).
This has been discussed on the YAML core mailing list.
For Symfony
It seems Symfony parses *aaa: as alias *aaa with : as value indicator. While this is a spec violation, it shouldn't bother us since according to the mailing list, this is more like an oversight in the spec. However, Symfony fails to resolve the alias here, there's nothing much you can do about it but to file an issue for it.

How to write a custom constraint in the heat template of openstack?

I find I can write anything,like this
constraints:
- custom_constraint:here anything
description: Value must be one of m1.medium, m1.large or m1.xlarge
and in CLI do this WILL BE OK -> heat template-validate -f bad.yaml
And in the document ,just tell you that's a plugin,how should i write a validation plugin????
If you look at the setup.cfg file in the heat source code you will find there is a section that lists the constraints:
heat.constraints =
nova.flavor = heat.engine.clients.os.nova:FlavorConstraint
nova.network = heat.engine.clients.os.nova:NetworkConstraint
...
These reference classes: so if you look at the FlavorConstraint, you will find it in the file heat/heat/engine/clients/os/nova.py
An examination of the class should give you an idea of how to write your own.
That is, if I'm understanding your question (and the code!) correctly.

A simple AMZI prolog recursion, but is not giving the correct result as expected

So this is my .pro file content (AMZI PROLOG) :
room(kitchen).
room(office).
room(hall).
room('dining room').
room(cellar).
door(office, hall).
door(kitchen, office).
door(hall, 'dining room').
door(kitchen, cellar).
door('dining room', kitchen).
location(desk,office).
location(apple,kitchen).
location(flashlight,desk).
location('washing machine',cellar).
location(nani,'washing machine').
location(broccoli,kitchen).
location(crackers,kitchen).
location(computer,office).
location(envelope,desk).
location(stamp,envelope).
location(key,envelope).
edible(apple).
edible(crackers).
tastes_yucky(broccoli).
here(kitchen).
is_located_in(T1,T2):-location(X,T2),is_located_in(T1,X).
What I want to achieve is that if I use, for example, is_located_in(X,office), then the result will be :
X=desk,
X=flashlight,
X=computer,
X=envelope,
X=stamp,
X=key,
no
(in no particular order).
That way, the result will include things that basically located in / on the object in the office, instead of things that located directly in the office.
This is the source : http://www.amzi.com/AdventureInProlog/a8recurs.php
There is stated that the code are fine, but when I test it, it just returned :
no
Please help. Thanks.
Try this (in this order):
is_located_in(T1,T2):-location(T1,T2).
is_located_in(T1,T2):-location(X,T2),is_located_in(T1,X).

Server.MapPath does not like ~/ and ./

I am using the following code to try and find a file contained in another directory from my code file.
Set fi=fs.OpenTextFile(Server.MapPath("~/counter/counter.txt"), 1)
I have also tried.
Set fi=fs.OpenTextFile(Server.MapPath("./root/folder1/counter/counter.txt"), 1)
In either case this should get me back to the counter.txt file. From what I understand ~/ moves up 1 directory and ./ moves up to the root directory.
Both times however I receive an error saying an invalid character has been used. When removing these I get a different error saying the path cannot be found (Which I would expect because it is not a valid path without moving up 1 directory).
What are the valid characters to do the following in VBscript:
move up a single directory?
move up to the root directory?
Thanks for the help
A few things:
The tilde character "~" is not valid here.
The single period character "." is for specifying the current directory/folder.
A set of period characters ".." is for specifying the parent directory/folder. For example, to refer to a file found in the parent of the current directory, you might use:
Server.MapPath("../counter.txt")
You can chain these to walk up more than a single parent path. To refer to a file found three directories above the current, you might use:
Server.MapPath("../../../counter.txt")
The documentation on MSDN for the MapPath function outlines this. Pay attention to the caution listed here about enabling parent paths if you want to be able to refer to relative paths above the current directory. If you get an error when trying to refer to a parent path, then you do not have parent paths enabled.

Resources