<jupyter_start><jupyter_text>Extract k-mers that have different abundances from otherwise similar bladder cells<jupyter_code>ksize = 21
! /home/olga/code/sourmash/utils/hashvals-to-signature.py --help
%%bash
/home/olga/code/sourmash/utils/hashvals-to-signature.py \
    --ksize 21 \
    --output bladder_hashes_different_abundances.sig \
    bladder_hashes_different_abundances.txt
! /home/olga/code/sourmash/utils/signature-to-kmers.py --help
%%bash

CELL1_R1=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B000610-3_56_F-1-1_R1_001.fastq.gz
CELL1_R2=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B000610-3_56_F-1-1_R2_001.fastq.gz


/home/olga/code/sourmash/utils/signature-to-kmers.py \
    --output-kmers bladder_hashes_different_abundances_kmers.txt \
    --output-sequences bladder_hashes_different_abundances_sequences.txt \
    bladder_hashes_different_abundances.sig $CELL1_R1 $CELL1_R2
! cat bladder_hashes_different_abundances_kmers.txt
! cat bladder_hashes_different_abundances_kmers.txt | cut -f 1 -d,<jupyter_output>kmer
ATCGAGGTCATGACTGGACAC
AGTGGACATGAAAGATGTGGA
GGAGTGGGTAAATTGCGCGCC
GCTCAGTTATTGACTACGAGC<jupyter_text>Since there's only 14 shared hashes anyway, look at all of them!<jupyter_code>%%bash
/home/olga/code/sourmash/utils/hashvals-to-signature.py \
    --ksize 21 \
    --output bladder_combined_hashes.sig \
    bladder_combined_hashes.txt
%%bash

CELL1_R1=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B000610-3_56_F-1-1_R1_001.fastq.gz
CELL1_R2=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B000610-3_56_F-1-1_R2_001.fastq.gz
CELL2_R1=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B002764-3_38_F-1-1_R1_001.fastq.gz
CELL2_R2=/home/olga/pureScratch/czb-maca/Plate_Seq/3_month/170914_A00111_0058_AH3FYKDMXX__170914_A00111_0057_BH3FY7DMXX/fastqs/A1-B002764-3_38_F-1-1_R2_001.fastq.gz

/home/olga/code/sourmash/utils/signature-to-kmers.py \
    --output-kmers bladder_combined_hashes_kmers.txt \
    --output-sequences bladder_combined_hashes_sequences.txt \
    bladder_combined_hashes.sig $CELL1_R1 $CELL1_R2 $CELL2_R1 $CELL2_R2
! cat /home/olga/code/sourmash/utils/signature-to-kmers.py
! cat bladder_combined_hashes_kmers.txt
import pandas as pd

kmer_hashes = pd.read_csv('bladder_combined_hashes_kmers.txt')
kmer_hashes = kmer_hashes.sort_values('hashval')
kmer_hashes
fasta = 'bladder_combined_hashes_kmers.fasta'

with open(fasta, 'w') as f:
    for i, (_, row) in enumerate(kmer_hashes.iterrows()):
        f.write(">kmer{i:02}_{hashval}\n{kmer}\n".format(i=i, **row))
! cat $fasta<jupyter_output>>kmer00_171794956858086
AAAAATAAAAAAAAAAACACA
>kmer01_394031160505449
CATGATTAAGAGTGACTGCCG
>kmer02_513049510280006
AAGAGGGTCGGCCGGGGGCAT
>kmer03_635563321059591
AGTGGACATGAAAGATGTGGA
>kmer04_734478954482604
CCCAACTTCTTAGAGGGATAA
>kmer05_790330283259107
ATTTTTTTTTTTTTTACTAAA
>kmer06_860437213521678
AAAGTCGTCGGAAGATCCTGA
>kmer07_936637619733676
ACTGTGGTAATTCTAGAGCTG
>kmer08_937624453106451
ATCGAGGTCATGACTGGACAC
>kmer09_1012839673718406
GGAGTGGGTAAATTGCGCGCC
>kmer10_1026077759632952
GCTCAGTTATTGACTACGAGC
>kmer11_1067106972354716
GAGGATGGTGAAGTAAAGACC
>kmer12_1215285019941982
GTGTAATATAAAAAAAAACCA
>kmer13_1225906413461687
GTATAAGAGACAGGGGCTGTA
{'fraction_non_alphanumeric': 0.09221253865617093, 'fraction_numerical': 0.16249648580264267, 'mean_word_length': 6.977578475336323, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '382531', 'license': 'MIT', 'n_tokens_mistral': 2061, 'n_tokens_neox': 1669, 'n_words': 134, 'path': 'notebooks/bladder_hash2kmer.ipynb', 'repo_name': 'czbiohub/kh-analysis', 'size': '3557'}