Difference between revisions of "SPARKY list"

From relax wiki
Jump to navigation Jump to search
(Created page with "== SPARKY list == <source lang="text"> This format </source> == See also == Category:Peak_lists")
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== SPARKY list ==
+
__TOC__
 +
 
 +
== Format of a sparky list ==
 +
To be show properly in sparky and read by relax, the list should be of format
 
<source lang="text">
 
<source lang="text">
This format
+
Assignment        w1        w2 
 +
 
 +
V2N-HN    128.055      8.874
 +
F3N-HN    128.210      8.893
 +
G4N-HN    105.080      8.509
 
</source>
 
</source>
 +
The '''N''' should be standing first, and the '''w1''' should be the corresponding ppm for nitrogen.
 +
 +
== sparky_shift1_col.sh ==
 +
Can be used to shift column
 +
<source lang="bash">
 +
#!/bin/tcsh -f
 +
set PEAKS=$1
 +
set PEAKSTEMP=${PEAKS}.temp
 +
set PEAKSNEW=${PEAKS}.shift
 +
#awk '{print $1, $2, $3}' $PEAKS > $PEAKSTEMP
 +
cp -f $PEAKS $PEAKSTEMP
 +
set ASSIGNS=`awk '$2 ~ /^[0-9]/ {print $0}' $PEAKSTEMP`
 +
#set ASSIGNS=`awk '{print $1, $2, $3}' $PEAKSTEMP`
 +
set TJECK1=`echo $ASSIGNS[1] | rev | cut -c1`
 +
set TJECK2=`echo $ASSIGNS[1] | rev | cut -c2`
 +
set TJECK12=`echo $ASSIGNS[1] | rev | cut -c1-2`
 +
if ( $TJECK2 == 'H' && $TJECK12 == 'NH' ) then
 +
else if ( $TJECK1 == 'N') then
 +
    sed -i "s/HN/XX/" $PEAKSTEMP
 +
    sed -i "s/N /HN /" $PEAKSTEMP
 +
    sed -i "s/XX/N/" $PEAKSTEMP
 +
else
 +
    echo "Whoops. Something wrong, I exit. Check your peak list"
 +
    exit   
 +
endif
  
 +
set C2=`expr $ASSIGNS[2]`
 +
set C3=`expr $ASSIGNS[3]`
 +
set C2N=`echo "$C2 > 50" | bc`
 +
set C2HN=`echo "$C2 < 15" | bc`
 +
set C3N=`echo "$C3 > 50" | bc`
 +
set C3HN=`echo "$C3 < 15" | bc`
 +
if ($C2N == 1 && $C3HN == 1) then
 +
    awk '{print $1,$2,$3}' $PEAKSTEMP > $PEAKSNEW
 +
else if ($C3N == 1 && $C2HN == 1) then
 +
    awk '{print $1,$3,$2}' $PEAKSTEMP > $PEAKSNEW
 +
endif
 +
rm $PEAKSTEMP
 +
</source>
  
 
== See also ==
 
== See also ==
[[Category:Peak_lists
+
[[Category:Peak_lists]]
 +
[[Category:NMR software]]

Latest revision as of 16:11, 21 October 2020

Format of a sparky list

To be show properly in sparky and read by relax, the list should be of format

 Assignment         w1         w2  

 V2N-HN    128.055      8.874 
 F3N-HN    128.210      8.893 
 G4N-HN    105.080      8.509

The N should be standing first, and the w1 should be the corresponding ppm for nitrogen.

sparky_shift1_col.sh

Can be used to shift column

#!/bin/tcsh -f
set PEAKS=$1
set PEAKSTEMP=${PEAKS}.temp
set PEAKSNEW=${PEAKS}.shift
#awk '{print $1, $2, $3}' $PEAKS > $PEAKSTEMP
cp -f $PEAKS $PEAKSTEMP
set ASSIGNS=`awk '$2 ~ /^[0-9]/ {print $0}' $PEAKSTEMP`
#set ASSIGNS=`awk '{print $1, $2, $3}' $PEAKSTEMP`
set TJECK1=`echo $ASSIGNS[1] | rev | cut -c1`
set TJECK2=`echo $ASSIGNS[1] | rev | cut -c2`
set TJECK12=`echo $ASSIGNS[1] | rev | cut -c1-2`
if ( $TJECK2 == 'H' && $TJECK12 == 'NH' ) then
else if ( $TJECK1 == 'N') then
    sed -i "s/HN/XX/" $PEAKSTEMP
    sed -i "s/N /HN /" $PEAKSTEMP
    sed -i "s/XX/N/" $PEAKSTEMP
else
    echo "Whoops. Something wrong, I exit. Check your peak list"
    exit     
endif

set C2=`expr $ASSIGNS[2]`
set C3=`expr $ASSIGNS[3]`
set C2N=`echo "$C2 > 50" | bc`
set C2HN=`echo "$C2 < 15" | bc`
set C3N=`echo "$C3 > 50" | bc`
set C3HN=`echo "$C3 < 15" | bc`
if ($C2N == 1 && $C3HN == 1) then
    awk '{print $1,$2,$3}' $PEAKSTEMP > $PEAKSNEW
else if ($C3N == 1 && $C2HN == 1) then
    awk '{print $1,$3,$2}' $PEAKSTEMP > $PEAKSNEW
endif
rm $PEAKSTEMP

See also