Converting biom to classic format? - qiime

Is it still possible to convert .biom tables from QIIME to QIIME’s "classic" OTU table format to use with Explicet?
I've tried running the command from biom-format.org
biom convert -i table.biom -o table.from_biom_w_taxonomy.txt --to-tsv --header-key taxonomy
but gives back an error:
biom convert: error: no such option: --to-tsv
Any ideas?

I'm using QIIME too and went through the tutorial from Wernerlab. Here I've successfully converted a .biom table into a text file, also with the biom convert command. Maybe you can find clarification in the command line there:
biom convert -i otu_table.biom -o otu_table_tabseparated.txt -b --header-key="taxonomy" --output-metadata-id="Consensus Lineage"
Cheers,
Dennis

Related

How do raw PDF data and convert it into another PDF file using a bash script?

I am trying to convert raw PDF data into a PDF file to run pdftotext on.
The data from file1.pdf is the data I want. If I call the following:
cat file1.pdf > file2.pdf
pdftotext works fine on file2.pdf.
However, if I try to run the following:
VAR1=$(cat file1.pdf)
echo $VAR1 > file2.pdf
pdftotext file2.pdf -
I end up with the following errors:
Syntax Error (99): Illegal character ')'
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
Is there anyway I can use the latter structure? I need to do it this way since the bash script will accept the contents of a PDF file and not the PDF file itself.

Error manually regenerating .proto files

I am trying to implement the stickynote application in this tutorial https://cloud.google.com/solutions/mobile/mobile-compute-engine-grpc
However, when i try to manually regenerate my .proto files i get the following error message
-bash: !ProtoCompiler/protoc: event not found
Here is the command i am trying to run on the command line
../Pods/!ProtoCompiler/protoc —plugin=protoc-gen-grpc=../Pods/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin —objc_out=. —grpc_out=. -I . -I ../Pods/!ProtoCompiler *.proto
Not sure what the error could be
! is a special character in bash used for History Expansion Event Designation
Single quote your argument strings including it or escape using \
../Pods/\!ProtoCompiler/protoc —plugin=protoc-gen-grpc='../Pods/!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin' —objc_out=. —grpc_out=. -I . -I '../Pods/!ProtoCompiler' *.proto
Even better, rename the directory/binaries so that they don't have ! in them.

Read data at given address out of hex file using srec tools

I'm wondering if there is a way to read data out of a .hex file at a given address using the srec tool family like srec_cat or srec_info. I know that I could parse the file by myself but there must be a tool out there already. Does anyone have already done something similar?
Today I found a solution using srec_cat to write only part of the hex file to a binary output file.
srec_cat.exe my.hex -intel -crop 0x08010000 0x08010040 -offset -0x08010000 -o out.bin -binary
The datasheet pointed out that is also possible to print the result to std:out. For me this is not working at all. Have no clue why.
Output filename [ format ] This option may be used to specify the
output file to be used. The special file name “−[rq] is understood to
mean the standard output. Output defaults to the standard output if
this option is not used.
What do I have to write to use this functionality:
srec_cat.exe my.hex -intel -crop 0x08010000 0x08010040 -offset -0x08010000 -o -[rq] -binary
Anyway the workaround with the file is working as expected. Without the file step would be a nice add on.

How to get value displayed in image created by Base64-encoded string?

I have a Base64-encoded string that is used as the source of an image element on a website and need to derive the value from said string. Is there any tool that allows this information to be extracted from an image based on the bits returned by decoding the Base64 string? An example is here:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAArCAYAAADR/aKkAAABUElEQVR42u3cW27EIBAFUfa/abKCiRJ7+kFzrsQnFLYKgy3wWiIiIiIiIiIiIiIiIiIin7L/UKr7VnHdC/cM7n5RqgZW9gCOYOMGcPeXyi03uep6cZOF3ofd4FU4iHEDuf+pHHHRHZ8YkUsf3GBudCefthW5hn7S7jf6gpvDLX1L/a1O9vSn7vl1W3+ByBQ6uj5uDvcqoU3fs7mEJhahJwod3Q5uDvcqoX0Cm81tLzOhcQlNaEK3HTWExo12LfvNk9C4JVtMF6GJdZLQE/ZDE4vQpTITGjd18/8iNLFOErrDWUJC44Zs+q86GEto3FdtdTvlbS8H7hiZM4W2620Gt+Uyg9C4r9voKHPUrOHkyPATK5vQzudNqdtZ5sj+mb6HcndQ6S60T2BDuR2EruT7g9Ew7u1Cr8JZCDfhN2A3Cr1WzyUVbsFUMEXo6pdk3IfcH7oMZxgkIFxpAAAAAElFTkSuQmCC">
This returns an image containing the value 210000, but I need some way, if possible to return that actual value.
If the only answer is some sort of OCR technology, any advice on where to start, specifically related to embedding this in a Ruby script, would be greatly appreciated.
Thanks in advance!
I have just tried your example with Tesseract, an open OCR system, on an Ubuntu command line.
Going from base64 to digits looked like this:
$ base64 -d image.base64 | tesseract - - digits | sed -e 's/\ //g'
With the output:
210000
I'm afraid I don't know how that would integrate with Ruby, but I hope this helps you.
I had to solve this myself today, here's what I came up with:
File.open('im.png','wb'){|f| f << Base64.decode64(src.sub('data:image/png;base64,',''))}
num = `tesseract -psm 8 -l eng im.png - digits`.gsub(/\D/,'')
I had to apt-get install tesseract-ocr and download the traineddata:
wget https://github.com/tesseract-ocr/tessdata/raw/master/eng.traineddata
sudo mv -v eng.traineddata /usr/share/tesseract-ocr/tessdata/

.cat.fastq to .cat.fasta file conversion problems

I'm trying to convert fastq to fasta without doing a quality filter first. When I try to use fastx toolkit to run this conversion, it gives me an error message when it runs into a low quality base and terminates the conversion so that my converted output ends very early. (error says something like quality score below -30).
I then tried to use a sed solution posted earlier on this forum about how to convert to fasta using sed. The line was this:
sed -n '1~4s/^#/>/p;2~4p'
the line I input to the terminal was:
sed -n '1~4s/^#/>/p;2~4p' Sample_As_L001_R1.cat.fastq
It spit out what I wanted, but printed directly into the terminal.
How do I get this info to not print on the terminal, but to print to an output file?
How do I specify the file/file name that I want the output to go into. Thanks.
redirect it to a file
sed -n '1~4s/^#/>/p;2~4p' Sample_As_L001_R1.cat.fastq > Sample_As_L001_R1.cat.fasta

Resources